Commit Graph

34 Commits

Author SHA1 Message Date
Yueh-Shun Li
80a316f3fb makeOverridablePythonPackage: allow buildPython* to take fixed-point arguments
(cherry picked from commit fb9727a198)
2026-01-04 20:57:27 +00:00
Matt Sturgeon
d56c0d1775 buildPython*: preserve overrideStdenvCompat on subsequent overrides
This is needed to support the deprecated method of overriding `stdenv`
via `overridePythonAttrs`.

(cherry picked from commit 553a6c3d3a)
2025-12-12 17:09:46 +00:00
Matt Sturgeon
a46c1c26a7 buildPython*: remove stdenv arg in overrideStdenvCompat
Avoid passing `stdenv` to the underlying function when it is already
handled in overrideStdenvCompat.

(cherry picked from commit 32ecc2256b)
2025-12-12 17:09:46 +00:00
Matt Sturgeon
92c74c8724 buildPython*: switch overrideStdenvCompat to mirrorFunctionArgs
The underlying `mk-python-derivation.nix` functions do not have `stdenv`
in their functionArgs, so it was redundant to explicitly remove it.

(cherry picked from commit 9d87f178ed)
2025-12-12 17:09:46 +00:00
Matt Sturgeon
a4c361c471 buildPython*: rename override param in makeOverridablePythonPackage
`fdrv` → `newArgs`; the parameter is not a derivation, so fdrv is
confusing.

(cherry picked from commit 37655d3b36)
2025-12-12 17:09:46 +00:00
Yueh-Shun Li
8cbb7d8eb1 makeOverridablePythonPackage: take care of overrideAttrs
Make it possible to mix overridePythonAttrs and overrideAttrs, i.e.
((<pkg>.overrideAttrs (_: { foo = "a"; })).overridePythonAttrs (_: { })).foo now works

Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
(cherry picked from commit ca6c090082)
2025-12-12 08:29:11 +00:00
Yueh-Shun Li
ac8f3230d5 makeOverridablePythonPackage: simplify implementation
Attach overridePythonAttrs by attribute set update
instead of `stdenv.mkDerivation`'s `passthru`.

Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
(cherry picked from commit e8302431ef)
2025-12-12 08:29:11 +00:00
sternenseemann
0443b98ab3 buildPython*: unconditionally add .override
To be able to splice, we can't fail to eval before returning an
attribute set. By checking for f ? override, we need to force f which
isn't always possible, whereas mirrorFunctionArgs serves as an
indirection which wraps the inner thunks in an attribute set that can
always be returned. Fortunately, there should be no case when f
evaluates successfully and does not have the override attribute, so we
can just remove the condition.

