Unify PEP 508 marker handling across all dependency sources (incl. PEP 723) and fix marker passing to pip
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start by reading parsing._parse_content, parsing._parse_requirement, parsing._parse_pep723, and pipmanager.install to trace how Requirement objects and install arguments are handled. Add coverage for markers from each dependency source, including a PEP 723 block, and verify that matching markers reach pip as one requirement argument without breaking editable dependencies.
Written by the indexing model from the issue text.
Description
Summary
PEP 508 environment markers (e.g. pkg==1.0; python_version < "3.6") are not handled consistently across fades' dependency-parsing paths, and the underlying install step mangles any requirement string that contains a marker. This needs a single shared fix once the relevant PRs land.
This issue tracks the follow-up work; I'll implement it in a separate PR after #452 (PEP 723) is merged.
Background
There are currently three places that turn requirement text into packaging.requirements.Requirement objects:
parsing._parse_content(inline# fadescomments)parsing._parse_requirement(manual-ddeps,-rrequirement files, docstrings)parsing._parse_pep723(the# /// scriptblock, introduced in #452)
Problems
1. Marker evaluation is not shared across paths
PR #446 ("Support environment markers") adds the marker-skip logic, but as a duplicated inline block in only two functions — _parse_content and _parse_requirement:
if repo == REPO_PYPI and hasattr(dependency, 'marker') and dependency.marker is not None:
if not dependency.marker.evaluate():
...
continue
The PEP 723 path (_parse_pep723, #452) builds requirements directly:
deps[REPO_PYPI] = [Requirement(dep) for dep in dependencies]
so it never goes through that logic. If both PRs merge as-is, a # /// script block such as:
# /// script
# dependencies = ["pysha3==1.0b1; python_version < '3.6'"]
# ///
would not be filtered, even though PEP 723 explicitly defines dependencies as PEP 508 strings (markers are legal and expected there).
2. Matching markers still break pip install
The marker fix only handles the False case (skip the dep). When a marker evaluates True, the Requirement still stringifies with the marker, and pipmanager.install does:
str_dep = str(dependency)
args = [self.pip_exe, "install"] + str_dep.split()
str_dep.split() (added for multiword -e deps) shreds pkg==1.0; python_version >= "3.6" on the spaces inside the marker into separate args, which breaks the install. This is unfixed in both #446 and #452.
Proposed approach
- Factor the marker-evaluation logic into a single shared helper (e.g. inside
parse_fade_requirement, or a small_keep_for_marker(dependency)used by all three call sites) instead of duplicating it — so_parse_pep723is covered too. - Fix
pipmanager.installso requirements containing a marker (spaces) are passed as a single argument rather than.split()-ing them, while preserving the-emultiword behavior. - Add tests for markers coming from each source, including a PEP 723 block.
Related
- #446 — Support environment markers (PEP 508) in requirements
- #452 — Add PEP 723 inline script metadata support
- #259 — original environment-markers report
To be implemented after #452 is merged.
- Dominant language
- Python
- Stars
- 223
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from PyAr/fades
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Proposal: support uv as an optional backend for venv creation & installsPossibly taken @gilgamezh claimed this 112 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 42/100
-
Revisit "nested virtualenvs" problemPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
PEP 723 supportPossibly taken @gilgamezh claimed this 114 days ago. Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
awslabs/visual-asset-management-system#414 ·
Maintainers usually reply within 1 day
-
bug v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/python-sdk#3670 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aicell-lab/bioengine#232 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
modelscope/evalscope#1836 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100