I think this question has been skimmed in other issues, but not dealt with explicitly.
What is the official way to source dependencies both from the public PyPI _and_ from a private repository? I have:
[[tool.poetry.source]]
name = "pypi_"
url = "https://pypi.org/simple/"
[[tool.poetry.source]]
name = "private"
url = "https://pypi.private.com/simple/"
and it seems to work, but is there are "more official" way to say that I use the official PyPI but if a package is missing there, it should be looked up on "private"? Like pip install --index-url official_pypi --extra-index-url private ...?
Ugh. Just updated to from 0.12.5 to 0.12.6 and now get
> poetry update
Updating dependencies
Resolving dependencies... (10.2s)
[KeyError]
'summary'
update [--no-dev] [--dry-run] [--lock] [--] [<packages>]...
The error goes away when I remove
[[tool.poetry.source]]
name = "pypi_"
url = "https://pypi.org/simple/"
Edit: Fixed by installing poetry git master.
Ugh! Specifying the official PyPI is messing with dependency resolution. Try poetry update with the following pyproject.toml:
[tool.poetry]
name = "testpoetry"
version = "0.1.0"
description = ""
authors = ["..."]
[tool.poetry.dependencies]
python = "^3.6"
defcon = "^0.6"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
Now poetry update again with the following file:
[tool.poetry]
name = "testpoetry"
version = "0.1.0"
description = ""
authors = ["..."]
[tool.poetry.dependencies]
python = "^3.6"
defcon = "^0.6"
[tool.poetry.dev-dependencies]
[[tool.poetry.source]]
name = "pypi_"
url = "https://pypi.org/simple/"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
The first file will pull in the packages fs, pytz and appdirs. The second will remove them again! This breaks defcon.
@madig Did you work around this?
Yes, with the last snippet on my last comment. This messes with dependency resolving unfortunately, i.e. optional dependencies specified by [] in your dependencies might not get picked up.
Please also support extra-index-url from command line (not _pyproject.toml_ file).
One use case is that, we need to use peotry install in an Alpine-based Docker container, where musl lib C is used in placed of glibc.
The wheel file built for glibc is not always compatible with musl, so we setup a separate repo for musl-based packages. This repo is only used inside Docker container, to run unit test. For production deployment, we use normal glibc environment, that's why we cannot add this "index URL" to _pyproject.toml_ file (or pip will mistakenly download package from it).
If poetry supports extra-index-url parameter, we just need to modify the installer command in Docker container and things will work well.
Official docs as well require http auth poetry config http-basic, but my private repo is read-only for me.
I need one package from it, how can I achieve it? Something like this wiould be cool (same as pip -i):
packagename = 1.0 {repo=myprivaterepo.com}
@sdispater sorry to poke you, but can you provide some insight into this?
The problem as I see it is that we need a precedence order for source repositories, with the capability to override the order per-dependency.
I uploaded my own package to Test PyPI that transitively depends on lazy-object-proxy (through conan, but it is also depended on by the very popular pylint package). All of the latest versions of lazy-object-proxy uploaded to Test PyPI are pre-release versions (1.4.2.dev{1,2,3}). You can reproduce this problem yourself by adding the Test PyPI source to pyproject.toml and calling poetry add lazy-object-proxy. Poetry uses pip to deduce that the latest version available is 1.4.2, but refuses to install one of the pre-release versions without the --allow-prereleases flag. I just want it to use non-Test PyPI for all dependencies except my package.
Related issues:
If I update to Poetry 1.0.0a3, then I get this error trying to install lazy-object-proxy with the Test PyPI source in my pyproject.toml:
# in an empty directory
$ python --version
Python 3.7.1
$ poetry --version
Poetry version 1.0.0a3
$ poetry init
...
$ cat >>pyproject.toml <<EOS
[[tool.poetry.source]]
name = "test-pypi"
url = "https://test.pypi.org/simple"
EOS
$ poetry add lazy-object-proxy
Creating virtualenv $venv in $PWD/.venv
Using version ^1.4 for lazy-object-proxy
Updating dependencies
Resolving dependencies... (0.2s)
Writing lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing lazy-object-proxy (1.4.2)
[AttributeError]
'Pool' object has no attribute 'default'
@thejohnfreeman See #1163 which seems to be caused by https://github.com/sdispater/poetry/commit/694bef2db03e10adbf29b2cc3e5d3c409e48faa3
Did you have any luck with this? Causing a big issue with my packaging at the moment. Poetry passes -i my-pypi.example.org to pip as well as --extra-index-url pypi.example.org which means none of
my package's dependencies can be resolved. This was in 0.12.17 and 1.0.0b2.
I'm seeing the same issue I believe with 0.12.17 - basically if I specify a source, it no longer can seem to find any packages from the public repository, and fails on updates.
There has been a lot of improvement in private indices management (see #908).
This is available in the latest beta release.
It werks! Thanks for working on this to everyone involved 馃槂
If anyone comes across this later: here are the docs for controlling package repos. (permalink in the repo if they move)
Hrm, I have to take my last post back. If I use a private repository and list a package from there as a dependency, transient dependencies such as toml for isort[pyproject] get purged on poetry update. I'll have to see if I can replicate this with test.pypi.org.
Most helpful comment
Please also support
extra-index-urlfrom command line (not _pyproject.toml_ file).One use case is that, we need to use
peotry installin an Alpine-based Docker container, wheremusllib C is used in placed ofglibc.The wheel file built for
glibcis not always compatible withmusl, so we setup a separate repo formusl-based packages. This repo is only used inside Docker container, to run unit test. For production deployment, we use normalglibcenvironment, that's why we cannot add this "index URL" to _pyproject.toml_ file (orpipwill mistakenly download package from it).If
poetrysupportsextra-index-urlparameter, we just need to modify the installer command in Docker container and things will work well.