python-poetry / python-poetry/poetry

Dependency aliasing

Open
#1,715 5 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/solver kind/feature
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

  • Packages provide API namespaces
  • API namepsaces are mostly identified by the package name
  • A package name mostly resolves to a package source
  • Yet, there are valid exceptions to both norms:
    • A package should resolve to an alternate (local) source for dev (eg. python-poetry/semver dev branch to python-poetry/poetry dev branch)
    • A package namespace can be provided in different flavors by different packages (e.g. psycopg2 & psycopg2-binary)

Therefore, add [tool.poetry.dev-alternates] with exactly the same syntax as [tool.poetry.dependencies] yet with an optional aliases field on the dep object, to inform which production package's namespace is provided through this package during dev. If aliases is not specified, it shall be inferred by the dep name itself.

Example covering both cases:

[tool.poetry.dependencies]
python = "^3.7"
dodoo = "^2.0"
psycopg2 = "^2.8"

[tool.poetry.dev-alternates]
psycopg2-binary = {aliases = psycopg2, version = "^2.8"}
dodoo = {path = "../dodoo"}

Further considerations

toml file API
  • It could be considered to make this a sub-path of [tool.poetry.dev-dependencies], however I consider, flat rymes are part of poetry's rythm, so stick with the groove.
  • Making this a feature of [tool.poetry.dev-dependencies] itself might probably not be verbose / descriptive enough and decrease clarity and readability
Merge strategy

I should be precise in that, it shall be expected to do a true merge of the objects, so -- strictly -- psycopg2-binary = {aliases = psycopg2, version = "^2.8"} could be written as just psycopg2-binary = {aliases = psycopg2}

CLI UX

From a UX perspectve, maybe the install --develop=DEVELOP has almost a 90% overlap in semantics with the requested feature. It would be an acceptable modification to current behaviour, if:

  • install --develop=DEVELOP always uses the alternate dev dep -- if specified -- in addition to install said dep in development mode

This FR collects a few FR in the issue catalogue, please reference them as you see fit.

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

No files or tests are named. Start by tracing the install --develop=DEVELOP entry point and the existing dependency-table parsing and merge behavior. Done means supporting [tool.poetry.dev-alternates], aliases inference, true object merging, and the requested development-install behavior with tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.