python-poetry / python-poetry/poetry

Two features for offline builds: show --toml/json and install --archive-dir

Open
#3,322 1 comment 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/show 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 documentation and believe that my question is not covered.

Feature Request

For various constrained build environments, like nix or some uses of docker etc… it's useful to outsource fetching dependencies to an external system, then complete builds in an "offline mode".

poetry is already pretty close to providing this, and it could be done with two features:

poetry show --format json

Currently poetry show describes which packages are needed in an environment in a pretty human-friendly format. I believe it computes this directly from poetry.lock with no network access, correct?

So adding an option like poetry show --format json (or toml) which includes the same information and the URL and hash of the dependencies would allow external build orchestration systems to fetch and cache those dependency archives appropriately.

It's currently possible to glean this info from poetry.lock, but there is a lot of specialized logic poetry provides especially in selecting the appropriate subset for the current platform / python interpreter.

poetry install [ --offline ] --archive-dir <DIR>

When this option is specified, rather than fetching dependency sources from the network, check this local directory first. If it's not present, fetch it from the network unless --offline is given, in which case exit with an error.

I expect something close to this might already exist if there's any caching of dependency sources across projects. However, the interface to the caching directory needs to be clean / well specified to satisfy this use case.

Motivation

These features would make it easy to build/install any poetry project on https://nixos.org (or any system using the nix package manager).

These features are often useful in other contexts such as when a large multi-language project includes a poetry project and needs to do in-repo vendoring, such as for example https://github.com/zcash/zcash which has it's own built-in "vendoring" for its build system, and thus cannot (yet) use poetry with its multiple python components.

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 show and poetry install command entry points, then trace how poetry.lock is read and how dependency archives are cached or fetched. Done means defining and implementing JSON/TOML output with URLs and hashes, plus archive-directory and offline behavior, with clear errors for missing local archives.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.