<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nixos/nixpkgs.git/pkgs/development/interpreters/python/catch_conflicts, branch master</title>
<subtitle>Nix Packages collection</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/'/>
<entry>
<title>treewide: fix typos</title>
<updated>2026-01-13T19:45:11+00:00</updated>
<author>
<name>Ben Siraphob</name>
<email>bensiraphob@gmail.com</email>
</author>
<published>2026-01-13T19:45:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=c7e10647eadb53b7cf3552a53e8bb33c8248c8c3'/>
<id>c7e10647eadb53b7cf3552a53e8bb33c8248c8c3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>pythonCatchConflictsHook: split propagated-build-inputs on runs of whitespace</title>
<updated>2024-04-27T01:05:42+00:00</updated>
<author>
<name>Ben Wolsieffer</name>
<email>benwolsieffer@gmail.com</email>
</author>
<published>2024-04-20T19:28:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=f9de72f24776538e7e2243f54ab46f3e3a921ab5'/>
<id>f9de72f24776538e7e2243f54ab46f3e3a921ab5</id>
<content type='text'>
Currently, nix-support/propagated-build-inputs is parsed by splitting on
a single space. This means that if this file contains multiple spaces
separating two paths, the build_inputs list will end up containing an
empty string.

Instead, call split() with no arguments, which splits on runs of
whitespace and also ignores whitespace at the beginning and end of the
string, eliminating the need for strip().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, nix-support/propagated-build-inputs is parsed by splitting on
a single space. This means that if this file contains multiple spaces
separating two paths, the build_inputs list will end up containing an
empty string.

Instead, call split() with no arguments, which splits on runs of
whitespace and also ignores whitespace at the beginning and end of the
string, eliminating the need for strip().
</pre>
</div>
</content>
</entry>
<entry>
<title>pythonCatchConflictsHook: cleanup due to visiting each path once</title>
<updated>2024-04-27T01:05:42+00:00</updated>
<author>
<name>Ben Wolsieffer</name>
<email>benwolsieffer@gmail.com</email>
</author>
<published>2024-04-20T19:16:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=7f14d675a7e1e2bdef3c9c1b6f83c42474715e51'/>
<id>7f14d675a7e1e2bdef3c9c1b6f83c42474715e51</id>
<content type='text'>
Now that we only visit each path once, a few things can be simplified.
We no longer have to keep a list of different dependency chains leading
to a package, since only one chain will ever be found. Also, the already
visited check also takes care of cycles, so the other cycle check can be
removed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we only visit each path once, a few things can be simplified.
We no longer have to keep a list of different dependency chains leading
to a package, since only one chain will ever be found. Also, the already
visited check also takes care of cycles, so the other cycle check can be
removed.
</pre>
</div>
</content>
</entry>
<entry>
<title>pythonCatchConflictsHook: prevent exponential worst-case</title>
<updated>2024-04-27T01:05:42+00:00</updated>
<author>
<name>Ben Wolsieffer</name>
<email>benwolsieffer@gmail.com</email>
</author>
<published>2024-04-20T18:47:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=a25e43e6d7089d4655f945c9874bd6756fbb5c90'/>
<id>a25e43e6d7089d4655f945c9874bd6756fbb5c90</id>
<content type='text'>
The hook performs a depth first search on the graph defined by
propagatedBuildInputs. This traverses all paths through the graph,
except for any cycles. In the worst case with a highly connected graph,
this search can take exponential time. In practice, this means that in
cases with long dependency chains and multiple packages depending on the
same package, the hook can take several hours to run.

Avoid this problem by keeping track of already visited paths and only
visiting each path once. This makes the search complete in linear time.

The visible effect of this change is that, if a conflict is found, only
one dependency chain that leads to the conflicting package is printed,
rather than all the possible dependency chains.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The hook performs a depth first search on the graph defined by
propagatedBuildInputs. This traverses all paths through the graph,
except for any cycles. In the worst case with a highly connected graph,
this search can take exponential time. In practice, this means that in
cases with long dependency chains and multiple packages depending on the
same package, the hook can take several hours to run.

Avoid this problem by keeping track of already visited paths and only
visiting each path once. This makes the search complete in linear time.

The visible effect of this change is that, if a conflict is found, only
one dependency chain that leads to the conflicting package is printed,
rather than all the possible dependency chains.
</pre>
</div>
</content>
</entry>
<entry>
<title>pythonCatchConflictsHook: avoid infinite recursion</title>
<updated>2024-02-25T10:54:07+00:00</updated>
<author>
<name>Yarny0</name>
<email>41838844+Yarny0@users.noreply.github.com</email>
</author>
<published>2024-02-22T19:29:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=e5d73251660f231dd15a14993d4042d9dc082c78'/>
<id>e5d73251660f231dd15a14993d4042d9dc082c78</id>
<content type='text'>
Albeit counter-intutive, the `propagatedBuildInputs`
mechanism and the corresponding package files in
`nix-support/propagated-build-inputs`
can form a dependency cycle.
This can happen if a package adds itself to this file,
or if multiple outputs of one derivation reference each other.

