Skip to content

Added pip style keyring password lookup as a fallback.#4086

Merged
sdispater merged 5 commits into
python-poetry:masterfrom
Darsstar:pip-style-keyring-fallback
Jul 30, 2021
Merged

Added pip style keyring password lookup as a fallback.#4086
sdispater merged 5 commits into
python-poetry:masterfrom
Darsstar:pip-style-keyring-fallback

Conversation

@Darsstar

@Darsstar Darsstar commented May 22, 2021

Copy link
Copy Markdown
Contributor

This way Poetry gives keyring backends like Microsoft's artifacts-keyring or Google's keyrings.google-artifactregistry-auth a chance to retrieve the credentials. Since Microsoft's Azure DevOps Personal Access Tokens will expire after some time the artifacts-keyring implementation will generate a new one for you to counteract that.

By "pip style" I mean keyring requests based on the repository url instead of poetry config paths.

Tested by modifing installation/authenticator.py on my Poetry 1.2.0a1 installation.

Pull Request Check List

Resolves: #3344

  • Added tests for changed code.
  • Updated documentation for changed code.

This way Poetry gives keyring backends like Microsoft's `artifacts-keyring` or Google's `keyrings.google-artifactregistry-auth` a change to retrieve the credentials.
Since Microsoft Azure DevOps Personal Access Tokens will expire after some time the `artifacts-keyring` implementation will generate a new one for you to counteract that.
@Darsstar Darsstar force-pushed the pip-style-keyring-fallback branch from e47c737 to 6d28c56 Compare May 22, 2021 20:41
@di

di commented May 25, 2021

Copy link
Copy Markdown

I tested this branch against Google Artifact Registry and can confirm that it works as expected. Thanks for contributing this!

@caseydialpad

Copy link
Copy Markdown

I can also confirm this PR works for Google Cloud. I notice that poetry publish -r <repository> is not working with this mechanism. I am attempting to diagnose currently.

@caseydialpad

caseydialpad commented Jun 1, 2021

Copy link
Copy Markdown

I updated poetry publish to add pip style keyring authentication based on this PR. I have made a PR to your change at Darsstar#1. I am open to suggestions about how to improve it.

Update: By no means do I think my PR at Darsstar#1 should hold up this PR. I can make a new PR here if necessary.

The latest changes have resolved publishing (poetry publish -r <url>). I have tested them in Google Cloud.

…wordManager so that Publisher can use Authenticator instead of PasswordManager.

- Authenticator and its tests got moved into utils.
- No longer retrieve "repositories.{name}.url" in two steps ("repositories.{name}", then "url") since that does not allow us to use environment variable POETRY_REPOSITORIES_{name}_URL.
@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2021

Copy link
Copy Markdown

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 6 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Algirdyz

Algirdyz commented Jul 1, 2021

Copy link
Copy Markdown

Could this be bumped and looked into?

@bart-oncode

Copy link
Copy Markdown

Nice job! I was just going to start implementation of this on my own, as I'm facing the issue with GCP's Artifact Registry keyring.
When aprox can we expect this fix to be available in release?

@mjagielka

Copy link
Copy Markdown

Do we have any release date for this fix? We need it to properly work with GCP Artifact Registry too.

@finswimmer finswimmer requested a review from a team July 5, 2021 09:13
@vilenc3

vilenc3 commented Jul 8, 2021

Copy link
Copy Markdown

Hello! Any chance we can escalate this? We need this in ASAP. Cheers!

@matthias-baetens

Copy link
Copy Markdown

From our side there is also keen interest in using this!

@brucearctor

Copy link
Copy Markdown

Poetry Maintainers/Owners (@abn @sdispater @finswimmer @stephsamson ) -- anything I can be doing to help this issue along?

@marcellovictorino

Copy link
Copy Markdown

I am also quite interested in this feature. Any updates on the release date?

@piotrgredowski

piotrgredowski commented Jul 22, 2021

Copy link
Copy Markdown

I am also waiting with projects to migrate them from classic pip to poetry because we can't get packages from Azure Feeds with PAT using poetry. This PR will give us that chance.
Looking forward for somebody to review it! :)

@Bharathkumarraju

Copy link
Copy Markdown

I am waiting for it too to use poetry with gcp artifactory regitry PyPi repo

@sdispater sdispater merged commit 3a1b45f into python-poetry:master Jul 30, 2021
@Darsstar Darsstar deleted the pip-style-keyring-fallback branch July 30, 2021 18:08
@sdispater sdispater mentioned this pull request Jul 31, 2021
@lynochka

lynochka commented Nov 8, 2021

Copy link
Copy Markdown

Sorry, the readme in the changed files do not provide sufficient guidance. I don't know how to follow 'It will need to be properly installed into Poetry's virtualenv, preferrably by installing a plugin.', since I don't understand which plugin we are talking about. Do you think you could help with an improved readme?

@piotrgredowski

piotrgredowski commented Nov 8, 2021

Copy link
Copy Markdown

@lynochka to be honest I don't know what does this sentence in docs/repositories.md mean.
But - If you want to install packages from private registry, use Poetry 1.2.0a2. It handles that because of implementation of this PR.
To install newest prerelease version of poetry run:

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --preview

@jgentil

jgentil commented Nov 18, 2021

Copy link
Copy Markdown

I'm still having this issue with 1.2.0a2. I even embed the credentials in the URL and it ignores them.

@MadJlzz

MadJlzz commented Dec 29, 2021

Copy link
Copy Markdown

Is it possible to add this feature in version 1.1 of poetry?

robin92 pushed a commit to robin92/poetry that referenced this pull request Feb 15, 2022
…-fallback

Added pip style keyring password lookup as a fallback.
robin92 pushed a commit to robin92/poetry that referenced this pull request Feb 15, 2022
…-fallback

Added pip style keyring password lookup as a fallback.
@robin92 robin92 mentioned this pull request Feb 15, 2022
2 tasks
robin92 pushed a commit to robin92/poetry that referenced this pull request Feb 15, 2022
…-fallback

Added pip style keyring password lookup as a fallback.
robin92 pushed a commit to robin92/poetry that referenced this pull request Feb 15, 2022
…-fallback

Added pip style keyring password lookup as a fallback.
robin92 pushed a commit to robin92/poetry that referenced this pull request Feb 15, 2022
…-fallback

Added pip style keyring password lookup as a fallback.
robin92 pushed a commit to robin92/poetry that referenced this pull request Feb 15, 2022
…-fallback

Added pip style keyring password lookup as a fallback.
@MadJlzz

MadJlzz commented Feb 15, 2022

Copy link
Copy Markdown

For people that cannot wait for this feature, here's some steps to use Google Artifact Registry with the keyring functionality:

GoogleCloudPlatform/artifact-registry-python-tools#17 (comment)

Hope this helps!

@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to install packages from Azure DevOps private repo, 401 unauthorized