manrajgrover / halo

šŸ’« Beautiful spinners for terminal, IPython and Jupyter
MIT License
2.89k stars 147 forks source link

{Issue #5}: Whitelist windows spinners #122

Open JoseALermaIII opened 5 years ago

JoseALermaIII commented 5 years ago

Description of new feature, or changes

Whitelists spinners that are compatible with Windows OS in halo.py's _get_spinner() method instead of always defaulting to line. Still defaults to line if spinner is not in the whitelist.

Checklist

I don't have much experience with testing, so I have to ask: is it being tested properly? Double-checking the tox output for halo.py, line 270 is the is_supported() check and lines 271-274 are only used in a non-Windows environment.

(venv36) C:\Users\User\PycharmProjects\halo>tox -e py36
GLOB sdist-make: C:\Users\User\PycharmProjects\halo\setup.py
py36 create: C:\Users\User\PycharmProjects\halo\.tox\py36
py36 installdeps: -rC:\Users\User\PycharmProjects\halo/requirements.txt, -rC:\Users\User\PycharmProjects\halo/requirements-dev.txt
py36 inst: C:\Users\User\PycharmProjects\halo\.tox\dist\halo-0.0.23.zip
py36 installed: astroid==2.2.5,attrs==19.1.0,bleach==3.1.0,certifi==2019.3.9,chardet==3.0.4,colorama==0.3.9,coverage==4.4.1,cursor==1.2.0,decorator==4.4.0,defusedxml==0.5.0,docu
tils==0.14,entrypoints==0.3,enum34==1.1.6,halo==0.0.23,idna==2.8,ipykernel==5.1.0,ipython==5.7.0,ipython-genutils==0.2.0,ipywidgets==7.1.0,isort==4.3.17,Jinja2==2.10.1,jsonschem
a==3.0.1,jupyter-client==5.2.4,jupyter-core==4.4.0,lazy-object-proxy==1.3.1,log-symbols==0.0.12,MarkupSafe==1.1.1,mccabe==0.6.1,mistune==0.8.4,nbconvert==5.4.1,nbformat==4.4.0,n
ose==1.3.7,notebook==5.7.8,pandocfilters==1.4.2,pickleshare==0.7.5,pkginfo==1.5.0.1,pluggy==0.9.0,prometheus-client==0.6.0,prompt-toolkit==1.0.15,py==1.8.0,Pygments==2.3.1,pylin
t==2.3.0,pyrsistent==0.14.11,python-dateutil==2.8.0,pywinpty==0.5.5,pyzmq==18.0.1,readme-renderer==24.0,requests==2.21.0,requests-toolbelt==0.9.1,Send2Trash==1.5.0,simplegeneric
==0.8.1,six==1.12.0,spinners==0.0.23,termcolor==1.1.0,terminado==0.8.2,testpath==0.4.2,tornado==6.0.2,tox==2.8.2,tqdm==4.31.1,traitlets==4.3.2,twine==1.12.1,typed-ast==1.3.1,url
lib3==1.24.1,virtualenv==16.4.3,wcwidth==0.1.7,webencodings==0.5.1,widgetsnbextension==3.1.4,wrapt==1.11.1
py36 runtests: PYTHONHASHSEED='929'
py36 runtests: commands[0] | nosetests --cover-package=halo --with-coverage --cover-erase --cover-branches --nologcapture
.......................................................
Name                    Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------
halo\__init__.py            6      0      0      0   100%
halo\_utils.py             51     14     10      4    70%   9-10, 30, 45-46, 52, 54, 58-59, 131-134, 150, 29->30, 51->52, 53->54, 149->150
halo\halo.py              200     15     54      7    91%   82, 85-88, 271-274, 349-350, 406, 427, 456, 534, 546-547, 84->85, 270->271, 405->406, 426->427, 447->451, 455->456, 5
33->534
halo\halo_notebook.py      59      3     14      3    92%   58, 87, 99, 57->58, 86->87, 98->99
-------------------------------------------------------------------
TOTAL                     316     32     78     14    88%
----------------------------------------------------------------------
Ran 55 tests in 45.855s

OK
___________________________________________________________________________________ summary ____________________________________________________________________________________
  py36: commands succeeded
  congratulations :)