This fixes evaluation of buildPython* based packages in certain splicing
situations by being lazier. An example of this is
pkgsCross.ghcjs.buildPackages.nixpkgs-openjdk-updater on staging right
now (ff5098e).
2025-10-25 00:15:34 +02:00
Yueh-Shun Li
e05528c65f buildPython*: warn about deprecated argument stdenv
On Nixpkgs >= 26.05 (or precisely, oldest supported release >= 25.11),
warn about the use of buildPython*'s deprecated argument `stdenv`.

Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
2025-10-23 14:56:56 +08:00
Yueh-Shun Li
c4e3b67afb buildPython*: allow stdenv customization through <function>.override 2025-10-23 14:51:18 +08:00
Yueh-Shun Li
7a4ad371b1 buildPython*: bring back buildPython*.override (#366593) 2025-10-22 19:20:10 +00:00
Yueh-Shun Li
cce0f3f300 buildPython*: bring back buildPython*.override
Fix `makeOverridablePythonPackage` in python-package-base.nix
and unshadow `buildPython*.override`.

This makes it possible to override the dependencies of buildPython*.
E.g., `buildPythonPackage.override { unzip = unzip-custom; }`
returns a derived version of `buildPythonPackage` with
the `unzip` package overridden with `unzip-custom`.
2025-10-23 03:08:33 +08:00
Wolfgang Walther
59233ecd0d top-level/release-attrpaths-superset: remove __attrsFailEvaluation
This doesn't seem to be necessary anymore. I confirmed by:
- Adding a lib.warn into the __attrsFailsEvaluation branch - never got
any.
- Removing it everywhere and running full Eval on it - no errors, no
rebuilds.
2025-07-23 19:23:23 +02:00
Martin Weinelt
05a564a0d0 cpython: add isPy313, isPy314 helpers 2025-02-04 23:54:32 +01:00
Silvan Mosberger
667d42c00d treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev 57b193d8dd
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:27:17 +01:00
Yueh-Shun Li
58bfe74123 buildPython*: Deprecate and remove (buildPython* { ... }).override
Deprecate (buildPythonPackage { ... }).override for Python packages in
favour of overridePythonAttrs.

This change does not affect the override interface of most Python
packages, as the override interface is provided by callPackage and
shadows the locally defined override attribute.
2024-10-08 01:09:35 +08:00
adisbladis
de1fdc9fe0 python3Packages.mkPythonEditablePackage: init 2024-09-08 17:13:21 +12:00
adisbladis
8cd58c7e14 python3Packages.mkPythonMetaPackage: init
This function exists create a meta package containing [metadata files](https://packaging.python.org/en/latest/specifications/recording-installed-packages/) to satisfy a dependency on a package, without it actually having been installed into the environment.
2024-08-30 00:24:31 +12:00
Ryan Horiguchi
0961e3294f pythonPackages: add missing isPy312 2024-08-13 01:08:32 +02:00
Philip Taron
0213840cd8 pythonPackages: move __attrsFailEvaluation to allow deeper inspection 2024-07-04 14:49:03 -07:00
Yang, Bo
002054c95f python: add error message for debugging infinite recursion 2024-05-06 07:04:21 +00:00
Felix Buehler
d35003e302 python311Packages.recursive-pth-loader: rename from recursivePthLoader 2024-01-25 22:13:17 +01:00
adisbladis
6b9f45ae37 python3.pkgs.buildsetupcfg: Remove function from python-packages-base.nix
This function is not, and never have been, used anywhere inside nixpkgs, outside of bootstrapping setupcfg2nix itself.
It was added in https://github.com/NixOS/nixpkgs/pull/38778 by @shlevy.

It has no out-of-tree users on Github either. External breakage is not expected.
2023-12-12 12:21:38 +13:00
Yueh-Shun Li
b3e2c15000 makeOverridablePythonPackage: preserve function arguments 2023-11-07 01:58:48 +00:00
Theodore Ni
e8cca499a8 python2.{buildPythonPackage,buildPythonApplication}: extract into its own file
As we continue iterating on Python infrastructure for Python 3, some
code is starting to diverge for Python 2. If we copy the current state
of mk-python-derivation.nix and freeze it for Python 2, we can iterate
on it for Python 3 with more freedom.
2023-08-20 10:59:46 +02:00
figsoda
ffbf6f27c9 python3.pkgs.fetchPypi: deprecate in favor of top-level fetchPypi 2023-05-31 13:48:06 -04:00
github-actions[bot]
c4fe2133de Merge staging-next into staging 2023-02-15 06:01:44 +00:00
Felix Buehler
bc3d5934d7 treewide: use lib.optionals 2023-02-14 19:11:59 +01:00
Artturi
dcc7df7fe6 Merge pull request #211685 from Artturin/splicingstuff1-split 2023-02-03 12:49:08 +02:00
figsoda
3290828905 fetchPypi: move to top level
fetchPypi doesn't use python under the hood and doesn't need to be tied
to a specific version of python. Moving it to top level makes it more
consistent with other fetchers and makes code generation easier.
2023-01-21 08:21:33 +01:00
Artturin
b94fa2c253 python-packages-base: use extends instead of //
// shouldn't be used when overrideAttrs is available

here we can use extends instead of overrideAttrs for performance
2023-01-20 19:19:18 +02:00
figsoda
ec8cb34358 treewide: fix typos 2022-12-17 19:39:44 -05:00
Martin Weinelt
b5a4d7760d cpython: drop leftover 3.5/3.6 logic and patches 2022-11-29 01:34:59 +01:00
Frederik Rietdijk
33d12e5f0b pythonPackages: ensure all derivations provide python modules
This adds a test to ensure no new uses of `buildPythonApplication` can
be added to `python-packages.nix`.

Python packages can be grouped into two groups: 1) applications and 2)
packages providing importable modules. In `python-packages.nix` we only
want to have 2). 1) should be in the top-level package set.

To achieve this, all setup hooks need to be marked as being a setup hook.
For the setup hooks in the Python packages set this is done by creating
a new builder, `makePythonHook`.

Because there were issues with splicing, the file importing all the hooks
is converted to an extension. All non-packages were moved out of `python-packages.nix`
into `python-packages-base.nix`. The `keep` argument to `makeScopeWithSplicing
was cleaned up as well; there is no need to keep this one manually in sync
reducing the risk of breaking cross-compilation.
2022-10-27 10:03:16 +02:00