Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass Install Extras to Markers #9553

Merged
merged 43 commits into from
Nov 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
301b288
add breaking unit test for conflicting pytorch cpu/cuda extras
reesehyde Jul 14, 2024
b018d44
support project extras in markers: populate 'extras' marker including…
reesehyde Jul 12, 2024
e1adc53
add locking test
reesehyde Jul 14, 2024
ce435c7
fix default when active root extras not passed
reesehyde Jul 14, 2024
84999c1
add unit tests for #834
reesehyde Jul 14, 2024
4ae7b5f
consolidate tests
reesehyde Jul 15, 2024
bc1202c
add documentation
reesehyde Jul 15, 2024
fc05bf7
fix types
reesehyde Jul 15, 2024
eeb990f
fix formatting
reesehyde Jul 15, 2024
a0fcab7
simplify exclusive extras example
reesehyde Jul 15, 2024
63b2798
run ruff formatter
reesehyde Jul 15, 2024
7a5a3c9
fix key not in dict format
reesehyde Jul 15, 2024
c1fe267
fix pre-commit and full run
reesehyde Jul 15, 2024
2659365
add markers assert and remove unnecessary check
reesehyde Oct 11, 2024
36fd729
add test for root extras
reesehyde Oct 11, 2024
7646ed0
add broken tests for conflicting dependency extras
reesehyde Oct 11, 2024
ad85d88
pr feedback: remove unneeded non-root case and fix tests
reesehyde Nov 13, 2024
3a23622
fix extra name type in unit test
reesehyde Nov 14, 2024
00649a0
better breaking test for conflicting dependencies in root and transie…
reesehyde Nov 14, 2024
1326833
add overrides for different-extra duplicates to fix conflicting trans…
reesehyde Nov 14, 2024
449a2f0
test cleanup: improve docstrings and make extra specs harder to solve
reesehyde Nov 14, 2024
84482a2
remove redundant test
reesehyde Nov 14, 2024
4e097a9
update issue links in unit tests
reesehyde Nov 14, 2024
73cf6cd
apply pre-commit hooks
reesehyde Nov 14, 2024
3811ab5
pre-commit
radoering Nov 16, 2024
b446675
fix logic for adding overrides for different-extra duplicates
radoering Nov 16, 2024
33eed99
pr feedback: remove redundant filtering and test fixture, improve sol…
reesehyde Nov 18, 2024
aea0e43
Merge remote-tracking branch 'origin/main' into extra-markers
reesehyde Nov 18, 2024
f4de278
run pre-commit
reesehyde Nov 18, 2024
8efb89d
update test fixtures for new locker features :)
reesehyde Nov 18, 2024
2070521
fix test: don't validate installation order
reesehyde Nov 18, 2024
3573403
remove redundant filtering completely
radoering Nov 22, 2024
5ad4419
fix link, improve wording
radoering Nov 22, 2024
9624a36
avoid redundant uninstalls of extras
radoering Nov 23, 2024
96c19ce
fix dependency resolution for extra dependencies without explicit ext…
radoering Nov 23, 2024
cfdf903
`tool.poetry.extras` will be deprecated in the next version -> update…
radoering Nov 23, 2024
e3a87bf
temp: use poetry-core with fix for dependency merging (see examples f…
radoering Nov 23, 2024
6696453
fix typing
radoering Nov 23, 2024
738ebff
Merge branch 'main' into extra-markers
radoering Nov 23, 2024
004ffbe
Merge branch 'main' into extra-markers
radoering Nov 29, 2024
a6980a3
use poetry-core from main branch again (after fix has been merged)
radoering Nov 29, 2024
8b36cbd
update examples and add warning
radoering Nov 29, 2024
cc566ea
Merge branch 'main' into extra-markers
radoering Nov 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add markers assert and remove unnecessary check
  • Loading branch information
reesehyde committed Nov 13, 2024
commit 2659365749e31781c6a70576ce9d8c4f22b48544
14 changes: 6 additions & 8 deletions src/poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def _is_relevant_marker(
get_python_constraint_from_marker(marker)
)
and (active_extras is None or marker.validate({"extra": active_extras}))
and (not self._env or marker.validate(self._marker_values(active_extras)))
and (not self._env or marker.validate(self._env.marker_env))
)

def _resolve_overlapping_markers(
Expand Down Expand Up @@ -979,14 +979,12 @@ def _marker_values(
self, extras: Collection[NormalizedName] | None = None
) -> dict[str, Any]:
"""
Marker values, per:
1. marker_env of `self._env`
2. 'extras' will be added to the 'extra' marker if not already present
Marker values, from `self._env` if present plus the supplied extras

:param extras: the values to add to the 'extra' marker value
"""
result = self._env.marker_env.copy() if self._env is not None else {}
if extras is not None:
if "extra" not in result:
result["extra"] = set(extras)
else:
result["extra"] = set(result["extra"]).union(extras)
assert "extra" not in result, "'extra' marker key is already present in environment"
result["extra"] = set(extras)
return result