(venv36) C:\Users\User\PycharmProjects\halo>tox -e lint
GLOB sdist-make: C:\Users\User\PycharmProjects\halo\setup.py
lint recreate: C:\Users\User\PycharmProjects\halo\.tox\lint
lint installdeps: -rC:\Users\User\PycharmProjects\halo/requirements.txt, -rC:\Users\User\PycharmProjects\halo/requirements-dev.txt
lint inst: C:\Users\User\PycharmProjects\halo\.tox\dist\halo-0.0.23.zip
lint installed: astroid==2.2.5,attrs==19.1.0,bleach==3.1.0,certifi==2019.3.9,chardet==3.0.4,colorama==0.3.9,coverage==4.4.1,cursor==1.2.0,decorator==4.4.0,defusedxml==0.5.0,docu
tils==0.14,entrypoints==0.3,enum34==1.1.6,halo==0.0.23,idna==2.8,ipykernel==5.1.0,ipython==5.7.0,ipython-genutils==0.2.0,ipywidgets==7.1.0,isort==4.3.17,Jinja2==2.10.1,jsonschem
a==3.0.1,jupyter-client==5.2.4,jupyter-core==4.4.0,lazy-object-proxy==1.3.1,log-symbols==0.0.12,MarkupSafe==1.1.1,mccabe==0.6.1,mistune==0.8.4,nbconvert==5.4.1,nbformat==4.4.0,n
ose==1.3.7,notebook==5.7.8,pandocfilters==1.4.2,pickleshare==0.7.5,pkginfo==1.5.0.1,pluggy==0.9.0,prometheus-client==0.6.0,prompt-toolkit==1.0.15,py==1.8.0,Pygments==2.3.1,pylin
t==2.3.0,pyrsistent==0.14.11,python-dateutil==2.8.0,pywinpty==0.5.5,pyzmq==18.0.1,readme-renderer==24.0,requests==2.21.0,requests-toolbelt==0.9.1,Send2Trash==1.5.0,simplegeneric
==0.8.1,six==1.12.0,spinners==0.0.23,termcolor==1.1.0,terminado==0.8.2,testpath==0.4.2,tornado==6.0.2,tox==2.8.2,tqdm==4.31.1,traitlets==4.3.2,twine==1.12.1,typed-ast==1.3.1,url
lib3==1.24.1,virtualenv==16.4.3,wcwidth==0.1.7,webencodings==0.5.1,widgetsnbextension==3.1.4,wrapt==1.11.1
lint runtests: PYTHONHASHSEED='496'
lint runtests: commands[0] | pylint --errors-only --rcfile=C:\Users\User\PycharmProjects\halo/.pylintrc --output-format=colorized halo
___________________________________________________________________________________ summary ____________________________________________________________________________________
  lint: commands succeeded
  congratulations :)

Related Issues and Discussions

Partially fixes #5 except for

Now let's say we document Windows supported spinners.

This could be part of #6, which I can address using Sphinx in another PR.

It also doesn't address

I wish to support Python 2.7 for as long as possible and yes, there are dependents who make use of this version.

I don't know what Python 2.7.x will have issues with, but I can try it out.

People to notify

@manrajgrover

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 362


Changes Missing Coverage Covered Lines Changed/Added Lines %
halo/halo.py 1 4 25.0%
<!-- Total: 1 4 25.0% -->
Totals Coverage Status
Change from base Build 355: -0.9%
Covered Lines: 290
Relevant Lines: 316

šŸ’› - Coveralls
JoseALermaIII commented 5 years ago

Yikes, I checked AppVeyor and it seems that pylint=2.3.0 is not available for Python 2.7; however, this is the issue I was running into without it in Python 3.6

Edit: Found out why. I'm getting this warning when I try to install requirements-dev.txt in Python 2.7:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

JoseALermaIII commented 5 years ago

