2131 Commits
Author SHA1 Message Date
Ben Wolsieffer a25e43e6d7 pythonCatchConflictsHook: prevent exponential worst-case
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.
2024-04-26 21:05:42 -04:00
Ben Wolsieffer 21833407b4 pythonCatchConflictsHook: add test for multiple dependency chains
Add a test where a conflicting package can be found at the end of
multiple dependency chains. This is far too simple an example to
demonstrate the ill effects of exponential time complexity, but does
serve to demonstrate how the error output changes when each path is only
visited once.
2024-04-26 21:05:41 -04:00
github-actions[bot]andGitHub 257e7bee59 Merge master into staging-next 2024-04-14 14:04:38 +00:00
Martin Weinelt 72502ca655 python313: 3.13.0a5 -> 3.13.0a6
https://docs.python.org/3.13/whatsnew/changelog.html#python-3-13-0-alpha-6
2024-04-12 00:27:07 +02:00
Sandro JäckelandJonathan Ringer b3b12c2d08 Revert "Fix venv creation in Python environments"
This commit reverts all python changes from 234bb31f61.
2024-04-11 08:26:39 -07:00
Sandro JäckelandJonathan Ringer 636edfdeb1 Revert "Unwrap python scripts when building an environment"
This reverts commit 96118850f3.
2024-04-11 08:26:39 -07:00
Martin WeineltandGitHub 9f67702776 Merge pull request #303057 from mweinelt/python-3.12.3_3.11.9
python312: 3.12.2 -> 3.12.3; python311: 3.11.8 -> 3.11.9
2024-04-11 09:15:22 +02:00
Martin Weinelt e05a3ec1ce cpython: disable failing passthru tests on darwin
````
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
                  [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip] [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest
virtualenv: error: argument dest: the destination . is not write-able at /nix/store
SystemExit: 2
````
2024-04-10 18:00:32 +02:00
Martin Weinelt 3546ac2240 python311: 3.11.8 -> 3.11.9
https://docs.python.org/release/3.11.9/whatsnew/changelog.html
2024-04-10 10:38:40 +02:00
Martin Weinelt e8eb0ced9f python312: 3.12.2 -> 3.12.3
https://docs.python.org/release/3.12.3/whatsnew/changelog.html
2024-04-10 10:38:39 +02:00
github-actions[bot]andGitHub 61006b247a Merge staging-next into staging 2024-03-31 06:01:45 +00:00
github-actions[bot]andGitHub 6b7b5776be Merge master into staging-next 2024-03-31 06:01:15 +00:00
Martin WeineltandGitHub 0c7078367b Merge pull request #291293 from danc86/no-pypi-yanked
update-python-libraries: ignore yanked releases on PyPI
2024-03-31 05:21:40 +02:00
github-actions[bot]andGitHub 49b966576c Merge staging-next into staging 2024-03-30 12:01:34 +00:00
github-actions[bot]andGitHub 48d06167c6 Merge master into staging-next 2024-03-30 12:01:06 +00:00
adisbladisandGitHub cfb98374f3 Merge pull request #293151 from adisbladis/mk-python-derivation-refactor
mk-python-derivation: Refactor
2024-03-30 20:23:38 +13:00
github-actions[bot]andGitHub bd2d42a4f8 Merge staging-next into staging 2024-03-26 06:01:43 +00:00
github-actions[bot]andGitHub 40938cc5ef Merge master into staging-next 2024-03-26 06:01:14 +00:00
OTABI TomoyaandGitHub da0502af11 Merge pull request #298085 from natsukium/cpython/update
python39: 3.9.18 -> 3.9.19; python310: 3.10.13 -> 3.10.14
2024-03-26 09:48:38 +09:00
Sergei TrofimovichandSandro Jäckel 187ac583a0 python/hooks/setuptools-build-hook.sh: use --parallel flag only for fresh setuptools
Without the change attempt to enable parallelist for `python2` packages
fails with unsupported `--parallel` flag for `setuptools`-based
packages:

    $ nix build --no-link -f. --arg config '{enableParallelBuildingByDefault = true;}' xdg-utils
    error: builder for '/nix/store/...-python2.7-setuptools-44.0.0.drv' failed with exit code 1;
       last 10 log lines:
       > no configure script, doing nothing
       > Running phase: buildPhase
       > Executing setuptoolsBuildPhase
       > usage: nix_run_setup [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       >    or: nix_run_setup --help [cmd1 cmd2 ...]
       >    or: nix_run_setup --help-commands
       >    or: nix_run_setup cmd --help
       >
       > error: option --parallel not recognized
2024-03-25 13:18:45 +01:00
Thomas Watson d521f03303 python3Packages.setuptoolsBuildHook: correct name
Make `name` attribute into the same format as every other hook (modulo
.sh).

Nothing else in nixpkgs appears to refer to the old name.
2024-03-24 19:21:58 -05:00
Thomas Watson 26ccdea3d7 python3Packages.setuptoolsBuildHook: delete broken setuptoolsShellHook
Broken since the switch to PyPA's build/installer in
6c85fff302.

The hook was always janky and maintainers appear to not want its current
implementation in-tree. No replacement is currently planned.

However, this leaves the path open for future replacements as a broken
hook will no longer be installed by default.
2024-03-24 19:21:55 -05:00
github-actions[bot]andGitHub 97f05fe383 Merge staging-next into staging 2024-03-23 12:01:37 +00:00
kirillrdyandGitHub b5c54289bb Merge pull request #296225 from oliviacrain/py39-docs-sphinx-fix
python39.doc: fix build with sphinx >= 5.3.0
2024-03-23 20:18:17 +11:00
natsukium ffdc76613b python310: 3.10.13 -> 3.10.14
https://docs.python.org/release/3.10.14/whatsnew/changelog.html
https://blog.python.org/2024/03/python-31014-3919-and-3819-is-now.html

fixes: CVE-2023-52425, CVE-2024-0450, CVE-2023-6597
2024-03-23 15:58:41 +09:00
natsukium f99f5b4409 python39: 3.9.18 -> 3.9.19
https://docs.python.org/release/3.9.19/whatsnew/changelog.html
https://blog.python.org/2024/03/python-31014-3919-and-3819-is-now.html

fixes: CVE-2023-52425, CVE-2024-0450, CVE-2023-6597
2024-03-23 15:58:40 +09:00
Martin WeineltandGitHub 7c63b00262 Merge pull request #298086 from mweinelt/python-runtime-deps-skip-empty-specifier
python3.pkgs.pythonRuntimeDepsCheckHook: skip empty specifiers
2024-03-22 18:56:07 +01:00
Martin Weinelt 2c68d6b029 python311Packages.packaging: 23.2 -> 24.0
https://github.com/pypa/packaging/blob/24.0/CHANGELOG.rst

The `requires_dist` field now defaults to `None`, if the package does
not specify any requirements.
2024-03-22 16:34:52 +01:00
Martin Weinelt bcd6e799e0 python3.pkgs.pythonRuntimeDepsCheckHook: skip empty specifiers
Prevent the hook from erroring out on missing specifiers, as reported for
`highspy`, which currently ships with a pre-release version, triggering
the following error message:

  - highspy not satisfied by version 1.7.1.dev1
2024-03-22 16:30:55 +01:00
Domen KožarandGitHub fb884172ab Merge pull request #297628 from cwp/python-env-venv
Fix venv creation in Python environments
2024-03-22 19:17:13 +07:00
github-actions[bot]andGitHub 8c5e10ca32 Merge staging-next into staging 2024-03-22 06:01:35 +00:00
Martin WeineltandGitHub ebde006977 Merge pull request #289190 from mweinelt/python-3.13.0a4
python313: 3.13.0a3 -> 3.13.0a5
2024-03-22 03:40:42 +01:00
Colin Putney 96118850f3 Unwrap python scripts when building an environment
When building a python environment's bin directory, we now detect
wrapped python scripts from installed packages, and generate unwrapped
copies with the environment's python executable as the interpreter.
2024-03-21 19:27:06 -06:00
Colin Putney 234bb31f61 Fix venv creation in Python environments
The way we build python environments is subtly broken. A python
environment should be semantically identical to a vanilla Python
installation in, say, /usr/local. The current implementation, however,
differs in two important ways. The first is that it's impossible to use
python packages from the environment in python virtual environments. The
second is that the nix-generated environment appears to be a venv, but
it's not.

This commit changes the way python environments are built:

  * When generating wrappers for python executables, we inherit argv[0]
    from the wrapper. This causes python to initialize its configuration
    in the environment with all the correct paths.
  * We remove the sitecustomize.py file from the base python package.
    This file was used tweak the python configuration after it was
    incorrectly initialized. That's no longer necessary.

The end result is that python environments no longer appear to be venvs,
and behave more like a vanilla python installation. In addition it's
possible to create a venv using an environment and use packages from
both the environment and the venv.
2024-03-21 19:26:57 -06:00
Olivia Crain b51c572c62 python39.doc: fix build with sphinx >= 5.3.0
Backport upstream fix for cpython issue 98366 from 3.10 tree
2024-03-20 10:28:16 -05:00
github-actions[bot]andGitHub 66eeab8faf Merge staging-next into staging 2024-03-19 06:01:43 +00:00
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00
SandroandGitHub 24fd994fc4 Merge pull request #295562 from SuperSandro2000/python27
python27: 2.7.18.7 -> 2.7.18.8
2024-03-17 08:53:14 +01:00
Sandro Jäckel 61baca011c python27: 2.7.18.7 -> 2.7.18.8
Diff: https://github.com/ActiveState/cpython/compare/v2.7.18.7...v2.7.18.8
2024-03-15 13:13:12 +01:00
Sandro Jäckel be51056b85 pythonRelaxDepsHook: don't rely on pname as that could be normalized already
according to the language docs
2024-03-15 11:27:27 +01:00
natsukium 8837f2fef2 python313: add a flag to disable GIL 2024-03-13 23:32:38 +09:00
Martin Weinelt b89f66b768 python313: 3.13.0a3 -> 3.13.0a5
https://docs.python.org/3.13/whatsnew/changelog.html#python-3-13-0-alpha-4
https://docs.python.org/3.13/whatsnew/changelog.html#python-3-13-0-alpha-5
2024-03-13 14:43:51 +01:00
github-actions[bot]andGitHub 09c267dae0 Merge master into staging-next 2024-03-06 06:01:19 +00:00
adisbladis de402796a7 mk-python-derivation: Break out attribute set cleaning into a separate function
With precomputed static lists.
2024-03-06 14:22:43 +13:00
adisbladis 1656fe1bf6 mk-python-derivation: Precompute static lists 2024-03-06 14:22:09 +13:00
Martin Weinelt 14a12caecf python38: remove
The end of life for Python 3.8 is scheduled for 2024/10. As such it
cannot be a part of NixOS 24.05, because its support cycle goes past
that.
2024-03-05 11:56:21 +01:00
adisbladis d77190aeaa mk-python-derivation: Refactor internal function validatePythonMatches
We can avoid recreating the same closure for every call by moving arguments around a little.
2024-03-04 16:04:50 +13:00
adisbladis fb757e30fa mk-python-derivation: Refactor lib usage 2024-03-04 16:04:50 +13:00
Yarny0 b1bccc25ec pythonCatchConflictsHook: test cyclic dependency
Add test case where a package enlists
itself as propagated build input.
2024-02-25 11:54:49 +01:00
Yarny0 e5d7325166 pythonCatchConflictsHook: avoid infinite recursion
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 2651ddc7b0,
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.
2024-02-25 11:54:07 +01:00