-
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
Cannot install Monorepo deps without sourcecode for Dockerfile caching #9682
Comments
having something similar in latest aswell. originally the version was |
@georgettica can you try without this line?
Locking requires a metadata build for path dependencies, and this in turn requires the source of the package. |
I think you meant to tag me but I'll try it out! if I want to install my deps per the lockfile, is there an alternative to doing that? @abn |
Oops, yes. I am guessing you want some form of layer caching here. You can sort of achieve that, the issue you are hitting is that for installing an editable package, Poetry needs to build wheel metadata. This could change in the future. Here is a made-up example of working around this issue. /tmp/foo$ tree .
.
├── bar
│ ├── bar
│ │ └── __init__.py
│ ├── poetry.lock
│ ├── pyproject.toml
│ └── README.md
├── Containerfile
├── foo
│ └── __init__.py
├── poetry.lock
├── pyproject.toml
└── README.md
4 directories, 9 files FROM docker.io/python:3.13
RUN python -m pip install --root-user-action=ignore -q poetry
RUN install -d foo
RUN install -d foo/bar
COPY pyproject.toml poetry.lock foo/.
COPY bar/pyproject.toml bar/poetry.lock bar/README.md foo/bar/.
COPY bar/bar/__init__.py foo/bar/bar/.
WORKDIR foo
RUN poetry install --no-root Note the addition of |
thanks @abn one more thing, would it be possible to have only a global/root-level |
Anything you manage and distribute independently should have its own packages = [
{ include = "package", from="src" },
{ include = "lib_a", from="services/lib_a/src"}
] And define all metadata in your root A while ago, I created #2270. No progress has been officially been made yet. You can check out the plugin a user mentioned there (not affiliated with the Poetry Team). |
Description
Hi all,
I'm having difficulty setting up a proper Dockerfile for a service in a monorepo that doesn't require the source code for the services and libraries included in the monorepo.
The monorepo has a shared
venv
. There is a rootpyproject.toml
and a few packages/libraries and services nested, each with their ownpyproject.toml
.My root
pyproject.toml
looks like this:and my service will depend on a library as such:
I'm trying to optimize my Dockerbuild so that I don't have to rebuild it everytime I have some source changes. Here's what I'd like to do:
My understanding is that
--no-root --no-directory
will allow me to install my service's deps, includingmy-library
, without needing the source code. This way, I can utilize Docker layers so I don't have to rebuild when I have source code changes.However, I keep getting this error, and I'm unsure of how to fix it - could I get some guidance?
If I copy the sources over before running
poetry install
, I don't have the issue - but I can't utilize Docker layering.Thank you guys very much!
PS - I'm also trying to use Docker's cache mount, but Poetry seems to ignore it per the Poetry Config. but that's for another day.
Workarounds
COPY the source for my library and service prior to
poetry install
- but this is undesired and slowPoetry Installation Method
pipx
Operating System
Debian
Poetry Version
Poetry 1.5.1
Poetry Configuration
The text was updated successfully, but these errors were encountered: