-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Selecting dependency source doesn't work for transitive dependencies #2610
Comments
Any comments? |
Since pypi seems to be an option as index poetry will first look on this index. You need to set a private index as general source: https://python-poetry.org/docs/repositories/#using-a-private-repository And you can disable pypi: https://python-poetry.org/docs/repositories/#disabling-the-pypi-repository |
After much searching, this appears to be the closest issue to what I am seeing, also. Using custom repo sources, when trying to grab transitive deps, Basically, the following:
We have multiple custom repositories defined: a default and a secondary; when we go to install a package after explicitly including its source as |
Transitive dependencies are not associated with a source constraint right now by design, as far as I am aware. If you want to control them you must specify them as top-level dependencies, just like if you wanted to explicitly control their version. Thanks for bringing attention to this as we're revisiting some of the semantics of custom sources recently -- @dimbleby @radoering I'd love to hear what both of you think regarding this being desirable/if it's practical to teach the solver to make |
😅 Woof, yeah, OK maybe time to look into doing something different in the meantime while that hopefully gets worked out; I assume that's work that's centered around the discussion at #5984? I wasn't sure if that work would also implictly cover the transitive dep part, since if using something like say that " |
Not directly related/covered, but worth talking about at the same time. Stewing on this a little, honestly I don't think there's much we can do. If we make This also mirrors the existing semantics: "If you care about versions (for wheels), constraints, or source, it's now a top-level dep even if you don't directly import it -- top level deps represent deps you care about and not importable code" |
In our use case, this is required to happen for reasons, so I would be fine with that behavior (and prefer/desire it). Consider the Remote+Local=>Virtual Artifactory PyPi usecase; If I have a project that depends on an internally published package that has numpy as a dep, the numpy transitive dep would have already been grabbed+cached; By using the same top level virtual source in the I can see why others wouldn't want to have to mirror the entire world, but just throwing out there, in case others would might +1 the usecase where all of their packages have to come from non-external repositories anyhow. |
Remote+Local Artifactory is certainly a use case, but not the norm -- most users are using small indexes with a subset of packages available to supplement PyPI. I don't think we can force everyone over to your proposed new behavior for that reason. Likewise, adding a knob and supporting both seems a bit fraught. I suppose that if we tried to implement such a feature, we might introduce a new I do wonder, if you're using a Virtual repository, why you can't just set
Besides my concerns about the Artifactory workflow being hardly universal, I don't see how this is the case. I think most users would find it more unexpected if |
I'm not sure I follow this, isn't that what I have already above? This would only seem to work if we didn't also use any additional ... which IIUC, we have to do because using the same URL for both fetching+publishing doesn't seem to work when using ... as you said though, the "just use the one custom default source" was what I was considering moving to as a "solution" as it's probably the fastest way to desired behavior, and then just stuffing the custom publishing source in where needed right before publication time (but after build); just was hoping to be able to keep it in there along with the |
I think I'm starting to understand what's going on here -- you don't want to put a publishing target into See https://python-poetry.org/docs/repositories/#publishable-repositories. I do believe your existing use case is well-handled by a single source with FWIW, including less redacted URLs would have made it easier to figure out what was going on, but I think we got there. If there is any spot in the documentation that you think misled you to believe publishing targets were specified like package indexes, please let us know or submit a PR clarifying. |
Ah, I see; don't know how I missed this🤦 Reading through though, makes sense.
Yep, agree! And apologies, that's my bad for not pointing out that it was a convoluted setup for the same Artif source just trying to use it differently Thank you! |
I'd be happy enough to close this as wontfix
Of course the goal is not "the same as pip", but as a rough level-set for what's typical...
|
I think I am going to go ahead and close this as wontfix for now -- it's not impossible to be added ever, but given Poetry's current codebase and established semantics this would be a deeply surprising change. If a use case that can't be met with Poetry's regular semantics materializes (plus after existing plans to refactor sources are completed), we could revisit at a later date. |
We do have every transitive dependency in our private repo, or at least that's the goal. No PyPi is allowed in the CI pipeline, but for local development PyPi is also used. Specifying each transitive dependency as top-level is not a viable option. This project looks really promising and I've been reading the docs all week, but to no avail. Do you have any suggestions how can this process be achieved with Poetry? |
Any thoughts about this @neersighted ? I'd like to be able to specify two sources, with private repo as default, but I don't want Poetry to silently pull packages from pypi, so I have to declare it as explicit. But then this issue happens, the explicit source does not apply to transitive dependencies... not sure if I'm missing something. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option). N/AIssue
TLDR: Specifying individual dependencies source using the
source field
(see #908) is ignored for transitive dependencies. This greatly limits its usefulness and exposes users to supply chain attacks.I have three private repos
numpy
,lib
andapp
(I know I it would be unwise to call my packagenumpy
, this is to illustrate the problem).lib
depends onnumpy
andapp
depends onlib
. They all live in acme corps private pypi repository athttp://my-pypi/simple/
.I have set up my-pypi as the primary source in pyproject.toml for
lib
andapp
.To make sure thay my
numpy
is used bylib
, its pyproject.toml includes this line:This works fine. When I install lib using
poetry install
my privatenumpy
package is installed as a dependency.app
depends onlib
,app
's pyproject.toml includes this line:Now, when I run "poetry install" for
app
, the public PyPI version ofnumpy
is installed!Is this expected and/or intended? As a user, I would expect app to use my private
numpy
in this case. If that isn't the case, it should be clearly specified in the documentation. The current behavior exposes users to supply chain attacks which they might expect to avoid using thesource
field.In fact, the
source
field isn't documented anywhere although it is has been in poetry since v1.0.0. I found it described here: #908.I believe this is may be a similar issue to #1356 but it concerns pure poetry workflows so I don't think it is a duplicate.
lib
's pyproject.tomlapp
's pyproject.tomlThe text was updated successfully, but these errors were encountered: