176 Commits

Author SHA1 Message Date
Robert Schütz 006c7936a2 python3Packages.pythonMetadataCheckHook: init 2026-07-08 19:20:37 -07:00
Robert Schütz ff19be7fd1 python3Packages.pyprojectVersionPatchHook: init 2026-07-04 10:45:05 -07:00
Ben Siraphob 5fadc89f02 treewide: remove empty buildInputs assignments 2026-04-20 10:34:26 -07:00
Vinetos 38af642d2f stestrCheckHook: init
This adds a useful hook to be used for projects that use stestr,
it is primiative at the moment but covers most scenarios for using
it.

This PR also changes a Python module to start using it, once it
lands, follow up PRs can update all of them to use it tree-wide.

Signed-off-by: Vinetos <contact+git@vinetos.fr>
2026-02-21 22:20:21 +01:00
dotlambda 195e2bc55c python3Packages.setuptools-rust: fix cross build for all setuptools-rust based packages (#467817) 2025-12-11 06:25:13 +00:00
DavHau e656303867 python3Packages.setuptools-rust: fix cross build for all setuptools-rust based packages
Prior to this change all python packages using `setuptools-rust` were broken when cross compiled as they built binaries for the build platform instead of for the host platform.

The setuptoolsRustBuildHook hook would have to be included as a native build input instead of the `setuptools-rust` package, but practically wasn't used anywhere.

This change makes it so that `setuptoolsRustBuildHook` becomes unnecessary, and instead `setuptools-rust` propagates a setup-hook directly setting up the build environment, similar to how cmake does it when included via nativeBuildInputs.

This change fixes cross on all packages using `setuptools-rust` as a build-system.
2025-12-09 12:32:28 +07:00
Guillaume Girol 6724e26a08 Fix shebang of installed python scripts
Closes: https://github.com/NixOS/nixpkgs/pull/449340
Fixes: https://github.com/NixOS/nixpkgs/issues/449325
2025-11-18 12:00:00 +00:00
Wolfgang Walther 5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Wolfgang Walther 38002286d7 python3Packages.setuptoolsCheckHook: move to aliases
This had already been removed and should be an alias now.
2025-07-20 12:04:57 +02:00
Anton Mosich facae77bf5 python3Packages.sphinxHook: move to preFixupPhases
If sphinxHook runs before the fixup phase, possibly generated manpages
will get compressed in the fixup phase.
2025-06-14 21:23:01 +02:00
Yueh-Shun Li 842f12f8ff python3Packages.pytestCheckHook: format with shfmt 2025-05-04 01:36:44 +08:00
Yueh-Shun Li 63dea02c93 python3Packages.pytestCheckHook: fix Bash heredoc EOF outside subshell
Fix the unterminated here document of the pytest-check-hook.sh
error mesage by moving the EOF of the here document
between the parenthesis of the process substitution.
2025-05-04 01:31:46 +08:00
Yueh-Shun Li e1e072bf03 python3Packages.pytestCheckHook: support enabledTestMarks and disabledTestMarks 2025-03-23 23:51:16 +08:00
Yueh-Shun Li f7aeb5a9b7 python3Packages.pytestCheckHook: support enabledTests 2025-03-23 23:51:16 +08:00
Yueh-Shun Li f51e1c6766 python3Packages.pytestCheckHook: Make disabledTests support sub-expressions
Wrap each elements of disabledTests with parenthesis
so that when __structuredAttrs = true,
people could use sub-expressions an element.

E.g.
```nix
{
  disabledTests = [
    "ClassFoo and test_foo"
    "test_bar"
  ];
}
2025-03-23 23:10:09 +08:00
Yueh-Shun Li 4174f6ed5c python3Packages.pytestCheckHook: support enabledTestPaths 2025-03-23 23:10:04 +08:00
Yueh-Shun Li 16f8b50742 python3Packages.pytestCheckHook: support deselecting tests via disabledTestPaths
Pass disabledTestPaths elements containing double colons (::)
to --deselect instead of --ignore-glob.
2025-03-09 22:20:16 +08:00
Yueh-Shun Li 6bdb735bbe python3Packages.pytestCheckHook: append disableTests flags after disabledTestPaths flags 2025-03-09 22:20:16 +08:00
Yueh-Shun Li 9346e6aa5f python3Packages.pytestCheckHook: add tests 2025-03-07 07:14:56 +08:00
Yueh-Shun Li 2e512e7cf7 python3Packages.pytestCheckHook: fix disabledTestPaths glob matching assertion
Errors in Bash's process substitution doesn't get propagated outside.

Replace the process substitution with Python's `-` as /dev/stdin and
Bash's heredoc stdin redirection.
2025-03-07 07:14:56 +08:00
Yueh-Shun Li 9b07602c8e unittestCheckHook: lint with ShellCheck 2025-01-09 18:36:39 +08:00
Yueh-Shun Li 1e8f39148a unittestCheckHook: handle unittestFlagsArray __structuredAttrs-agnostically
Take unittestFlags as the new and conforming interface.

Keep unittestFlagsArray as is.
2025-01-09 18:36:39 +08:00
Yueh-Shun Li 76f6a3b292 setuptoolsBuildHook: lint with ShellCheck 2025-01-09 18:36:38 +08:00
Yueh-Shun Li d8c36cb252 setuptoolsBuildHook: support __structuredAttrs
Handle flags with appendToVar and concatTo.

Stop Bash-expanding elements of
setupPyGlobalFlags and setupPyBuildFlags.
2025-01-09 18:36:38 +08:00
Yueh-Shun Li ec6f585f05 pytestCheckHook: lint with ShellCheck 2025-01-09 18:36:37 +08:00
Yueh-Shun Li 26f09762a8 pytestCheckHook: support __structuredAttrs
Add flag pytestFlags as the new, conforming interface
replacing pytestFlagsArray.

Stop Bash-expanding disabledTests and disabledTestPaths.

Handle disabledTestPaths with `pytest --ignore-glob <path>`
to keep globbing support.
Check if each path glob matches at least one path
using the `glob` module from the Python standard library.

Also make buildPythonPackage and buildPythonApplication
stop escaping the elements of disabledTests and disabledTestPaths.
2025-01-09 18:36:37 +08: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 https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
      --argstr baseRev 57b193d8dd
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:27:17 +01:00
Wolfgang Walther 56b09628e3 stdenv: support multi-char separators in concatStringsSep
One prominent use-case for this is pytestCheckHook. This will help
making it work with structuredAttrs in the future.
2024-11-30 16:38:02 +01:00
Wolfgang Walther d86588d230 treewide: improve prepending and appending derivation arguments in bash code
Those would be problematic with __structuredAttrs turned on, because
they'd turn those nice bash arrays back into strings - and potentially
lose some of the values on the way.
2024-11-25 09:09:23 +01:00
Emily 1634419f4f Merge staging-next into staging 2024-11-19 14:15:02 +00:00
OTABI Tomoya 55f94d9fda python3Packages: Fix and document the removal of the local .overrideAttrs attribute (#350127) 2024-11-19 17:45:32 +09:00
Martin Weinelt 40f89c6e0d python3.pkgs.pythonRuntimeDepsCheckHook: don't validate wheel metadata
Metadata can have issues that the packaging library will complain about,
but that should not prevent us from building any package.
2024-11-18 18:36:51 +01:00
Martin Weinelt d6c1a5e4e2 python3.pkgs.pythonRuntimeDepsCheckHook: allow prereleases
Updating to prereleases should be possible, but making this an option is
difficult, given that for packages with many consumers you would have to
set it in each consumer.

We thoroughly test the package set, so allowing prereleases unconditionally
shouldn't be too bad.

Closes: #301698
2024-11-18 18:36:46 +01:00
Yueh-Shun Li 6597b74fea pypaBuildHook.tests: modernize 2024-11-05 10:47:23 +08:00
Yueh-Shun Li e32457af0c setuptoolsRustHook: lint with ShellCheck 2024-11-05 10:47:23 +08:00
Yueh-Shun Li 65293f4247 pythonRemoveTestDirHook: lint with ShellCheck 2024-11-05 10:47:23 +08:00
Yueh-Shun Li 29c08adae1 pythonRelaxDepsHook: lint with ShellCheck
Ignore SC2164 at this moment, as it will be gone when adding `set -e`.
2024-11-05 10:47:22 +08:00
Yueh-Shun Li 3a79bc3aee pythonRelaxDepsHook: handle attributes __structuredAttrs-agnostically
Make the interation across pythonRelaxDeps and pythonRemoveDeps work
regardless of __structuredAttrs.
2024-11-05 10:47:22 +08:00
Yueh-Shun Li e4f2f9dd22 pythonOutputDistHook: lint with ShellCheck 2024-11-05 10:47:22 +08:00
Yueh-Shun Li ccb418b699 pythonNamespacesHook: lint with ShellCheck 2024-11-05 10:47:02 +08:00
Yueh-Shun Li bab7ef307c pythonImportsCheckHook: lint with ShellCheck 2024-11-05 10:41:17 +08:00
Yueh-Shun Li 967e5b43ed pythonImportsCheckHook: support __structuredAttrs = true 2024-10-28 22:22:42 +08:00
Yueh-Shun Li 69f4871514 pypaBuildHook: lint with ShellCheck 2024-10-28 22:22:42 +08:00
Yueh-Shun Li 1f39bb6586 pypaBuildHook: handle pypaBuildFlags __structuredAttrs-agnostically 2024-10-28 22:22:41 +08:00
Yueh-Shun Li 3a0f6fabff pipInstallHook: handle pipInstallFlags __structuredAttrs-agnostically 2024-10-28 21:21:15 +08:00
Yueh-Shun Li c4bc1a8bb6 pipBuildHook: handle pipBuildFlags __structuredAttrs-agnostically 2024-10-28 21:20:07 +08:00
Yueh-Shun Li 1f8bb94bca pythonOutputDistHook: append *Phases with appendToVar 2024-10-28 21:19:51 +08:00
Yueh-Shun Li 3e8d53b9e8 python3Packages.pythonCatchConflictsHook: fix tests with lib.overrideDerivation
Use lib.overrideDerivation instead of <pkg>.overrideDerivation
to fix the evaluation of
python3Packages.pythonCatchConflictsHook.tests.catches-conflict-multiple-chains,
as buildPythonPackage and buildPythonApplication no longer provide
<pkg>.overrideDerivation

Clean up the leftover of commit 58bfe74123 ("buildPython*:
Deprecate and remove (buildPython* { ... }).override")
2024-10-22 12:51:11 +08:00
Yueh-Shun Li 57c2e5683d buildPython hooks: format with shfmt 2024-10-08 07:42:21 +08:00
Yueh-Shun Li 758056dac7 treewide: handle postPhases __structuredAttrs-agnostically
Always specify the postPhases attribute as a list instead of a string.

Append elements to the postPhases Bash variable using appendToVar
instead of string or Bash array concatenation.
2024-09-03 05:56:17 +08:00