An example for this is the `patchPpdFilesHook`:
In its mission to collect dependency packages with binaries
that might be required by the dependent package to be created,
it sometimes picks up the dependent package itself.
This indicates that if a file of the dependent package
is used, the package itself should also be installed.
In the case of a multiple output package,
it is also possible that two outputs depend on each other,
creating a dependency cycle.

Since commit 2651ddc7b0788932df9da7416ccd1618d76c11fe,
the `find_packages` function in `catch_conflicts.py`
recursively collects all `propagated-build-inputs` files.
If it encounters a dependency cycle, it must not follow the
cycle to avoid infinite recursion (and a stack overflow).

The commit at hand adds a check so that the function skips over
a package that it already encountered and processed earlier.
This does not loosen the script's checks as the script
still recursively collects all propagated build inputs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Albeit counter-intutive, the `propagatedBuildInputs`
mechanism and the corresponding package files in
`nix-support/propagated-build-inputs`
can form a dependency cycle.
This can happen if a package adds itself to this file,
or if multiple outputs of one derivation reference each other.

An example for this is the `patchPpdFilesHook`:
In its mission to collect dependency packages with binaries
that might be required by the dependent package to be created,
it sometimes picks up the dependent package itself.
This indicates that if a file of the dependent package
is used, the package itself should also be installed.
In the case of a multiple output package,
it is also possible that two outputs depend on each other,
creating a dependency cycle.

Since commit 2651ddc7b0788932df9da7416ccd1618d76c11fe,
the `find_packages` function in `catch_conflicts.py`
recursively collects all `propagated-build-inputs` files.
If it encounters a dependency cycle, it must not follow the
cycle to avoid infinite recursion (and a stack overflow).

The commit at hand adds a check so that the function skips over
a package that it already encountered and processed earlier.
This does not loosen the script's checks as the script
still recursively collects all propagated build inputs.
</pre>
</div>
</content>
</entry>
<entry>
<title>pythonCatchConflictsHook: make compatible to all python 3 versions</title>
<updated>2024-02-13T04:15:41+00:00</updated>
<author>
<name>DavHau</name>
<email>hsngrmpf+github@gmail.com</email>
</author>
<published>2024-02-11T14:10:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=ffa815958e61aa978c715eb6e279c290617a6615'/>
<id>ffa815958e61aa978c715eb6e279c290617a6615</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>pythonCatchConflictsHook: improve and add tests</title>
<updated>2024-02-13T04:15:41+00:00</updated>
<author>
<name>DavHau</name>
<email>hsngrmpf+github@gmail.com</email>
</author>
<published>2024-02-10T11:27:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=0cbd114d41b619aa611ab158528f551b14b8cd9c'/>
<id>0cbd114d41b619aa611ab158528f551b14b8cd9c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>python/catch_conflicts: scan $out, not sys.path</title>
<updated>2024-02-12T12:52:28+00:00</updated>
<author>
<name>phaer</name>
<email>hello@phaer.org</email>
</author>
<published>2024-01-26T17:24:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=2651ddc7b0788932df9da7416ccd1618d76c11fe'/>
<id>2651ddc7b0788932df9da7416ccd1618d76c11fe</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>python/hooks: restore catchConflictHook for python&lt;3.10</title>
<updated>2023-11-18T11:57:18+00:00</updated>
<author>
<name>Martin Weinelt</name>
<email>hexa@darmstadt.ccc.de</email>
</author>
<published>2023-11-15T13:44:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=f292ef4958bf9e1de18c62a315ed09f95954473a'/>
<id>f292ef4958bf9e1de18c62a315ed09f95954473a</id>
<content type='text'>
By restoring and diverting to the old version.

Previously the newer language features and use of more modern stdlib
imports broke the hook on Python&lt;3.10.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By restoring and diverting to the old version.

Previously the newer language features and use of more modern stdlib
imports broke the hook on Python&lt;3.10.
</pre>
</div>
</content>
</entry>
<entry>
<title>buildPythonPackage: port catch-conflicts to importlib.metadata</title>
<updated>2023-10-30T11:42:36+00:00</updated>
<author>
<name>Martin Weinelt</name>
<email>hexa@darmstadt.ccc.de</email>
</author>
<published>2023-10-21T13:52:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=646c23a2f7711690cce032233be54dcb1a037965'/>
<id>646c23a2f7711690cce032233be54dcb1a037965</id>
<content type='text'>
To escape the pkg_resources API deprecation:

&gt; catch-conflicts.py:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

Also remove exceptions for the previus bootstrap packages.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To escape the pkg_resources API deprecation:

&gt; catch-conflicts.py:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

Also remove exceptions for the previus bootstrap packages.
</pre>
</div>
</content>
</entry>
</feed>
