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

Tweak upload --verbose suggestion #817

Merged
merged 2 commits into from
Oct 8, 2021

Conversation

bhrutledge
Copy link
Contributor

Building on #807, for #805. This seems a little clearer, and is no longer tied to the response text (because --verbose will also print useful debugging messages about credentials, etc.).

Uploading distributions to https://test.pypi.org/legacy/
Enter your username: 
Enter your password: 
Uploading twine-3.4.2.dev12+g6694f57.d20210619-py3-none-any.whl
100%|██████████| 41.7k/41.7k [00:00<00:00, 140kB/s] 
Error during upload. Retry with the --verbose option for more details.
HTTPError: 403 Forbidden from https://test.pypi.org/legacy/
Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information.

Copy link
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking suggestion in-line

if not verbose:
logger.warning(
"Error during upload. "
"Retry with the --verbose option for more details."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thought I just had:

We have access to the CLI args, right? Could we print out the command with --verbose injected so they can copy paste it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat idea. I'll take a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking something as simple as:

>>> import itertools
>>> argv = ["twine", "upload", "--skip-progress-bar", "dist/*"]
>>> ' '.join(itertools.chain(argv[:2], ["--verbose"], argv[2:]))
'twine upload --verbose --skip-progress-bar dist/*'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's not that simple. Running twine upload -r testpypi dist/* with pdb gives me:

(Pdb) sys.argv
['/Users/bhrutledge/Dev/twine/venv/bin/twine', 'upload', '-r', 'testpypi', 'dist/twine-3.4.2.dev12+g6694f57.d20210619-py3-none-any.whl', 'dist/twine-3.4.2.dev12+g6694f57.d20210619.tar.gz']

I think showing that to users will be confusing, so I'm going to merge this as-is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, we will only see dist/* if run from tox or Windows. I don't think users will generally be confused about globs being expanded by their shell as that's how it works

Copy link
Contributor Author

@bhrutledge bhrutledge Oct 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure all/most new users understand shell globbing, and dist/* could potentially expand to lots of files. That, combined with the absolute path of twine, makes for a long string to copy and paste, and also obscures the addition of --verbose.

@bhrutledge bhrutledge merged commit 040a62c into pypa:main Oct 8, 2021
@bhrutledge bhrutledge deleted the 805-verbose-message branch October 8, 2021 09:57
mergify bot pushed a commit to andrewbolster/bolster that referenced this pull request Nov 3, 2021
Bumps [twine](https://github.com/pypa/twine) from 3.4.2 to 3.5.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/pypa/twine/blob/main/docs/changelog.rst">twine's changelog</a>.</em></p>
<blockquote>
<h2>Twine 3.5.0 (2021-11-02)</h2>
<p>Features
^^^^^^^^</p>
<ul>
<li>Show more helpful messages for invalid passwords. (<code>[#815](pypa/twine#815) &lt;https://github.com/pypa/twine/issues/815&gt;</code>_)</li>
<li>Allow the <code>--skip-existing</code> option to work with GCP Artifact Registry. (<code>[#823](pypa/twine#823) &lt;https://github.com/pypa/twine/issues/823&gt;</code>_)</li>
</ul>
<p>Bugfixes
^^^^^^^^</p>
<ul>
<li>Add a helpful error message when an upload fails due to missing a trailing
slash in the URL. (<code>[#812](pypa/twine#812) &lt;https://github.com/pypa/twine/issues/812&gt;</code>_)</li>
<li>Generalize <code>--verbose</code> suggestion when an upload fails. (<code>[#817](pypa/twine#817) &lt;https://github.com/pypa/twine/issues/817&gt;</code>_)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/pypa/twine/commit/7deea5833918cdb8496587119900e8a3cde57dfc"><code>7deea58</code></a> Update changelog for 3.5.0 (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/824">#824</a>)</li>
<li><a href="https://github.com/pypa/twine/commit/f0fc7e8824fe9a93e817c5a7bc1d73f3c9af3ad1"><code>f0fc7e8</code></a> Reorder installation in .readthedocs.yaml (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/825">#825</a>)</li>
<li><a href="https://github.com/pypa/twine/commit/ee97836671f4a494d6b7f7dec21d237a84320e1d"><code>ee97836</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/twine/issues/823">#823</a> from zware/skip-existing_on_gcp</li>
<li><a href="https://github.com/pypa/twine/commit/34cfed4aac708a9bcb4de04e3fccf619bdadb6c2"><code>34cfed4</code></a> Support --skip-existing with GCP Artifact Registry</li>
<li><a href="https://github.com/pypa/twine/commit/658037f05898b4dc96113628153aa2691b0dbfa3"><code>658037f</code></a> Add intersphinx links for <code>requests</code> (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/819">#819</a>)</li>
<li><a href="https://github.com/pypa/twine/commit/9d26a5f2ec7f176cdad8dea21a4e17d97c962d82"><code>9d26a5f</code></a> Show more helpful messages for invalid  passwords (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/815">#815</a>)</li>
<li><a href="https://github.com/pypa/twine/commit/040a62c749e0015724d93e82ea37bb7e826fef00"><code>040a62c</code></a> Tweak upload --verbose suggestion (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/817">#817</a>)</li>
<li><a href="https://github.com/pypa/twine/commit/28d8571f7e2f908890649f33624fa3bfed7294e1"><code>28d8571</code></a> Add auto-generated API documention (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/810">#810</a>)</li>
<li><a href="https://github.com/pypa/twine/commit/3be41f65176a4ee4909b3307d3705f670dfb0330"><code>3be41f6</code></a> Adding missing docstrings to <code>twine/commands</code> (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/799">#799</a>)</li>
<li><a href="https://github.com/pypa/twine/commit/cf5e0fd7c87d5b1b609c25c59f3ec0d09dc54316"><code>cf5e0fd</code></a> Add a section about proxy support (<a href="https://github-redirect.dependabot.com/pypa/twine/issues/814">#814</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/pypa/twine/compare/3.4.2...3.5.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=twine&package-manager=pip&previous-version=3.4.2&new-version=3.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
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.

2 participants