Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable the progress bar when exec twine upload #231

Open
wants to merge 3 commits into
base: unstable/v1
Choose a base branch
from

Conversation

shenxianpeng
Copy link

Closes #229. I looked at twine's help and added a new input no-color for this action.

twine --help
usage: twine [-h] [--version] [--no-color] {check,upload,register}

positional arguments:
  {check,upload,register}

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --no-color            disable colored output

@webknjaz
Copy link
Member

The CI doesn't test this case, which is necessary to ensure this keeps working over time. Also, it might make sense to just do this unconditionally.

@webknjaz
Copy link
Member

So let's see if the output is good enough to avoid exposing another API toggle to the end-users.

@shenxianpeng
Copy link
Author

shenxianpeng commented Apr 22, 2024

Also, it might make sense to just do this unconditionally.

OK. I'll leave it on by default, this time could be as a test.

@webknjaz
Copy link
Member

The CI run is now approved, let's see..

@webknjaz
Copy link
Member

Looks like the lockfile needs updating.

@shenxianpeng
Copy link
Author

I retried the option --no-color from my local, the right command should be twine --no-color upload dist/* not twine upload --no-color dist/*, I hope I can adjust --no-color before upload.

@shenxianpeng
Copy link
Author

I have moved the position of --no-color before upload when no-color=true. could you approve to run CI again? thank you.

@webknjaz
Copy link
Member

webknjaz commented Apr 22, 2024

Sure. Though, I'm not sure anymore if disabling color altogether is good. I'd rather disable progress bars but not the colorizarion. Perhaps, the Twine upstream needs to be consulted..

@shenxianpeng
Copy link
Author

I have tested the following commands to upload to testpypi, and both work with Python 3.11. and Python 3.12.

twine --no-color upload dist/* --repository testpypi
twine upload dist/* --repository testpypi
root@eca5ed1e5006:/src# twine --no-color upload dist/* --repository testpypi
Uploading distributions to https://test.pypi.org/legacy/
WARNING  Error getting password from keyring
         Traceback (most recent call last):
           File "/usr/local/lib/python3.12/site-packages/twine/auth.py", line 81, in get_password_from_keyring
             return cast(str, keyring.get_password(system, username))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           File "/usr/local/lib/python3.12/site-packages/keyring/core.py", line 56, in get_password
             return get_keyring().get_password(service_name, username)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           File "/usr/local/lib/python3.12/site-packages/keyring/backends/fail.py", line 28, in get_password
             raise NoKeyringError(msg)
         keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the
         keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
Enter your API token:
Uploading clang_tools-0.11.1.post1.dev5-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.9/19.9 kB • 00:00 • 19.3 MB/s
Uploading clang_tools-0.11.1.post1.dev5.tar.gz
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.1/79.1 kB • 00:00 • 171.3 MB/s

View at:
https://test.pypi.org/project/clang-tools/0.11.1.post1.dev5/
root@eca5ed1e5006:/src# python3 -V
Python 3.12.3
root@eca5ed1e5006:/src#

I'll try again soon to find the cause.

@webknjaz
Copy link
Member

I still think that it's best to get Twine to implement something like --no-animation instead and keep the color on.

@shenxianpeng
Copy link
Author

Thanks for the hint. twine upload supports --disable-progress-bar, which I hadn't realized before. this should be what you need.

@shenxianpeng shenxianpeng changed the title Add input no-color to support disabling colored output Add input disable-progress-bar to disable the progress bar Apr 25, 2024
@shenxianpeng
Copy link
Author

pre-commit.ci works in my local environment. 🤔

~/r/s/gh-action-pypi-publish (feature/support-no-color)> pre-commit run --all-files
Add trailing commas.......................................................Passed
isort.....................................................................Passed
Tabs remover..............................................................Passed
Validate GitHub Actions...................................................Passed
Validate GitHub Workflows.................................................Passed
Check GitHub Workflows set timeout-minutes................................Passed
Validate ReadTheDocs Config...........................(no files to check)Skipped
fix end of files..........................................................Passed
trim trailing whitespace..................................................Passed
mixed line ending.........................................................Passed
python tests naming...................................(no files to check)Skipped
check for added large files...............................................Passed
check BOM - deprecated: use fix-byte-order-marker.........................Passed
check for case conflicts..................................................Passed
check that executables have shebangs......................................Passed
check for merge conflicts.................................................Passed
check json............................................(no files to check)Skipped
check for broken symlinks.............................(no files to check)Skipped
check yaml................................................................Passed
detect private key........................................................Passed
check python ast..........................................................Passed
debug statements (python).................................................Passed
codespell.................................................................Passed
yamllint..................................................................Passed
flake8 WPS-excluded.......................................................Passed
flake8 WPS-only...........................................................Passed
pylint....................................................................Passed
Verify that enforced flake8 version stays unchanged.......................Passed

@webknjaz
Copy link
Member

pre-commit.ci works in my local environment. 🤔

pre-commit.ci upgraded their runtime to Python 3.12 yesterday which is incompatible with some linting configuration present. I'll address that separately.

twine-upload.sh Outdated Show resolved Hide resolved
@shenxianpeng shenxianpeng changed the title Add input disable-progress-bar to disable the progress bar Disable the progress bar when exec twine upload Apr 25, 2024
@shenxianpeng
Copy link
Author

pre-commit.ci upgraded their runtime to Python 3.12 yesterday which is incompatible with some linting configuration present. I'll address that separately.

Maybe can use default_language_version to pin the runtime version to the previous version. for example:

default_language_version:
    python: python3.11

@webknjaz
Copy link
Member

That's what I used elsewhere. But it's not something that's in the scope of this PR so let's keep it atomic.

@shenxianpeng
Copy link
Author

Yes. I rebased my commits and it's ready to run CI and your review.

twine-upload.sh Outdated Show resolved Hide resolved
twine-upload.sh Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

option to disable twine progressbar
2 participants