Skip to content

Commit

Permalink
Merge pull request #153 from pavdmyt/version-2.1.0
Browse files Browse the repository at this point in the history
Version 2.1.0

#153
  • Loading branch information
pavdmyt authored Aug 14, 2021
2 parents 50230c8 + e6388a6 commit 43661b9
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# So, installing only pytest and pytest-xdist that don't rely on typed-ast
# https://github.com/python/typed_ast/issues/97
install:
- pip install termcolor==1.1.0 pytest==6.2.4 pytest-xdist==2.2.1 dataclasses==0.8
- pip install termcolor==1.1.0 pytest==6.2.4 pytest-xdist==2.3.0 dataclasses==0.8
script:
- py.test -n auto
- stage: coverage
Expand Down
10 changes: 10 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Release History
===============

2.1.0 / 2021-08-14
------------------

* Ensure cursor is visible in case of failures (#152)
* Convert Spinner to dataclass; make it mutable (#151)
* Support for dynamic text objects (#147)
* Remove extra files from site-packages (#135)
* Update dependencies


2.0.0 / 2021-05-25
------------------

Expand Down
27 changes: 24 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
``yaspin``: **Y**\ et **A**\ nother Terminal **Spin**\ ner for Python
=====================================================================

|Build Status| |Coverage| |Codacy| |pyup| |black-fmt|
|Build Status| |Coverage| |pyup| |black-fmt|

|pypi| |Versions| |Wheel| |Examples|

Expand Down Expand Up @@ -242,6 +242,29 @@ Spinner with timer
sp.ok()
Dynamic text
////////////

.. code:: python
import time
from datetime import datetime
from yaspin import yaspin
class TimedText:
def __init__(self, text):
self.text = text
self._start = datetime.now()
def __str__(self):
now = datetime.now()
delta = now - self._start
return f"{self.text} ({round(delta.total_seconds(), 1)}s)"
with yaspin(text=TimedText("time passed:")):
time.sleep(3)
Writing messages
////////////////

Expand Down Expand Up @@ -420,8 +443,6 @@ License
:target: https://travis-ci.org/pavdmyt/yaspin
.. |Coverage| image:: https://codecov.io/gh/pavdmyt/yaspin/branch/master/graph/badge.svg
:target: https://codecov.io/gh/pavdmyt/yaspin
.. |Codacy| image:: https://api.codacy.com/project/badge/Grade/797c7772d0d3467c88a5e2e9dc79ec98
:target: https://www.codacy.com/app/pavdmyt/yaspin?utm_source=github.com&utm_medium=referral&utm_content=pavdmyt/yaspin&utm_campaign=Badge_Grade
.. |pypi| image:: https://img.shields.io/pypi/v/yaspin.svg
:target: https://pypi.org/project/yaspin/
.. |Versions| image:: https://img.shields.io/pypi/pyversions/yaspin.svg
Expand Down
31 changes: 31 additions & 0 deletions examples/dynamic_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
examples.dynamic_text
~~~~~~~~~~~~~~~~~~~~~
Evaluates text on every spinner frame.
"""

import time
from datetime import datetime

from yaspin import yaspin


class TimedText:
def __init__(self, text):
self.text = text
self._start = datetime.now()

def __str__(self):
now = datetime.now()
delta = now - self._start
return f"{self.text} ({round(delta.total_seconds(), 1)}s)"


def main():
with yaspin(text=TimedText("time passed:")):
time.sleep(3)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "yaspin"
version = "2.0.0"
version = "2.1.0"
description = "Yet Another Terminal Spinner"
license = "MIT"
authors = ["Pavlo Dmytrenko <[email protected]>"]
Expand Down
8 changes: 5 additions & 3 deletions tests/test_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_color(color_test_cases):
else:
getattr(sp, color)
assert sp.color == expected
assert sp._color_func.keywords["color"] == expected
assert sp._color_func.keywords["color"] == expected # pylint: disable=no-member


# Values for ``on_color`` argument
Expand All @@ -51,7 +51,9 @@ def test_on_color(on_color_test_cases):
else:
getattr(sp, on_color)
assert sp.on_color == expected
assert sp._color_func.keywords["on_color"] == expected
assert (
sp._color_func.keywords["on_color"] == expected
) # pylint: disable=no-member


# Values for ``attrs`` argument
Expand All @@ -62,7 +64,7 @@ def test_attrs(attr):
sp = yaspin()
getattr(sp, attr)
assert sp.attrs == [attr]
assert sp._color_func.keywords["attrs"] == [attr]
assert sp._color_func.keywords["attrs"] == [attr] # pylint: disable=no-member


def id_func(case):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def case_id():
return str(uuid.uuid4())


def test_piping_output(text, frames, interval, case_id):
def test_piping_output(
text, frames, interval, case_id
): # pylint: disable=redefined-outer-name
py_fname = "spin-{0}.py".format(case_id)
fname = "out-{0}.txt".format(case_id)

Expand Down
3 changes: 2 additions & 1 deletion yaspin-spellcheck-dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ addfinalizer
backport
bytecode
capsys
Codacy
codecov
dataclass
dataclasses
datetime
descr
Dmytrenko
dqpb
Expand Down

0 comments on commit 43661b9

Please sign in to comment.