-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Multiple pypi.url #1310
Comments
Hi, did you read https://pdm.fming.dev/latest/pyproject/tool-pdm/#specify-other-sources-for-finding-packages? Does that work for you? |
What I don't like about this solution is the fact I don't want to reveal any internal server names in my To cut a long story short, I think setting multiple pypi mirrors in pdm's config makes much more sense. It's a private configuration, so the details shouldn't be put into a publicy available file. |
I agree. I'm lucky enough to have a virtual repository that maps to several others, so I can just set one pypi url, but if that wasn't the case I'd be asking for the same thing. Setting the repositories in pyproject.toml is not an acceptable workaround in my case, and it's actually one of the reason I moved away from Poetry and tried PDM 😄 |
@andreas-vester As you said the mirror URLs are private settings, so all packages are supposed to be able to install if others don't have such private settings. Is that right? |
Well yes, this is right. However, my private settings (i.e. server names) are of no use to other users. Besides, I don't want to reveal any internal names in When using A better/other solution could be to have dedicated
What do you think? |
I agree that there is scenario for multiple private index sources, but I am struggling with how to make the UX better. The above proposal doesn't look good to me.
No, PDM no longer uses |
OK, agreeing on putting the settings outside the I'm not an expert, but another possibility (other than Let's say you have a
You could identify the relevant variables with the prefix Just a very first suggestion... |
@andreas-vester One option might be to:
...this shifts responsibility from pdm to your development environment, and you can safely store the fake domain in version control. It even allows you to define different sources in development and production (if you want). If you're working on a team, you might want to provide everyone with a script that does the job. |
Since PDM was previously reading pip's config, why not supporting the same kind of settings: a main index and a list of extra ones? Or, since all indexes are checked anyway, support setting Single index pdm config pypi.url https://singleindex [pypi]
url = "https://singleindex" Multiple indexes pdm config pypi.url https://index1 https://index2 [pypi]
url = [
"https://index1",
"https://index2",
] |
I've read all the proposals but none is satisfying. @andreas-vester introduced @lofidevops offers a workaround to solve the described problem at present. @pawamoy Your proposal looks almost good but remember we also support Although I admit the usefulness of this feature, I can't come up with a good UI to read and write the settings. More ideas are welcome. UPDATE: based on @pawamoy 's proposal, maybe we can deprecate the |
Ah, indeed, I didn't think about other related settings. Supporting multiple indexes would then require a more drastic change I guess, something like: [pypi.private-server-1]
url = "https://index1"
verify_ssl = true
[pypi.private-server-2]
url = "https://index2"
verify_ssl = false |
i also have the case where this would be needed, eagerly awaiting a solution. |
Same here, for projects using pypi + a company private repository. |
Please be noted this feature only applies to those projects that can be installed successfully even if other people change the local PyPI URL(private config). That is to say, if your project depends on some packages that are only available on a private index, making the source not interchangeable, just use the |
@lofidevops I don't want to put any internal (or fake) server names in Or did I miss your point?? |
I think it is clear that if you use some libraries that are exclusively available to you (via a private repo), that publishing this project and expect others to be able to successfully clone it is not possible. However, my issue is that we use a pypi mirror in our company. That is, I am looking for a way to define all dependencies in |
@pawamoy I found your blog entry somewhat-modern-python-development, where you mentioned the following: Then I learned about PDM. It had all the good things Poetry had, and it removed the previously mentioned pain points, namely: it was able to read pip's configuration. It made using private indexes so easy: setup pip's index-url and trusted-host and you're done. Your own configuration does not contaminate other users through pyproject.toml (note: PDM 2.0 doesn't read pip's configuration anymore, but you can still configure your index outside of pyproject.toml). The very last sentence drew my particular attention and I am wondering what you exactly mean? How you do configure your index outside |
@andreas-vester PDM currently allows to set exactly one URL for the default PyPI-like index to use: |
@andreas-vester Chances are you may also share the project with someone inside your company, or deploy it to another machine, right? If you depend on a private library but don't specify the source in |
Currently, PDM supports two kinds of package sources:
The local source can be overridden by the shared source with One should notice that multiple local sources will make the situation complicated and I haven't figured out a clean way to make them coexist.
|
@andreas-vester You didn't miss my point, I was assuming only private team members had access to your repo. So my proposal doesn't fit your use-case. Sorry about that! But it looks like the subsequent comments are zeroing in a solution. Good luck! |
Our organisation would really appreciate this feature, since we have a build server which needs to talk to multiple private repos which requires authentication (so we can't store user/pass in the pyproject.toml).
With regards to the above would it be possible to have some sort of hierarchy to derive the list and order of sources? |
If it is the only concern you can use environment variables |
I have a similar need, but mainly with authentication and not with server names. The problem with environment variables I have is that while it works great in CI, when installing locally it requires meddling with your shell configuration and it's not very portable (the variable names may conflict for different users and repos). Ideally I'd like to have user-wide config #1310 (comment) where I can store the auth part or have the source urls in pyproject but make auth work with a keyring (like artifacts-keyring) and also with env variables or in the worst case enable dotenv support for installs.
I'd guess that if someone wants to disable the default index then it's because the shared source config is self contained, and the local config will not be taken into account, however the way it's configured may not make much sense now. Maybe add an item under
Do similar thing to what
The config may support both |
Wow, great work @frostming! |
@frostming This is just awesome! THANK YOU! It now allows me to use our internal pypi indexes and corresponding credentials while not being forced to put them into This feature enables me to make the move to In my view, this is a unique selling point and one of the major differences compared to
|
Hey, read the whole conversation, love the feature. But still didn't understood how to store the username/password/credentials outside of the PS: I Love pdm |
Found the solution I wanted looking in the docs. This is my solution to the config for future viewers of this issue.
$PDM_CONFIG/config.toml
|
Is your feature request related to a problem? Please describe.
I need to define multiple pypi mirrors. As far as I understand it, using
pdm.config pypi.url
, I can set ONE mirror.Describe the solution you'd like
There should be a way to define multiple pypi mirrors.
Alternatively, when adding a package, there should be a parameter available that specifies the mirror that will be used to look for the package.
The text was updated successfully, but these errors were encountered: