Git Product home page Git Product logo

click-spinner's People

Contributors

astamminger avatar bamarni avatar hugovk avatar pierreluctg avatar tiangolo avatar yoavram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

click-spinner's Issues

Parameter to disable spinner

Hello,

can we have a parameter like disable:

with click_spinner.spinner(disable=True):

a bit like tqdm:

with tqdm(desc='Waiting status ', total=loop, disable=config.quiet) as bar:

in the case if user pass a --quiet parameter on command line

Thank you ;)

UnicodeDecodeError at installation

Collecting click-spinner
  Using cached https://files.pythonhosted.org/packages/4d/c4/e4cc6595266021b549f
774a20329188e68b63f06896eba94c1c952027c6e/click-spinner-0.1.8.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\owner\appdata\local\programs\python\python37\python.exe'
 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owner\\AppD
ata\\Local\\Temp\\pip-install-2phu8zfb\\click-spinner\\setup.py'"'"'; __file__='
"'"'C:\\Users\\Owner\\AppData\\Local\\Temp\\pip-install-2phu8zfb\\click-spinner\
\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read()
.replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"
'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Owner\AppData\Local\Temp\pip-insta
ll-2phu8zfb\click-spinner\pip-egg-info'
         cwd: C:\Users\Owner\AppData\Local\Temp\pip-install-2phu8zfb\click-spinn
er\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Owner\AppData\Local\Temp\pip-install-2phu8zfb\click-spinner
\setup.py", line 6, in <module>
        readme = f.read()
    UnicodeDecodeError: 'cp950' codec can't decode byte 0xe2 in position 373: il
legal multibyte sequence
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check th
e logs for full command output.

I think it is fixed by #23 but is never released? This bug prevents Windows from installing this package.

v0.1.7 on pypi

Sorry to bother you with that, but could you publish the last version on pypi?

Looking for maintainer(s)?

Hello,
The last commit on this repository is from two years ago and there are a couple pending PRs that could be merged as well as someone asking for a release for almost two years.

If you’re looking for someone to help co-maintain the repository, I’m willing to help.

setup.py needs README.md, but it is not in the tar.gz package

The setup.py file depends on the presence of README.md, but that file is not included in the .tar.gz version of the package.

With v0.1.4, this problem now comes up because the tar.gz version is the only one available on PyPI, so pip picks it.

With v0.1.3, this problem existed as well, but did not come up when installing via pip install click-spinner, because a .whl version existed in addition on PyPI, and pip apparently prefers the .whl version over the .tar.gz version. I don't fully understand why this does not surface in the .whl version, but I suspect that pip does not execute the setup.py when installing a .whl archive.

Context manager cannot be used with 'as'

I was trying to use the as clause along with the context manager abilities of the Spinner class in order to remember the Spinner object, because I want to temporarily suspend the spinner during a password prompt that may happen while executing the code that has the spinner turned on.

However, that resulted in a value of None in the name specified in the as clause.

For example:

with click_spinner.spinner() as sp:
    print(sp)

will print None.

Even if there is not much value currently in having the Spinner object at hand, I think it is part of the contract for a context manager to be able to support the `as´ clause.

Solution: Python uses the return value of the __enter__() method to bind the name specified in the as clause to. So in order to support the as clause, the __enter__() method of the Spinner class needs to return self.

Mac issue

This error repeats itself over and over again in the console.

objc[73294]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

CM exit function does not follow convention to return True or False

The Python description for the __exit__() function of context managers (see here) states that the __exit__() function should return True to indicate that exceptions raised during the context manager body should be suppressd, or False to indicate that such exceptions should be passed through.

the current implementation of the __exit__() function in the Spinner class returns nothing (i.e. None) and thus does not follow the documented convention. This does not currently hurt, because apparently the calling Python runtime code (at least in CPython 2.7) treats None in the same way as it would treat False, but nevertheless the Spinner code does not follow the documented convention and thus might show a different behaviour in a different Python implementation.

Solution: Return False in the __exit__() method. This assumes that we have consensus that exceptions in the context manager body should be passed through and should not be suppressed.

Spinning wheel characters are included in a redirected stdout

It is desirable to be able to redirect command output. If a spinner is active, the spinning wheel characters are redirected as well. In case of machine readable output, this is obviously undesired.

Ideally, the spinning wheel would be suppressed if stdout is redirected.

Printing to stdout breaks the spinner

If you try to print something while the spinner is spinning, both the spinner and the output will be borked. I didn't really expect it to work, but I think this behaviour is worth documenting, because it isn't mentioned in the readme.

Python 3.12.2, click-spinner 0.1.10.

Steps to reproduce:

from time import sleep

import click_spinner

if __name__ == '__main__':
    with click_spinner.spinner(force=True):
        for i in range(0, 10):
            sleep(i / 10)
            print(i)

ScreenRecording2024-03-27at02 20 50-ezgif com-video-to-apng-converter

drop python 2 support

Could you please consider to drop python 2 support? This would reduce dependency on six at least.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 189: ordinal not in range(128)

Trying to install blindspin on FreeBSD 10. Install clean on python 2.7, python 3.6 fails with the following error:

Collecting blindspin
  Downloading blindspin-2.0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ys3jzeiy/blindspin/setup.py", line 7, in <module>
        readme = f.read()
      File "/usr/local/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 189: ordinal not in range(128)

Spinner left last symbol on cmd

Using spinner, if i try printing anything on console then it spinner also gets added like below. It would better to have it cleared or add new line to avoid this.

My code -

with spinner():
time.sleep(2)
print('hello')

Output -
\hello

Expected output -
hello

Option to output to stderr

Some tools do allow to pipe way the output. Having the spinner able to output to stderr allows to pipe the real output (stdout) but still present feedback to the user via stderr

Spinner cannot be suspended and resumed

For a use case where I wanted to suspend the spinner during a password prompt that may happen in the code that is run with a spinner active, i wanted to suspend and resume the spinner.

After circumventing issue #1, I ran into another issue which is that there is no means to suspend and resume the Spinner object. The stop() method stops the spinner properly, but the subsequent start() method does not start it again but raises:

  . . . (some traceback lines removed) . . .
  File "/home/maiera/virtualenvs/zhmc27/lib/python2.7/site-packages/zhmccli/zhmccli.py", line 181, in password_prompt
    ctx.obj.spinner.start()
  File "/home/maiera/virtualenvs/zhmc27/lib/python2.7/site-packages/click_spinner/__init__.py", line 15, in start
    self.spin_thread.start()
  File "/usr/lib64/python2.7/threading.py", line 740, in start
    raise RuntimeError("threads can only be started once")
RuntimeError: threads can only be started once

conda-forge recipe

Dear @yoavram , I am in the process of adding a recipe for click-spinner to conda-forge
conda-forge/staged-recipes#5952

In this process, I've encountered a few minor issues that I would kindly ask you to address:

  • consider including the tests in your pypi release by adding something like recursive-include tests *.py to your MANIFEST.in. This would allow using the pypi release for automatic tests on conda-forge
  • minor: when running nosetests inside the tests directory, one of the tests fails (tests run fine, when running nosetests in top-level directory)
  • please add a license of your choice to your repository
  • please let me know if you would like to be listed as a maintainer of the conda recipe or not

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.