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

Support for several pypi mirrors? #6

Open
lucharo opened this issue Dec 10, 2022 · 2 comments
Open

Support for several pypi mirrors? #6

lucharo opened this issue Dec 10, 2022 · 2 comments

Comments

@lucharo
Copy link

lucharo commented Dec 10, 2022

Hi,

First of all thanks for writing this plugin. I write packages in a corporate environment with no access to pypi and poetry was for my purpose unusable or at least quite annoying to use because of this lack of support of a global pypi url.

I happen to actually use several pypi mirrors for downloading packages in my environment. Does your plugin support having several mirrors configured and if so how would I set that up in the poetry config file?

@lucharo
Copy link
Author

lucharo commented Dec 10, 2022

I envision the config being similar to secondary source in the standard pyproject.toml.

[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
default = false
secondary = false

https://python-poetry.org/docs/repositories/#private-repository-example

@lucharo
Copy link
Author

lucharo commented Dec 10, 2022

The overall implementation I am thinking is that you could have the config file looking like the one below and even include credentials there:

[plugins]
[plugins.pypi_mirror.example_repo]
url = "https://example.org/repository/pypi-proxy/simple/"

[plugins.pypi_mirror.enterpise_repo_1]
url = "https://myenterprise.org/pypi/simple"
username = "me"
password = "s3cr3t"

[plugins.pypi_mirror.enterpise_repo_2]
url = "https://myenterprise.org/pypi-internal/simple"
username = "me"
password = "s3cr3t"

And then have that handled in your src/plugins.py:

pypi_mirror_url = pypi_mirror_url or poetry.config.get("plugins", {}).get(
"pypi_mirror", {}
).get("url")

I am not familiar on how to parse toml so I am going to try an open a PR implementing this, I might need help on the handling credentials side of things

lucharo added a commit to lucharo/poetry-pip-conf that referenced this issue Dec 10, 2022
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

No branches or pull requests

1 participant