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

Publish a repository using credentials from .pypirc #2170

Closed
lmmx opened this issue Aug 5, 2023 · 1 comment
Closed

Publish a repository using credentials from .pypirc #2170

lmmx opened this issue Aug 5, 2023 · 1 comment
Labels
⭐ enhancement Improvements for existing features

Comments

@lmmx
Copy link

lmmx commented Aug 5, 2023

I can't tell if this is supposed to be implemented already, namely because there's mention of a variable $(PYPIRC_PATH) in #2141:

  - script: |
      pdm publish --repository $(PYPIRC_PATH)
    displayName: 'Build package and publish'

I think though that it's intended to indicate a URL. I initially saw that and thought I was meant to supply ~/.pypirc (which is where twine gets my token from when I publish Python packages typically).

I dug into what actually goes on and ended up breakpointing at pdm/project/config.py(447)get_repository_config().

The .pypirc file looks like this:

[pypi]
  username = __token__
  password = pypi-XXXXXXXXX...

Can this be used to generate the repository URL with all the necessary config instead of requiring it be passed in? Or does this feature already exist somewhere I missed?

More simply (if the --repository flag is not the place for this), the feature request could also be phrased as "autodetect username and password from .pypirc when running pdm publish". In this case the solution was to just manually copy the username (__token__) and password from this file and supply them to --publish.

@lmmx lmmx added the ⭐ enhancement Improvements for existing features label Aug 5, 2023
@frostming
Copy link
Collaborator

The value of --repository can be either a upload URL or the name of a configured repository in pdm config. Yeah, PDM has its own config file and won't read .pypirc.

Read this section from the docs.

@frostming frostming closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

No branches or pull requests

2 participants