Alternative package sources and the source
property of individual dependencies
#4137
Replies: 2 comments 1 reply
-
Thanks, @ggabriel96 for your research! I was confused by the docs too. Maybe you can anwer my question related to private repos.
will poetry install dependencies from private repo or public? My usecase is disabling private repo during development because it's slow: #4113 |
Beta Was this translation helpful? Give feedback.
-
This is a persistent issue that has, I think, more than a few parts to it. I'm going to bump this thread because I think it's maybe the most relevant/best researched of those I've seen (thanks @ggabriel96 ). I think there are a bunch of separate issues that might be helped by treating them altogether I haven't been all the way through the code, but I think the root of this is that there need to be more conditions considered when a
[tool.poetry.dependencies]
package = [
{version="^1.0.0", markers="machine==armvl7", source="piwheels"},
{version="^1.0.0", markers="machine!=armvl7", source="pypi"}
] I think this is related to this too: #5150
Some Initial Ideas of How to Fix
In the meantime, it seems like, since url-based dependencies are treated differently in several places, it seems like doing that rather than using the repository fixes a lot of issues, eg. #4659 and #4439 and I got started on one hacky part of the solution here (preserving filenames and hashes that can be used in the pip install stage): Anyway yes just trying to focus some work so we can pull a PR together!!! Looking for direction on how best to tackle this problem. |
Beta Was this translation helpful? Give feedback.
-
Hi there!
The PR #908 improved the support for alternative package indexes. However, AFAIK, not everything is currently documented. In particular, I could not find docs about the feature of specifying a
source
for specific dependencies. It is also not very clear to me what happens when a project has multiple repositories configured.IIUC, from the docs:
default
attribute of a repository totrue
will disable PyPIsecondary
attribute of a repository totrue
will keep PyPI as the main repositoryHowever, what does precendence over PyPI mean? As explained briefly in the warning in item 10 here, doing something like this:
has some problems:
So, when simply adding a repository
repo
without settingdefault
orsecondary
(or having both befalse
), is it possible for a package to have a better match in PyPI than inrepo
and get installed from there? And when I specifically set thesource
of a package to berepo
, will PyPI ever be considered? And ifrepo
is marked as secondary?Having these questions answered, I volunteer to update the documentation.
By the way, much love for Poetry ❤️
Edit 1: apparently, the
source
option for a dependency makes it the only source that will be considered:https://github.com/python-poetry/poetry/blob/1.1/poetry/json/schemas/poetry-schema.json#L269-L272
Is that correct?
Edit 2: so I've searched through Poetry tests and found some answers. IIUC:
Questions remain, though:
Edit 3: just found this PR: #3400. So only Poetry's behavior is left to be better explained.
Beta Was this translation helpful? Give feedback.
All reactions