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

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

Merged
merged 5 commits into from Jul 30, 2021

Conversation

Darsstar
Copy link
Contributor

@Darsstar Darsstar commented May 22, 2021

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
Copy link

di commented May 25, 2021

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

@caseydialpad
Copy link

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
Copy link

caseydialpad commented Jun 1, 2021

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.
@sonarcloud
Copy link

sonarcloud bot commented Jun 7, 2021

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
Copy link

Algirdyz commented Jul 1, 2021

Could this be bumped and looked into?

@Kreshu
Copy link

Kreshu commented Jul 4, 2021

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

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
Copy link

vilenc3 commented Jul 8, 2021

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

@matthias-baetens
Copy link

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

@brucearctor
Copy link

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

@marcellovictorino
Copy link

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

@piotrgredowski
Copy link

piotrgredowski commented Jul 22, 2021

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

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
Copy link

lynochka commented Nov 8, 2021

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
Copy link

piotrgredowski commented Nov 8, 2021

@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
Copy link

jgentil commented Nov 18, 2021

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

@MadJlzz
Copy link

MadJlzz commented Dec 29, 2021

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
Copy link

MadJlzz commented Feb 15, 2022

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!

Copy link

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