Skip to content

Improve handling of missing config file#770

Merged
bhrutledge merged 5 commits intopypa:mainfrom
bhrutledge:564-config-file
Jul 3, 2021
Merged

Improve handling of missing config file#770
bhrutledge merged 5 commits intopypa:mainfrom
bhrutledge:564-config-file

Conversation

@bhrutledge
Copy link
Copy Markdown
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
Copy link
Copy Markdown
Contributor Author

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

@bhrutledge bhrutledge merged commit b4a196e into pypa:main 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

None yet

Development

Successfully merging this pull request may close these issues.

Confusing error messages with missing config file

3 participants