Skip to content

python/catch_conflicts: scan $out, not sys.path#284067

Closed
phaer wants to merge 1 commit intoNixOS:stagingfrom
phaer:python-catch-conflicts-hook
Closed

python/catch_conflicts: scan $out, not sys.path#284067
phaer wants to merge 1 commit intoNixOS:stagingfrom
phaer:python-catch-conflicts-hook

Conversation

@phaer
Copy link
Member

@phaer phaer commented Jan 26, 2024

Description of changes

This changes the non-legacy version of pythonCatchConflictsHook to recursively scan the output of the target derivation as well as its propagatedBuildInputs for duplicate dependencies.

Previously, we did scan sys.path but that did turn out to be problematic as it produced false positives i.e. when build-time dependencies of hooks - such as setuptools in pythonCatchConflictsHook itself - where mistakenly flagged as duplicates; even though the are not included in the outputs of the target dervation.

As all python runtime-dependencies are currently passed via propagatedBuildInputs in nixpkgs, scanning that plus site-packages seems sufficient to catch all conflicts that matter at runtime and less likely to produce false positives.


Status

DRAFT for discussion about a fix of #283695,
Please read the issue description for context.

Checked basic functionality on master, but needs further testing before I feel comfortable with a merge and the legacyHook in catch_conflicts_py2.py needs to be migrated as well, if it's still needed.

targets python-updates as quite a few rebuilds would be expected for hook change.


Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Jan 26, 2024
@phaer
Copy link
Member Author

phaer commented Jan 26, 2024

Not sure what to do about the ofborg-eval & check-by-name failures; the very same commit evaluates cleanly for me locally when i.e. running "nix build .#poetry-core". I wonder whats an efficent way to reproduce this locally? nixpkgs-review ofc :)

Issue seems to be independent of this change, can reproduce with on nix build .#python3.pkgs.aioconsole on python-updates. Probably going to close this and re-target staging?

This changes the non-legacy version of pythonCatchConflictsHook
to recursively scan the output of the target derivation  as well
as its propagatedBuildInputs for duplicate dependencies.

Previously, we did scan sys.path but did prove problematic as it
produced false positives i.e. when build-time dependencies of
hooks - such as setuptools in pythonCatchConflictsHook itself -
where mistakenly flagged as duplicates; even though the are
not included in the outputs of the target dervation.

As all python runtime-dependencies are currently passed via
propagatedBuildInputs in nixpkgs, scanning that plus
site-packages seems sufficient to catch all conflicts that
matter at runtime and less likely to produce false positives.

The legacyHook in catch_conflicts_py2.py needs to be migrated
as well, if it's still needed.
@phaer phaer force-pushed the python-catch-conflicts-hook branch from 3783f7d to a9861fa Compare January 26, 2024 18:06
@phaer phaer changed the base branch from python-updates to master January 30, 2024 11:51
@phaer phaer changed the base branch from master to staging January 30, 2024 11:51
@phaer
Copy link
Member Author

phaer commented Feb 14, 2024

has been merged as part of #287957

@phaer phaer closed this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant