python-poetry / python-poetry/poetry
Install Extras to markers with required baseline installation?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
Description
I'm not sure if this is a bug report or a feature request.
I found the excellent PR "Pass Install Extras to Markers" https://github.com/python-poetry/poetry/pull/9553
I tried the same idea, but that the default (no extra) installation would install the package.
What I want:
poetry install -> install requests lib with no extras
poetry install -E requests_abc -> install requests lib with "abc" extra.
I tried this snippet:
[tool.poetry.dependencies]
python = "^3.10"
requests = [
{ markers = "extra != 'requests_abc'", version = "8.1.2"},
{ markers = "extra == 'requests_abc'", version = "8.1.2", extras=["abc"] }
]
[tool.poetry.extras]
requests_abc = ["requests"]
But when I install poetry without any extra, I don't get the requests package at all. In poetry.lock file, I see that the package has optional=true. What am I doing wrong, or is this a bug or an unsupported feature?
Workarounds
None that I know of
Poetry Installation Method
pipx
Operating System
Mac OSX
Poetry Version
2.1.2
Poetry Configuration
cache-dir = "/Users/noamgat/Library/Caches/pypoetry"
data-dir = "/Users/noamgat/Library/Application Support/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python" # /Users/noamgat/Library/Application Support/pypoetry/python
repositories.repo.url = "https:///"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/noamgat/Library/Caches/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
Python Sysconfig
sysconfig.log
Paste the output of 'python -m sysconfig', over this line.
Example pyproject.toml
Poetry Runtime Logs
poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the dependency declaration from the issue in a pyproject.toml and compare poetry install with poetry install -E requests_abc, then inspect the resulting poetry.lock entry. Done means the default installation includes requests while the named extra also enables its abc extra, or the behavior is documented as unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100