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

Improve handling of missing config file #770

Merged
merged 5 commits into from Jul 3, 2021

Conversation

bhrutledge
Copy link
Contributor

Fixes #564

There's a lot here, but my hope is that it makes things clearer for users and contributors. I tried to organize the commits so that they could be reviewed individually; for example, the change that addresses @angerson's suggestion in #564 (comment) is fd51ed1.

New output:

% twine upload --config-file /path/to/missing/file --repository undefined-repository dist/* 
InvalidConfiguration: [Errno 2] No such file or directory: '/path/to/missing/file'

% twine upload --config-file /path/to/missing/file dist/*
InvalidConfiguration: [Errno 2] No such file or directory: '/path/to/missing/file'

% twine upload --repository undefined-repository dist/*                      
InvalidConfiguration: Missing 'undefined-repository' section from ~/.pypirc.
More info: https://packaging.python.org/specifications/pypirc/ 

The second example is new behavior. Currently, Twine silently ignores the missing file, and returns a default configuration for PyPI and TestPyPI. However, if a user takes the time to specify --config-file on the command line, and the file doesn't exist, that feels like it should be an error. These changes include a special case to continue to provide a default configuration if --config-file isn't used.

@bhrutledge bhrutledge added this to In progress in Helpful errors via automation Jun 29, 2021
@bhrutledge
Copy link
Contributor Author

@pypa/twine-maintainers Friendly nudge for some feedback. 😅

@bhrutledge bhrutledge merged commit b4a196e into pypa:main Jul 3, 2021
Helpful errors automation moved this from In progress to Done Jul 3, 2021
@bhrutledge bhrutledge mentioned this pull request Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Confusing error messages with missing config file
3 participants