Install dependencies from a local directory containing archives
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
Like “pip”, poetry should allow applications to install dependencies from a local directory containing archives. This would enable developers to compile Python wheels in the first stage of a Docker multi-stage build then depend on only the compiled archives in another stage. If you’re interested, please see my blog post outlining the reasons for this workflow.
The following configuration option could work but it’s just a starting suggestion:
[[tool.poetry.source]]
name = "local-files"
path = "instance" # I'm the relevant option :)
[[tool.poetry.source]]
name = 'default'
url = 'https://pypi.org/'
[tool.poetry.dependencies]
python = "3.7"
requests = "^2.20.0"
uwsgi = "^2.0.17"
In the above example, projects could defer to the main package index if no correctly-formatted wheels / archives are found in an instance folder (in this case, relative to pyproject.toml).
See below for a sample Dockerfile (using pip for now, hopefully poetry in the future):
###########################################
# Throwaway image with C compiler installed
FROM python:3.6-alpine as bigimage
# install the C compiler
RUN apk add --no-cache linux-headers g++
# instead of installing, create a wheel
RUN pip wheel --wheel-dir=/root/wheels uwsgi==2.0.17.1
###########################################
# Image WITHOUT C compiler but WITH uWSGI
FROM python:3.6-alpine as smallimage
COPY --from=bigimage /root/wheels /root/wheels
# Ignore the Python package index
# and look for archives in
# /root/wheels directory
RUN pip install \
--no-index \
--find-links=/root/wheels \
"uwsgi>=2.0.17.1"
Thanks again for all the work on this tool; Poetry looks like an amazing project and I look forward to being able to use it as a daily driver.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:37
- Comments:12
Top GitHub Comments
I have exactly the same issue 😲
This is still a relevant issue - It would be nice to have that feature. On big projects, when there are a lot of local packages installing via path and relative paths is disaster.
Example: ├── package a │ ├── src │ ├──── pyproject.toml ├── package b │ ├── src │ ├──── pyproject.toml
let’s say that package b has dependency on package a, the following pyproject need to be given:
This is just getting awful when discussing on much bigger projects.
more niter behavior would be:
and a link to the local package would be given as same as given by the pip --find-links “<PACKAGE_A_PATH>”