python-poetry / python-poetry/poetry-plugin-bundle

Bundle command doesn't respect Python constraint

Open
#104 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
151
Forks
30
Avg merge
48m
Merged PRs (30d)
5

Description

The bundle command doesn't respect the Python version constraint of the project. You can specify an interpreter with the --python option that isn't supported by the project.

Reproduction:

❯ poetry new .
❯ grep python pyproject.toml
python = "^3.12"
❯ /usr/bin/python3 -V
Python 3.9.6
❯ poetry bundle venv -p /usr/bin/python3 .venv
❯ .venv/bin/python -V
Python 3.9.6
❯ grep Requires-Python .venv/lib/python3.9/site-packages/repro-0.1.0.dist-info/METADATA
Requires-Python: >=3.12,<4.0

Expected behavior:

The bundle command fails with an error similar to this:

The specified Python interpreter (3.9.19) is not supported by the project (^3.12).

Actual behavior:

The bundle command creates the environment with an interpreter that doesn't satisfy the Python constraint of the project.

Environment:

  • poetry-plugin-bundle 1.3.0
  • Poetry 1.8.3
  • macOS

Contributor guide

No contributing guide indexed for this repository

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 by reproducing the poetry bundle venv command with --python and the project’s python = "^3.12" constraint. Trace the bundle command’s interpreter-selection entry point and check how the constraint is evaluated. Done means an unsupported interpreter is rejected with an error, while a supported interpreter still creates the environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.