By luck, coincidence, or design (I'll take either), the last version of pylint for Python 2.7 passes all tests:

(venv27) C:\Users\User\PycharmProjects\halo>tox -e py27
GLOB sdist-make: C:\Users\User\PycharmProjects\halo\setup.py
py27 create: C:\Users\User\PycharmProjects\halo\.tox\py27
py27 installdeps: -rC:\Users\User\PycharmProjects\halo/requirements.txt, -rC:\Users\User\PycharmProjects\halo/requirements-dev.txt
py27 inst: C:\Users\User\PycharmProjects\halo\.tox\dist\halo-0.0.23.zip
py27 installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A futu
re version of pip will drop support for Python 2.7.,astroid==1.6.6,attrs==19.1.0,backports-abc==0.5,backports.functools-lru-cache==1.5,backports.shutil-get-terminal-size==1.0.0,
backports.shutil-which==3.5.2,bleach==3.1.0,certifi==2019.3.9,chardet==3.0.4,colorama==0.3.9,configparser==3.7.4,coverage==4.4.1,cursor==1.2.0,decorator==4.4.0,defusedxml==0.5.0
,docutils==0.14,entrypoints==0.3,enum34==1.1.6,functools32==3.2.3.post2,futures==3.2.0,halo==0.0.23,idna==2.8,ipaddress==1.0.22,ipykernel==4.10.0,ipython==5.7.0,ipython-genutils
==0.2.0,ipywidgets==7.1.0,isort==4.3.17,Jinja2==2.10.1,jsonschema==3.0.1,jupyter-client==5.2.4,jupyter-core==4.4.0,lazy-object-proxy==1.3.1,log-symbols==0.0.12,MarkupSafe==1.1.1
,mccabe==0.6.1,mistune==0.8.4,nbconvert==5.4.1,nbformat==4.4.0,nose==1.3.7,notebook==5.7.8,pandocfilters==1.4.2,pathlib2==2.3.3,pickleshare==0.7.5,pkginfo==1.5.0.1,pluggy==0.9.0
,prometheus-client==0.6.0,prompt-toolkit==1.0.15,py==1.8.0,Pygments==2.3.1,pylint==1.9.4,pyrsistent==0.14.11,python-dateutil==2.8.0,pywinpty==0.5.5,pyzmq==18.0.1,readme-renderer
==24.0,requests==2.21.0,requests-toolbelt==0.9.1,scandir==1.10.0,Send2Trash==1.5.0,simplegeneric==0.8.1,singledispatch==3.4.0.3,six==1.12.0,spinners==0.0.23,termcolor==1.1.0,ter
minado==0.8.2,testpath==0.4.2,tornado==5.1.1,tox==2.8.2,tqdm==4.31.1,traitlets==4.3.2,twine==1.12.1,urllib3==1.24.1,virtualenv==16.4.3,wcwidth==0.1.7,webencodings==0.5.1,widgets
nbextension==3.1.4,win-unicode-console==0.5,wrapt==1.11.1
py27 runtests: PYTHONHASHSEED='186'
py27 runtests: commands[0] | nosetests --cover-package=halo --with-coverage --cover-erase --cover-branches --nologcapture
.......................................................
Name                    Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------
halo\__init__.py            6      0      0      0   100%
halo\_utils.py             51     14     10      4    70%   30, 45-46, 52, 54, 58-59, 114-115, 131-134, 150, 29->30, 51->52, 53->54, 149->150
halo\halo.py              200     15     52      7    90%   82, 85-88, 271-274, 349-350, 406, 427, 456, 534, 546-547, 84->85, 270->271, 405->406, 426->427, 447->451, 455->456, 5
33->534
halo\halo_notebook.py      59      3     14      3    92%   58, 87, 99, 57->58, 86->87, 98->99
-------------------------------------------------------------------
TOTAL                     316     32     76     14    88%
----------------------------------------------------------------------
Ran 55 tests in 45.719s

OK
___________________________________ summary ___________________________________
  py27: commands succeeded
  congratulations :)

(venv27) C:\Users\User\PycharmProjects\halo>tox -e py36
GLOB sdist-make: C:\Users\User\PycharmProjects\halo\setup.py
py36 recreate: C:\Users\User\PycharmProjects\halo\.tox\py36
py36 installdeps: -rC:\Users\User\PycharmProjects\halo/requirements.txt, -rC:\Users\User\PycharmProjects\halo/requirements-dev.txt
py36 inst: C:\Users\User\PycharmProjects\halo\.tox\dist\halo-0.0.23.zip
py36 installed: astroid==1.6.6,attrs==19.1.0,bleach==3.1.0,certifi==2019.3.9,chardet==3.0.4,colorama==0.3.9,coverage==4.4.1,cursor==1.2.0,decorator==4.4.0,defusedxml==0.5.0,docu
tils==0.14,entrypoints==0.3,enum34==1.1.6,halo==0.0.23,idna==2.8,ipykernel==5.1.0,ipython==5.7.0,ipython-genutils==0.2.0,ipywidgets==7.1.0,isort==4.3.17,Jinja2==2.10.1,jsonschem
a==3.0.1,jupyter-client==5.2.4,jupyter-core==4.4.0,lazy-object-proxy==1.3.1,log-symbols==0.0.12,MarkupSafe==1.1.1,mccabe==0.6.1,mistune==0.8.4,nbconvert==5.4.1,nbformat==4.4.0,n
ose==1.3.7,notebook==5.7.8,pandocfilters==1.4.2,pickleshare==0.7.5,pkginfo==1.5.0.1,pluggy==0.9.0,prometheus-client==0.6.0,prompt-toolkit==1.0.15,py==1.8.0,Pygments==2.3.1,pylin
t==1.9.4,pyrsistent==0.14.11,python-dateutil==2.8.0,pywinpty==0.5.5,pyzmq==18.0.1,readme-renderer==24.0,requests==2.21.0,requests-toolbelt==0.9.1,Send2Trash==1.5.0,simplegeneric
==0.8.1,six==1.12.0,spinners==0.0.23,termcolor==1.1.0,terminado==0.8.2,testpath==0.4.2,tornado==6.0.2,tox==2.8.2,tqdm==4.31.1,traitlets==4.3.2,twine==1.12.1,urllib3==1.24.1,virt
ualenv==16.4.3,wcwidth==0.1.7,webencodings==0.5.1,widgetsnbextension==3.1.4,wrapt==1.11.1
py36 runtests: PYTHONHASHSEED='592'
py36 runtests: commands[0] | nosetests --cover-package=halo --with-coverage --cover-erase --cover-branches --nologcapture
.......................................................
Name                    Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------
halo\__init__.py            6      0      0      0   100%
halo\_utils.py             51     14     10      4    70%   9-10, 30, 45-46, 52, 54, 58-59, 131-134, 150, 29->30, 51->52, 53->54, 149->150
halo\halo.py              200     15     54      7    91%   82, 85-88, 271-274, 349-350, 406, 427, 456, 534, 546-547, 84->85, 270->271, 405->406, 426->427, 447->451, 455->456, 5
33->534
halo\halo_notebook.py      59      3     14      3    92%   58, 87, 99, 57->58, 86->87, 98->99
-------------------------------------------------------------------
TOTAL                     316     32     78     14    88%
----------------------------------------------------------------------
Ran 55 tests in 46.498s

