python-poetry / python-poetry/poetry

Installing only packages from certain sources to optimize docker builds

Open
#7,499 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

I'm using poetry for a very large python project which include a lot of internal and external packages.
We build a lot of containers and in the build stage we install the packages using poetry install.
Every time we change our code of internal packages we have to rebuild the container from 0 which takes a lot of time.
We would like to optimize it by copying only the pyproject.toml and poetry.lock files and install the external python packages only for the first stage to have it cache for the next builds.

Similar to how multistage builds work are recommended in npm projects, see example of the multistage builds:
https://cloudnweb.dev/2019/10/crafting-multi-stage-builds-with-docker-in-node-js/

In order to do that we need the ability to specify to install only the external packages (pypi, git etc..) from the lock file without require the internal packages code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the poetry install workflow and how pyproject.toml and poetry.lock are used during container builds. Determine how an installation can use only external packages from the lock file without requiring internal package code; done means a documented or testable installation path supports this caching workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
build-system, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.