-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[optimize] early-ignore dependencies not matching chosen markers #4956
base: main
Are you sure you want to change the base?
Changes from all commits
af6d945
85eb734
139c8e6
96236a6
a5fd267
aa184ec
3a7cd81
ed62836
e216b20
030d1bd
f63d6db
2a97e11
5212117
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,14 @@ def create_poetry( | |
if io is None: | ||
io = NullIO() | ||
|
||
# redirect to the extended schema (from poetry, not from poetry-core) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be updating the schema in poetry-core as well, even if the implementation is in poetry only. The intention is to drop all schemas from this repo. |
||
import os | ||
|
||
import poetry.core.json | ||
|
||
poetry.core.json.SCHEMA_DIR = os.path.join( | ||
os.path.dirname(__file__), "json/schemas/extended" | ||
) | ||
base_poetry = super().create_poetry(cwd) | ||
|
||
locker = Locker( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,8 @@ def __init__( | |
|
||
self._extras = [] | ||
|
||
self._match_markers = [] | ||
|
||
if executor is None: | ||
executor = Executor(self._env, self._pool, config, self._io) | ||
|
||
|
@@ -190,6 +192,11 @@ def extras(self, extras: list) -> "Installer": | |
|
||
return self | ||
|
||
def match_markers(self, markers: list) -> "Installer": | ||
self._match_markers = markers | ||
|
||
return self | ||
|
||
def use_executor(self, use_executor: bool = True) -> "Installer": | ||
self._use_executor = use_executor | ||
|
||
|
@@ -249,7 +256,21 @@ def _do_install(self, local_repo: Repository) -> int: | |
self._io, | ||
) | ||
|
||
ops = solver.solve(use_latest=self._whitelist).calculate_operations() | ||
if ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% on if this is the only way to get at the config, but this smells to me. I'm pretty sure you should be able to get at the |
||
hasattr(self._locker, "_local_config") | ||
and "target_env" in self._locker._local_config | ||
): | ||
# load and format as VirtualEnv from poetry.utils.env | ||
markers_to_filter = self._locker._local_config["target_env"] | ||
if markers_to_filter: | ||
version_info = markers_to_filter.get("version_info") | ||
if version_info: | ||
markers_to_filter["version_info"] = tuple(version_info) | ||
else: | ||
markers_to_filter = {} | ||
|
||
with solver.use_markers_filter(markers_to_filter): | ||
ops = solver.solve(use_latest=self._whitelist).calculate_operations() | ||
else: | ||
self._io.write_line("<info>Installing dependencies from lock file</>") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is dead and should be removed (given the move to using the pyproject.toml).