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

Add custom pypirc support #434

Merged
merged 15 commits into from
Sep 29, 2021
Merged

Conversation

davidrft
Copy link
Contributor

@davidrft davidrft commented Aug 16, 2021

This PR adds support for handling a custom path for the .pypirc file. Previously the file was assumed to always be in ~/.pypirc, which can be an issue depending on the build environment that is being used as stated in #426.

The path can be passed through the --pypirc argument, as such:

flit publish --pypirc .pypirc

A unit test was added to ensure the parsing is correctly done when the custom path is specified.

Copy link
Member

@takluyver takluyver left a comment

Choose a reason for hiding this comment

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

Thanks - this is mostly OK, but needs a few adjustments.

doc/cmdline.rst Outdated Show resolved Hide resolved
flit/upload.py Show resolved Hide resolved
flit/upload.py Outdated Show resolved Hide resolved
flit/upload.py Outdated Show resolved Hide resolved
flit/upload.py Outdated Show resolved Hide resolved
flit/__init__.py Outdated Show resolved Hide resolved
This patch removes the default value from the pypirc argument so None
can be used as a sentinel value. In case the provided value does not
exist an error is raised. Otherwise, if no value is provided "~/.pypirc"
is used as default.
tests/test_upload.py Outdated Show resolved Hide resolved
doc/history.rst Outdated Show resolved Hide resolved
temp_file.close()
yield temp_file.name
finally:
os.unlink(temp_file.name)
Copy link
Member

Choose a reason for hiding this comment

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

Pytest has a handy shortcut for this - if you use a tmp_path fixture in a test, it creates a temporary directory, you can write whatever you want there, and it will all be cleaned up when the test runs. Docs here

I'm happy with this, the fixture is just a neat thing to know about. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Good to learn about that :)

@takluyver
Copy link
Member

Thanks!

@takluyver takluyver merged commit 9335bfb into pypa:master Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support alternativ location for .pypirc (for Azure Devops Pipelines)
2 participants