OK
___________________________________ summary ___________________________________
  py36: commands succeeded
  congratulations :)

(venv27) C:\Users\User\PycharmProjects\halo>tox -e lint
GLOB sdist-make: C:\Users\User\PycharmProjects\halo\setup.py
lint recreate: C:\Users\User\PycharmProjects\halo\.tox\lint
lint installdeps: -rC:\Users\User\PycharmProjects\halo/requirements.txt, -rC:\Users\User\PycharmProjects\halo/requirements-dev.txt
lint inst: C:\Users\User\PycharmProjects\halo\.tox\dist\halo-0.0.23.zip
lint installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A futu
re version of pip will drop support for Python 2.7.,astroid==1.6.6,attrs==19.1.0,backports-abc==0.5,backports.functools-lru-cache==1.5,backports.shutil-get-terminal-size==1.0.0,
backports.shutil-which==3.5.2,bleach==3.1.0,certifi==2019.3.9,chardet==3.0.4,colorama==0.3.9,configparser==3.7.4,coverage==4.4.1,cursor==1.2.0,decorator==4.4.0,defusedxml==0.5.0
,docutils==0.14,entrypoints==0.3,enum34==1.1.6,functools32==3.2.3.post2,futures==3.2.0,halo==0.0.23,idna==2.8,ipaddress==1.0.22,ipykernel==4.10.0,ipython==5.7.0,ipython-genutils
==0.2.0,ipywidgets==7.1.0,isort==4.3.17,Jinja2==2.10.1,jsonschema==3.0.1,jupyter-client==5.2.4,jupyter-core==4.4.0,lazy-object-proxy==1.3.1,log-symbols==0.0.12,MarkupSafe==1.1.1
,mccabe==0.6.1,mistune==0.8.4,nbconvert==5.4.1,nbformat==4.4.0,nose==1.3.7,notebook==5.7.8,pandocfilters==1.4.2,pathlib2==2.3.3,pickleshare==0.7.5,pkginfo==1.5.0.1,pluggy==0.9.0
,prometheus-client==0.6.0,prompt-toolkit==1.0.15,py==1.8.0,Pygments==2.3.1,pylint==1.9.4,pyrsistent==0.14.11,python-dateutil==2.8.0,pywinpty==0.5.5,pyzmq==18.0.1,readme-renderer
==24.0,requests==2.21.0,requests-toolbelt==0.9.1,scandir==1.10.0,Send2Trash==1.5.0,simplegeneric==0.8.1,singledispatch==3.4.0.3,six==1.12.0,spinners==0.0.23,termcolor==1.1.0,ter
minado==0.8.2,testpath==0.4.2,tornado==5.1.1,tox==2.8.2,tqdm==4.31.1,traitlets==4.3.2,twine==1.12.1,urllib3==1.24.1,virtualenv==16.4.3,wcwidth==0.1.7,webencodings==0.5.1,widgets
nbextension==3.1.4,win-unicode-console==0.5,wrapt==1.11.1
lint runtests: PYTHONHASHSEED='600'
lint runtests: commands[0] | pylint --errors-only --rcfile=C:\Users\User\PycharmProjects\halo/.pylintrc --output-format=colorized halo
Using config file C:\Users\User\PycharmProjects\halo\.pylintrc
___________________________________ summary ___________________________________
  lint: commands succeeded
  congratulations :)
JoseALermaIII commented 5 years ago

@manrajgrover Went with balloon2 for the frame test. It has 7 frames, so I put the assert in a for loop instead of having 7 assert statements.

py27, py36, and lint tests still pass in a Python 2.7 venv.