From a36613636d1a53606eade1dc3556290315bb6644 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Thu, 26 Oct 2023 12:11:28 +1300 Subject: [PATCH 1/4] chore: Add treefmt --- .github/workflows/ci.yml | 26 -------------------------- dev/treefmt.nix | 31 +++++++++++++++++++++++++++++++ flake.lock | 38 +++++++++++++++++++++++++++++++++++++- flake.nix | 16 ++++++++++++++-- 4 files changed, 82 insertions(+), 29 deletions(-) create mode 100644 dev/treefmt.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89ddddb0e..4708b42ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,30 +19,6 @@ jobs: - name: Check format run: nix-shell --packages jq diffutils --run "diff --unified overrides/build-systems.json <(jq --from-file overrides/sort-build-systems.jq --raw-output --sort-keys < overrides/build-systems.json)" - nixpkgs-fmt: - runs-on: ubuntu-latest - steps: - - uses: cachix/install-nix-action@v23 - with: - nix_path: nixpkgs=channel:nixos-unstable - - uses: actions/checkout@v4 - - name: Check format - run: nix run 'nixpkgs#nixpkgs-fmt' -- --check . - - black-fmt: - runs-on: ubuntu-latest - steps: - - uses: cachix/install-nix-action@v23 - with: - nix_path: nixpkgs=channel:nixos-unstable - - uses: actions/checkout@v4 - - uses: cachix/cachix-action@v12 - with: - name: poetry2nix - signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw==" - - name: Check format - run: nix develop -c black --check . - nix-matrix: runs-on: ubuntu-latest outputs: @@ -74,8 +50,6 @@ jobs: collect: runs-on: ubuntu-latest needs: - - nixpkgs-fmt - - black-fmt - nix-build - sort-build-systems steps: diff --git a/dev/treefmt.nix b/dev/treefmt.nix new file mode 100644 index 000000000..c5059f8c5 --- /dev/null +++ b/dev/treefmt.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: { + # Used to find the project root + projectRootFile = "flake.lock"; + + settings.formatter = { + nix = { + command = "sh"; + options = [ + "-eucx" + '' + ${pkgs.lib.getExe pkgs.nixpkgs-fmt} "$@" + '' + "--" + ]; + includes = [ "*.nix" ]; + excludes = [ ]; + }; + + python = { + command = "sh"; + options = [ + "-eucx" + '' + ${pkgs.lib.getExe pkgs.python3.pkgs.black} "$@" + '' + "--" # this argument is ignored by bash + ]; + includes = [ "*.py" ]; + }; + }; +} diff --git a/flake.lock b/flake.lock index aab3f15cd..c5855c8e0 100644 --- a/flake.lock +++ b/flake.lock @@ -58,7 +58,9 @@ "inputs": { "flake-utils": "flake-utils", "nix-github-actions": "nix-github-actions", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" } }, "systems": { @@ -75,6 +77,40 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1697388351, + "narHash": "sha256-63N2eBpKaziIy4R44vjpUu8Nz5fCJY7okKrkixvDQmY=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "aae39f64f5ecbe89792d05eacea5cb241891292a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0fb19c8f7..3d840d460 100644 --- a/flake.nix +++ b/flake.nix @@ -5,13 +5,21 @@ flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:NixOS/nixpkgs/master"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; + nix-github-actions = { url = "github:nix-community/nix-github-actions"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, flake-utils, nix-github-actions }: + outputs = { self, nixpkgs, flake-utils, nix-github-actions, treefmt-nix, systems }: + let + eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system}); + treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./dev/treefmt.nix); + in + { overlay = import ./overlay.nix; @@ -32,7 +40,9 @@ let pkgs = mkPkgs "x86_64-linux"; in - import ./tests { inherit pkgs; }; + import ./tests { inherit pkgs; } // { + formatting = treefmtEval.x86_64-linux.config.build.check self; + }; x86_64-darwin = let @@ -84,6 +94,8 @@ poetry2nix = import ./default.nix { inherit pkgs; }; in rec { + formatter = treefmtEval.${system}.config.build.wrapper; + packages = { poetry2nix = poetry2nix.cli; default = poetry2nix.cli; From 4a829c9f9833f53492bccfcd396fe9d5c2931df7 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Thu, 26 Oct 2023 12:17:57 +1300 Subject: [PATCH 2/4] chore: Add statix/deadnix --- dev/treefmt.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dev/treefmt.nix b/dev/treefmt.nix index c5059f8c5..dfaa015ec 100644 --- a/dev/treefmt.nix +++ b/dev/treefmt.nix @@ -8,6 +8,12 @@ options = [ "-eucx" '' + ${pkgs.lib.getExe pkgs.deadnix} --edit "$@" + + for i in "$@"; do + ${pkgs.lib.getExe pkgs.statix} fix "$i" + done + ${pkgs.lib.getExe pkgs.nixpkgs-fmt} "$@" '' "--" From 1977f8fb13fc278ba5d277a966a67377c49e623f Mon Sep 17 00:00:00 2001 From: adisbladis Date: Thu, 26 Oct 2023 12:27:24 +1300 Subject: [PATCH 3/4] lib.predictURLFromPypi: Remove hash argument --- lib.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.nix b/lib.nix index 4c52c07b6..ab9b6a286 100644 --- a/lib.nix +++ b/lib.nix @@ -97,7 +97,7 @@ let # hash: SRI hash # kind: Language implementation and version tag predictURLFromPypi = lib.makeOverridable ( - { pname, file, hash, kind }: + { pname, file, kind }: "https://files.pythonhosted.org/packages/${kind}/${lib.toLower (builtins.substring 0 1 file)}/${pname}/${file}" ); @@ -114,7 +114,7 @@ let fetchFromPypi = lib.makeOverridable ( { pname, file, version, hash, kind, curlOpts ? "" }: let - predictedURL = predictURLFromPypi { inherit pname file hash kind; }; + predictedURL = predictURLFromPypi { inherit pname file kind; }; in (pkgs.stdenvNoCC.mkDerivation { name = file; From 98971720b6ae360237df5732a0ff050d51137248 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Thu, 26 Oct 2023 12:18:24 +1300 Subject: [PATCH 4/4] style: Apply statix/deadnix --- default.nix | 78 +++---- lib.nix | 8 +- overlay.nix | 2 +- overrides/default.nix | 209 +++++++++--------- pep508.nix | 40 ++-- plugins.nix | 2 +- semver.nix | 28 ++- tests/aiopath/default.nix | 2 +- tests/awscli/default.nix | 2 +- tests/canonical-module-names/default.nix | 4 +- .../poetry-git-overlay.nix | 2 +- tests/cffi-pandas-wheel/default.nix | 2 +- tests/composable-defaults/default.nix | 14 +- tests/dependency-environment/default.nix | 8 +- tests/dependency-groups/default.nix | 2 +- tests/duckdb-wheel/default.nix | 2 +- tests/editable-egg/default.nix | 2 +- tests/editable/default.nix | 2 +- tests/env/default.nix | 2 +- tests/fancycompleter-wheel/default.nix | 2 +- tests/fastapi-utils/default.nix | 2 +- tests/fiona-wheel/default.nix | 2 +- tests/git-deps-pinned/poetry-git-overlay.nix | 2 +- tests/grpcio-wheel/default.nix | 4 +- tests/in-list/default.nix | 2 +- tests/jq/default.nix | 2 +- tests/legacy/default.nix | 2 +- tests/markdown-it-py-wheel/default.nix | 4 +- tests/markupsafe2/default.nix | 2 +- tests/missing-iswheel/default.nix | 2 +- tests/mk-poetry-packages/default.nix | 2 +- tests/mkdocstrings-wheel/default.nix | 2 +- tests/ml-stack/default.nix | 3 +- tests/nbconvert-wheel/default.nix | 2 +- tests/option/default.nix | 2 +- tests/override-default-support/default.nix | 10 +- tests/override-support/default.nix | 8 +- tests/panel-wheels/default.nix | 2 +- tests/path-deps-develop/default.nix | 2 +- tests/pendulum/default.nix | 2 +- tests/pep425/default.nix | 16 +- tests/pep600/default.nix | 6 +- tests/prefer-wheel/default.nix | 4 +- tests/prefer-wheels/default.nix | 2 +- tests/pyarrow-wheel/default.nix | 2 +- tests/pytesseract/default.nix | 1 - tests/pytest-randomly/default.nix | 2 +- tests/returns/default.nix | 2 +- tests/rpds-py-no-wheel/default.nix | 1 - tests/shandy-sqlfmt/default.nix | 2 +- tests/shapely-wheel/default.nix | 2 +- tests/source-filter/default.nix | 2 +- tests/textual-dev/default.nix | 2 +- tests/textual-textarea/default.nix | 2 +- tests/trivial-poetry-1_2_0/default.nix | 2 +- tests/trivial/default.nix | 2 +- tests/ubersmith/default.nix | 2 +- tests/utf8-pyproject/default.nix | 2 +- tests/wheel-wheel/default.nix | 2 +- 59 files changed, 249 insertions(+), 279 deletions(-) diff --git a/default.nix b/default.nix index 54cf04bb6..c59023d5b 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ { pkgs ? import { } , lib ? pkgs.lib -, poetryLib ? import ./lib.nix { inherit lib pkgs; stdenv = pkgs.stdenv; } +, poetryLib ? import ./lib.nix { inherit lib pkgs; inherit (pkgs) stdenv; } }: let inherit (poetryLib) isCompatible readTOML normalizePackageName normalizePackageSet; @@ -11,7 +11,7 @@ let getLicenseBySpdxId = spdxId: spdxLicenses.${spdxId} or spdxId; # Experimental withPlugins functionality - toPluginAble = (import ./plugins.nix { inherit pkgs lib; }).toPluginAble; + inherit ((import ./plugins.nix { inherit pkgs lib; })) toPluginAble; # List of known build systems that are passed through from nixpkgs unmodified knownBuildSystems = lib.importJSON ./known-build-systems.json; @@ -35,19 +35,17 @@ let compat = isCompatible (poetryLib.getPythonVersion py); depAttrs = builtins.map (d: lib.toLower d) (builtins.attrNames depSet); in - ( - builtins.map - ( - dep: - let - pkg = py.pkgs."${normalizePackageName dep}"; - constraints = depSet.${dep}.python or ""; - isCompat = compat constraints; - in - if isCompat then pkg else null - ) - depAttrs - ); + builtins.map + ( + dep: + let + pkg = py.pkgs."${normalizePackageName dep}"; + constraints = depSet.${dep}.python or ""; + isCompat = compat constraints; + in + if isCompat then pkg else null + ) + depAttrs; buildSystemPkgs = poetryLib.getBuildSystemPkgs { inherit pyProject; @@ -156,7 +154,7 @@ lib.makeScope pkgs.newScope (self: { inherit python scripts; }; - editablePackageSources' = lib.filterAttrs (name: path: path != null) editablePackageSources; + editablePackageSources' = lib.filterAttrs (_name: path: path != null) editablePackageSources; hasEditable = editablePackageSources' != { }; editablePackage = self.mkPoetryEditablePackage { inherit pyProject python; @@ -205,12 +203,10 @@ lib.makeScope pkgs.newScope (self: { files = pkgMeta.files or lockFiles.${normalizedName}; pythonPackages = self; - sourceSpec = ( - (normalizePackageSet pyProject.tool.poetry.dependencies or { }).${normalizedName} - or (normalizePackageSet pyProject.tool.poetry.dev-dependencies or { }).${normalizedName} - or (normalizePackageSet pyProject.tool.poetry.group.dev.dependencies or { }).${normalizedName} # Poetry 1.2.0+ - or { } - ); + sourceSpec = (normalizePackageSet pyProject.tool.poetry.dependencies or { }).${normalizedName} + or (normalizePackageSet pyProject.tool.poetry.dev-dependencies or { }).${normalizedName} + or (normalizePackageSet pyProject.tool.poetry.group.dev.dependencies or { }).${normalizedName} # Poetry 1.2.0+ + or { }; } ); } @@ -228,7 +224,7 @@ lib.makeScope pkgs.newScope (self: { ( [ # Remove Python packages aliases with non-normalized names to avoid issues with infinite recursion (issue #750). - (self: super: { + (_self: super: { # Upstream nixpkgs uses non canonical names async-generator = super.async-generator or super.async_generator or null; }) @@ -257,8 +253,8 @@ lib.makeScope pkgs.newScope (self: { ) # Fix infinite recursion in a lot of packages because of checkInputs - (self: super: lib.mapAttrs - (name: value: ( + (_self: super: lib.mapAttrs + (_name: value: ( if lib.isDerivation value && lib.hasAttr "overridePythonAttrs" value then value.overridePythonAttrs (_: { doCheck = false; }) else value @@ -266,19 +262,19 @@ lib.makeScope pkgs.newScope (self: { super) # Null out any filtered packages, we don't want python.pkgs from nixpkgs - (self: super: builtins.listToAttrs (builtins.map (x: { name = normalizePackageName x.name; value = null; }) incompatible)) + (_self: _super: builtins.listToAttrs (builtins.map (x: { name = normalizePackageName x.name; value = null; }) incompatible)) # Create poetry2nix layer baseOverlay ] ++ # User provided overrides (if builtins.typeOf overrides == "list" then overrides else [ overrides ]) ); - packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) overlays; + packageOverrides = lib.foldr lib.composeExtensions (_self: _super: { }) overlays; py = python.override { inherit packageOverrides; self = py; }; inputAttrs = mkInputAttrs { inherit py pyProject groups checkGroups extras; attrs = { }; includeBuildSystem = false; }; - requiredPythonModules = python.pkgs.requiredPythonModules; + inherit (python.pkgs) requiredPythonModules; /* Include all the nested dependencies which are required for each package. This guarantees that using the "poetryPackages" attribute will return complete list of dependencies for the poetry project to be portable. @@ -290,7 +286,7 @@ lib.makeScope pkgs.newScope (self: { poetryPackages = storePackages ++ lib.optional hasScripts scriptsPackage ++ lib.optional hasEditable editablePackage; - poetryLock = poetryLock; + inherit poetryLock; inherit pyProject; }; @@ -310,7 +306,7 @@ lib.makeScope pkgs.newScope (self: { , python ? pkgs.python3 , preferWheels ? false , editablePackageSources ? { } - , extraPackages ? ps: [ ] + , extraPackages ? _ps: [ ] , groups ? [ "dev" ] , checkGroups ? [ "dev" ] , extras ? [ "*" ] @@ -322,24 +318,22 @@ lib.makeScope pkgs.newScope (self: { # Automatically add dependencies with develop = true as editable packages, but only if path dependencies getEditableDeps = set: lib.mapAttrs - (name: value: projectDir + "/${value.path}") - (lib.filterAttrs (name: dep: dep.develop or false && hasAttr "path" dep) set); + (_name: value: projectDir + "/${value.path}") + (lib.filterAttrs (_name: dep: dep.develop or false && hasAttr "path" dep) set); excludedEditablePackageNames = builtins.filter (pkg: editablePackageSources."${pkg}" == null) (builtins.attrNames editablePackageSources); - allEditablePackageSources = ( - (getEditableDeps (pyProject.tool.poetry."dependencies" or { })) + allEditablePackageSources = (getEditableDeps (pyProject.tool.poetry."dependencies" or { })) // (getEditableDeps (pyProject.tool.poetry."dev-dependencies" or { })) // ( - # Poetry>=1.2.0 - if pyProject.tool.poetry.group or { } != { } then - builtins.foldl' (acc: g: acc // getEditableDeps pyProject.tool.poetry.group.${g}.dependencies) { } groups - else { } - ) - // editablePackageSources - ); + # Poetry>=1.2.0 + if pyProject.tool.poetry.group or { } != { } then + builtins.foldl' (acc: g: acc // getEditableDeps pyProject.tool.poetry.group.${g}.dependencies) { } groups + else { } + ) + // editablePackageSources; editablePackageSources' = builtins.removeAttrs allEditablePackageSources @@ -413,7 +407,7 @@ lib.makeScope pkgs.newScope (self: { ]; } // { pname = normalizePackageName pyProject.tool.poetry.name; - version = pyProject.tool.poetry.version; + inherit (pyProject.tool.poetry) version; inherit src; diff --git a/lib.nix b/lib.nix index ab9b6a286..058fab8a5 100644 --- a/lib.nix +++ b/lib.nix @@ -116,7 +116,7 @@ let let predictedURL = predictURLFromPypi { inherit pname file kind; }; in - (pkgs.stdenvNoCC.mkDerivation { + pkgs.stdenvNoCC.mkDerivation { name = file; nativeBuildInputs = [ pkgs.buildPackages.curl @@ -141,16 +141,16 @@ let passthru = { urls = [ predictedURL ]; # retain compatibility with nixpkgs' fetchurl }; - }) + } ); fetchFromLegacy = lib.makeOverridable ( { python, pname, url, file, hash }: let pathParts = - (builtins.filter + builtins.filter ({ prefix, path }: "NETRC" == prefix) - builtins.nixPath); + builtins.nixPath; netrc_file = if (pathParts != [ ]) then (builtins.head pathParts).path else ""; in pkgs.runCommand file diff --git a/overlay.nix b/overlay.nix index 0907e8583..930f713d5 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,3 +1,3 @@ -final: prev: { +final: _prev: { poetry2nix = import ./default.nix { pkgs = final; }; } diff --git a/overrides/default.nix b/overrides/default.nix index a0e2872f6..42891a506 100644 --- a/overrides/default.nix +++ b/overrides/default.nix @@ -33,40 +33,37 @@ let else if attr == "cython" then self.python.pythonForBuild.pkgs.cython else self.${attr}; in - ( - # Flit only works on Python3 - if (attr == "flit-core" || attr == "flit" || attr == "hatchling") && !self.isPy3k then drv - else if drv == null then null - else if drv ? overridePythonAttrs == false then drv - else - drv.overridePythonAttrs ( - old: - # We do not need the build system for wheels. - if old ? format && old.format == "wheel" then - { } - else if attr == "poetry" then - { - # replace poetry - postPatch = (old.postPatch or "") + '' - if [ -f pyproject.toml ]; then - toml="$(mktemp)" - yj -tj < pyproject.toml | jq --from-file ${./poetry-to-poetry-core.jq} | yj -jt > "$toml" - mv "$toml" pyproject.toml - fi - ''; - nativeBuildInputs = old.nativeBuildInputs or [ ] - ++ [ self.poetry-core self.pkgs.yj self.pkgs.jq ] - ++ map (a: self.${a}) extraAttrs; - } - else - { - nativeBuildInputs = - (old.nativeBuildInputs or [ ]) - ++ lib.optionals (!(builtins.isNull buildSystem)) [ buildSystem ] - ++ map (a: self.${a}) extraAttrs; - } - ) - ); + if (attr == "flit-core" || attr == "flit" || attr == "hatchling") && !self.isPy3k then drv + else if drv == null then null + else if !drv ? overridePythonAttrs then drv + else + drv.overridePythonAttrs ( + old: + # We do not need the build system for wheels. + if old ? format && old.format == "wheel" then + { } + else if attr == "poetry" then + { + # replace poetry + postPatch = (old.postPatch or "") + '' + if [ -f pyproject.toml ]; then + toml="$(mktemp)" + yj -tj < pyproject.toml | jq --from-file ${./poetry-to-poetry-core.jq} | yj -jt > "$toml" + mv "$toml" pyproject.toml + fi + ''; + nativeBuildInputs = old.nativeBuildInputs or [ ] + ++ [ self.poetry-core self.pkgs.yj self.pkgs.jq ] + ++ map (a: self.${a}) extraAttrs; + } + else + { + nativeBuildInputs = + (old.nativeBuildInputs or [ ]) + ++ lib.optionals (!(builtins.isNull buildSystem)) [ buildSystem ] + ++ map (a: self.${a}) extraAttrs; + } + ); removePackagesByName = packages: packagesToRemove: let @@ -327,7 +324,7 @@ lib.composeManyExtensions [ cargoDeps = pkgs.rustPlatform.fetchCargoTarball { - src = old.src; + inherit (old) src; sourceRoot = "${old.pname}-${old.version}/src/_bcrypt"; name = "${old.pname}-${old.version}"; sha256 = getCargoHash old.version; @@ -385,7 +382,7 @@ lib.composeManyExtensions [ ''; }) else drv; - ccxt = super.ccxt.overridePythonAttrs (old: { + ccxt = super.ccxt.overridePythonAttrs (_old: { preBuild = '' ln -s README.{rst,md} ''; @@ -478,7 +475,7 @@ lib.composeManyExtensions [ ); coincurve = super.coincurve.overridePythonAttrs ( - old: { + _old: { # package setup logic LIB_DIR = "${lib.getLib pkgs.secp256k1}/lib"; @@ -559,7 +556,7 @@ lib.composeManyExtensions [ } // lib.optionalAttrs (lib.versionAtLeast old.version "3.5" && !isWheel) rec { cargoDeps = pkgs.rustPlatform.fetchCargoTarball { - src = old.src; + inherit (old) src; sourceRoot = "${old.pname}-${old.version}/${cargoRoot}"; name = "${old.pname}-${old.version}"; inherit sha256; @@ -580,7 +577,7 @@ lib.composeManyExtensions [ nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ]; }); - daphne = super.daphne.overridePythonAttrs (old: { + daphne = super.daphne.overridePythonAttrs (_old: { postPatch = '' substituteInPlace setup.py --replace 'setup_requires=["pytest-runner"],' "" ''; @@ -597,7 +594,7 @@ lib.composeManyExtensions [ buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools ]; }); - databricks-connect = super.databricks-connect.overridePythonAttrs (old: { + databricks-connect = super.databricks-connect.overridePythonAttrs (_old: { sourceRoot = "."; }); @@ -654,13 +651,11 @@ lib.composeManyExtensions [ } ); - django = ( - super.django.overridePythonAttrs ( - old: { - propagatedNativeBuildInputs = (old.propagatedNativeBuildInputs or [ ]) - ++ [ pkgs.gettext self.pytest-runner ]; - } - ) + django = super.django.overridePythonAttrs ( + old: { + propagatedNativeBuildInputs = (old.propagatedNativeBuildInputs or [ ]) + ++ [ pkgs.gettext self.pytest-runner ]; + } ); django-bakery = super.django-bakery.overridePythonAttrs ( @@ -721,7 +716,7 @@ lib.composeManyExtensions [ if lib.versionOlder super.docutils.version "0.16" && lib.versionAtLeast super.setuptools.version "60" then ( super.docutils.overridePythonAttrs ( - old: { + _old: { SETUPTOOLS_USE_DISTUTILS = "stdlib"; } ) @@ -763,7 +758,7 @@ lib.composeManyExtensions [ # FIXME: this is a workaround for https://github.com/nix-community/poetry2nix/issues/1161 eth-utils = super.eth-utils.override { preferWheel = true; }; - evdev = super.evdev.overridePythonAttrs (old: { + evdev = super.evdev.overridePythonAttrs (_old: { preConfigure = '' substituteInPlace setup.py --replace /usr/include/linux ${pkgs.linuxHeaders}/include/linux ''; @@ -797,7 +792,7 @@ lib.composeManyExtensions [ ); file-magic = super.file-magic.overridePythonAttrs ( - old: { + _old: { postPatch = '' substituteInPlace magic.py --replace "find_library('magic')" "'${pkgs.file}/lib/libmagic${pkgs.stdenv.hostPlatform.extensions.sharedLibrary}'" ''; @@ -898,7 +893,7 @@ lib.composeManyExtensions [ DISABLE_LIBC_COMPATIBILITY = 1; }); - grpcio-tools = super.grpcio-tools.overridePythonAttrs (old: { + grpcio-tools = super.grpcio-tools.overridePythonAttrs (_old: { outputs = [ "out" "dev" ]; }); @@ -922,8 +917,8 @@ lib.composeManyExtensions [ if old.format != "wheel" then ( let - mpi = pkgs.hdf5.mpi; - mpiSupport = pkgs.hdf5.mpiSupport; + inherit (pkgs.hdf5) mpi; + inherit (pkgs.hdf5) mpiSupport; in { nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkg-config ]; @@ -950,7 +945,7 @@ lib.composeManyExtensions [ ); hid = super.hid.overridePythonAttrs ( - old: { + _old: { postPatch = '' found= for name in libhidapi-hidraw libhidapi-libusb libhidapi-iohidmanager libhidapi; do @@ -1000,7 +995,7 @@ lib.composeManyExtensions [ propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pyparsing ]; }); - icecream = super.icecream.overridePythonAttrs (old: { + icecream = super.icecream.overridePythonAttrs (_old: { # # ERROR: Could not find a version that satisfies the requirement executing>=0.3.1 (from icecream) (from versions: none) postPatch = '' substituteInPlace setup.py --replace 'executing>=0.3.1' 'executing' @@ -1079,7 +1074,7 @@ lib.composeManyExtensions [ ); intreehooks = super.intreehooks.overridePythonAttrs ( - old: { + _old: { doCheck = false; } ); @@ -1194,7 +1189,7 @@ lib.composeManyExtensions [ }); jupyter = super.jupyter.overridePythonAttrs ( - old: { + _old: { # jupyter is a meta-package. Everything relevant comes from the # dependencies. It does however have a jupyter.py file that conflicts # with jupyter-core so this meta solves this conflict. @@ -1342,7 +1337,7 @@ lib.composeManyExtensions [ __impureHostDeps = lib.optionals pkgs.stdenv.isDarwin [ "/usr/lib/libm.dylib" ]; - passthru = old.passthru // { llvm = llvm; }; + passthru = old.passthru // { inherit llvm; }; } ); @@ -1536,15 +1531,13 @@ lib.composeManyExtensions [ let cfg = pkgs.writeTextFile { name = "mpi.cfg"; - text = ( - lib.generators.toINI - { } - { - mpi = { - mpicc = "${pkgs.mpi.outPath}/bin/mpicc"; - }; - } - ); + text = lib.generators.toINI + { } + { + mpi = { + mpicc = "${pkgs.mpi.outPath}/bin/mpicc"; + }; + }; }; in { @@ -1641,19 +1634,17 @@ lib.composeManyExtensions [ blasImplementation = lib.nameFromURL blas.name "-"; cfg = pkgs.writeTextFile { name = "site.cfg"; - text = ( - lib.generators.toINI - { } - { - ${blasImplementation} = { - include_dirs = "${blas}/include"; - library_dirs = "${blas}/lib"; - } // lib.optionalAttrs (blasImplementation == "mkl") { - mkl_libs = "mkl_rt"; - lapack_libs = ""; - }; - } - ); + text = lib.generators.toINI + { } + { + ${blasImplementation} = { + include_dirs = "${blas}/include"; + library_dirs = "${blas}/lib"; + } // lib.optionalAttrs (blasImplementation == "mkl") { + mkl_libs = "mkl_rt"; + lapack_libs = ""; + }; + }; }; in { @@ -1669,7 +1660,7 @@ lib.composeManyExtensions [ export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES ''; passthru = old.passthru // { - blas = blas; + inherit blas; inherit blasImplementation cfg; }; } @@ -1678,7 +1669,7 @@ lib.composeManyExtensions [ notebook = if (lib.versionAtLeast super.notebook.version "7.0.0") then super.notebook.overridePythonAttrs - (old: ({ + (old: { buildInputs = (old.buildInputs or [ ]) ++ [ super.hatchling super.hatch-jupyter-builder @@ -1688,7 +1679,7 @@ lib.composeManyExtensions [ nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ super.jupyterlab ]; - })) else super.notebook; + }) else super.notebook; # The following are dependencies of torch >= 2.0.0. # torch doesn't officially support system CUDA, unless you build it yourself. @@ -1902,7 +1893,7 @@ lib.composeManyExtensions [ ); pdal = super.pdal.overridePythonAttrs ( - old: { + _old: { PDAL_CONFIG = "${pkgs.pdal}/bin/pdal-config"; } ); @@ -1939,7 +1930,7 @@ lib.composeManyExtensions [ buildInputs = with pkgs; (old.buildInputs or [ ]) ++ [ freetype libjpeg zlib libtiff libxcrypt libwebp tcl lcms2 ] ++ lib.optionals (lib.versionAtLeast old.version "7.1.0") [ xorg.libxcb ] - ++ lib.optionals (self.isPyPy) [ tk xorg.libX11 ]; + ++ lib.optionals self.isPyPy [ tk xorg.libX11 ]; preConfigure = lib.optional (old.format != "wheel") preConfigure; } ); @@ -1952,7 +1943,7 @@ lib.composeManyExtensions [ } ); - pip-requirements-parser = super.pip-requirements-parser.overridePythonAttrs (old: { + pip-requirements-parser = super.pip-requirements-parser.overridePythonAttrs (_old: { dontConfigure = true; }); @@ -1975,7 +1966,7 @@ lib.composeManyExtensions [ } ); - poetry-plugin-export = super.poetry-plugin-export.overridePythonAttrs (old: { + poetry-plugin-export = super.poetry-plugin-export.overridePythonAttrs (_old: { dontUsePythonImportsCheck = true; pipInstallFlags = [ "--no-deps" @@ -2051,7 +2042,7 @@ lib.composeManyExtensions [ _arrow-cpp = pkgs.arrow-cpp.override ( builtins.intersectAttrs (lib.functionArgs pkgs.arrow-cpp.override) - { python = self.python; python3 = self.python; } + { inherit (self) python; python3 = self.python; } ); ARROW_HOME = _arrow-cpp; @@ -2142,7 +2133,7 @@ lib.composeManyExtensions [ }); pygame = super.pygame.overridePythonAttrs ( - old: rec { + _old: rec { nativeBuildInputs = [ pkg-config pkgs.SDL @@ -2274,7 +2265,7 @@ lib.composeManyExtensions [ ); pyproj = super.pyproj.overridePythonAttrs ( - old: { + _old: { PROJ_DIR = "${pkgs.proj}"; PROJ_LIBDIR = "${pkgs.proj}/lib"; PROJ_INCDIR = "${pkgs.proj.dev}/include"; @@ -2381,7 +2372,7 @@ lib.composeManyExtensions [ pytoml = super.pytoml.overridePythonAttrs ( - old: { + _old: { doCheck = false; } ); @@ -2433,7 +2424,7 @@ lib.composeManyExtensions [ ); pytest-datadir = super.pytest-datadir.overridePythonAttrs ( - old: { + _old: { postInstall = '' rm -f $out/LICENSE ''; @@ -2456,7 +2447,7 @@ lib.composeManyExtensions [ ); pytest-django = super.pytest-django.overridePythonAttrs ( - old: { + _old: { postPatch = '' substituteInPlace setup.py --replace "'pytest>=3.6'," "" substituteInPlace setup.py --replace "'pytest>=3.6'" "" @@ -2487,7 +2478,7 @@ lib.composeManyExtensions [ pytest-runner = super.pytest-runner or super.pytestrunner; pytest-pylint = super.pytest-pylint.overridePythonAttrs ( - old: { + _old: { buildInputs = [ self.pytest-runner ]; } ); @@ -2514,7 +2505,7 @@ lib.composeManyExtensions [ }); python-jose = super.python-jose.overridePythonAttrs ( - old: { + _old: { buildInputs = [ self.pytest-runner ]; } ); @@ -2536,7 +2527,7 @@ lib.composeManyExtensions [ ); python-pam = super.python-pam.overridePythonAttrs ( - old: { + _old: { postPatch = '' substituteInPlace src/pam/__internals.py \ --replace 'find_library("pam")' '"${pkgs.pam}/lib/libpam.so"' \ @@ -2573,7 +2564,7 @@ lib.composeManyExtensions [ } ); - pyudev = super.pyudev.overridePythonAttrs (old: { + pyudev = super.pyudev.overridePythonAttrs (_old: { postPatch = '' substituteInPlace src/pyudev/_ctypeslib/utils.py \ --replace "find_library(name)" "'${lib.getLib pkgs.systemd}/lib/libudev.so'" @@ -2581,7 +2572,7 @@ lib.composeManyExtensions [ }); pyusb = super.pyusb.overridePythonAttrs ( - old: { + _old: { postPatch = '' libusb=${pkgs.libusb1.out}/lib/libusb-1.0${pkgs.stdenv.hostPlatform.extensions.sharedLibrary} test -f $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; } @@ -2617,7 +2608,7 @@ lib.composeManyExtensions [ ); rockset = super.rockset.overridePythonAttrs ( - old: { + _old: { postPatch = '' cp ./setup_rockset.py ./setup.py ''; @@ -2625,7 +2616,7 @@ lib.composeManyExtensions [ ); scaleapi = super.scaleapi.overridePythonAttrs ( - old: { + _old: { postPatch = '' substituteInPlace setup.py --replace "install_requires = ['requests>=2.4.2', 'enum34']" "install_requires = ['requests>=2.4.2']" || true ''; @@ -2868,7 +2859,7 @@ lib.composeManyExtensions [ }); - soundfile = super.soundfile.overridePythonAttrs (old: { + soundfile = super.soundfile.overridePythonAttrs (_old: { postPatch = '' substituteInPlace soundfile.py --replace "_find_library('sndfile')" "'${pkgs.libsndfile.out}/lib/libsndfile${stdenv.hostPlatform.extensions.sharedLibrary}'" ''; @@ -2885,7 +2876,7 @@ lib.composeManyExtensions [ ]; }); - suds = super.suds.overridePythonAttrs (old: { + suds = super.suds.overridePythonAttrs (_old: { # Fix naming convention shenanigans. # https://github.com/suds-community/suds/blob/a616d96b070ca119a532ff395d4a2a2ba42b257c/setup.py#L648 SUDS_PACKAGE = "suds"; @@ -2937,7 +2928,7 @@ lib.composeManyExtensions [ ); tensorflow = super.tensorflow.overridePythonAttrs ( - old: { + _old: { postInstall = '' rm $out/bin/tensorboard ''; @@ -2945,13 +2936,13 @@ lib.composeManyExtensions [ ); tensorflow-macos = super.tensorflow-macos.overridePythonAttrs ( - old: { - postInstall = self.tensorflow.postInstall; + _old: { + inherit (self.tensorflow) postInstall; } ); tensorpack = super.tensorpack.overridePythonAttrs ( - old: { + _old: { postPatch = '' substituteInPlace setup.cfg --replace "# will call find_packages()" "" ''; @@ -3015,7 +3006,7 @@ lib.composeManyExtensions [ ); vose-alias-method = super.vose-alias-method.overridePythonAttrs ( - old: { + _old: { postInstall = '' rm -f $out/LICENSE ''; @@ -3292,7 +3283,7 @@ lib.composeManyExtensions [ buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools-scm-git-archive ]; }); - setuptools-scm = super.setuptools-scm.overridePythonAttrs (old: { + setuptools-scm = super.setuptools-scm.overridePythonAttrs (_old: { setupHook = pkgs.writeText "setuptools-scm-setup-hook.sh" '' poetry2nix-setuptools-scm-hook() { if [ -z "''${dontPretendSetuptoolsSCMVersion-}" ]; then @@ -3350,7 +3341,7 @@ lib.composeManyExtensions [ ''; }); - meson-python = super.meson-python.overridePythonAttrs (old: { + meson-python = super.meson-python.overridePythonAttrs (_old: { dontUseMesonConfigure = true; }); diff --git a/pep508.nix b/pep508.nix index c9cef28fe..65c6a49c6 100644 --- a/pep508.nix +++ b/pep508.nix @@ -46,24 +46,22 @@ let findSubExpressionsFun { exprs = [ ]; - expr = expr; + inherit expr; pos = 0; openP = 0; exprPos = 0; startPos = 0; } (lib.stringToCharacters expr); - tailExpr = (substr acc.exprPos acc.pos expr); + tailExpr = substr acc.exprPos acc.pos expr; tailExprs = if tailExpr != "" then [ tailExpr ] else [ ]; in acc.exprs ++ tailExprs; parseExpressions = exprs: let - splitCond = ( - s: builtins.map - (x: stripStr (if builtins.typeOf x == "list" then (builtins.elemAt x 0) else x)) - (builtins.split " (and|or) " (s + " ")) - ); + splitCond = s: builtins.map + (x: stripStr (if builtins.typeOf x == "list" then (builtins.elemAt x 0) else x)) + (builtins.split " (and|or) " (s + " ")); mapfn = expr: ( if (builtins.match "^ ?$" expr != null) then null # Filter empty else if (builtins.elem expr [ "and" "or" ]) then { @@ -88,31 +86,26 @@ let transformExpressions = exprs: let variables = { - os_name = ( + os_name = if python.pname == "jython" then "java" - else "posix" - ); - sys_platform = ( + else "posix"; + sys_platform = if stdenv.isLinux then "linux" else if stdenv.isDarwin then "darwin" - else throw "Unsupported platform" - ); + else throw "Unsupported platform"; platform_machine = targetMachine; platform_python_implementation = let impl = python.passthru.implementation; in - ( - if impl == "cpython" then "CPython" - else if impl == "pypy" then "PyPy" - else throw "Unsupported implementation ${impl}" - ); + if impl == "cpython" then "CPython" + else if impl == "pypy" then "PyPy" + else throw "Unsupported implementation ${impl}"; platform_release = ""; # Field not reproducible - platform_system = ( + platform_system = if stdenv.isLinux then "Linux" else if stdenv.isDarwin then "Darwin" - else throw "Unsupported platform" - ); + else throw "Unsupported platform"; platform_version = ""; # Field not reproducible python_version = python.passthru.pythonVersion; python_full_version = python.version; @@ -159,9 +152,8 @@ let else if v == "False" then false else builtins.fromJSON v ); - hasElem = needle: haystack: builtins.elem needle (builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " haystack)); op = { - "true" = x: y: true; + "true" = _x: _y: true; "<=" = x: y: op.">=" y x; "<" = x: y: lib.versionOlder (unmarshal x) (unmarshal y); "!=" = x: y: x != y; @@ -192,7 +184,7 @@ let ( let expr = exprs; - result = (op."${expr.value.op}") (builtins.elemAt expr.value.values 0) (builtins.elemAt expr.value.values 1); + result = op."${expr.value.op}" (builtins.elemAt expr.value.values 0) (builtins.elemAt expr.value.values 1); in { type = "value"; diff --git a/plugins.nix b/plugins.nix index 1c78904b6..43d1b3a3e 100644 --- a/plugins.nix +++ b/plugins.nix @@ -11,7 +11,7 @@ let , buildInputs ? [ ] }: let - env = self.python.withPackages (ps: plugins); + env = self.python.withPackages (_ps: plugins); in stdenv.mkDerivation { pname = drv.pname + "-with-plugins"; diff --git a/semver.nix b/semver.nix index 0ef1d4c31..186472dc0 100644 --- a/semver.nix +++ b/semver.nix @@ -63,21 +63,19 @@ let # There is also an infix operator to match ranges mIn = match "${re.version} *(-) *${re.version}" constraintStr; in - ( - if mPre != null then { - op = elemAt mPre 0; - v = elemAt mPre 1; - } - # Infix operators are range matches - else if mIn != null then { - op = elemAt mIn 1; - v = { - vl = (elemAt mIn 0); - vu = (elemAt mIn 2); - }; - } - else throw "Constraint \"${constraintStr}\" could not be parsed" - ); + if mPre != null then { + op = elemAt mPre 0; + v = elemAt mPre 1; + } + # Infix operators are range matches + else if mIn != null then { + op = elemAt mIn 1; + v = { + vl = elemAt mIn 0; + vu = elemAt mIn 2; + }; + } + else throw "Constraint \"${constraintStr}\" could not be parsed"; satisfiesSemver = version: constraint: let inherit (parseConstraint constraint) op v; diff --git a/tests/aiopath/default.nix b/tests/aiopath/default.nix index e52efe278..6697d5db7 100644 --- a/tests/aiopath/default.nix +++ b/tests/aiopath/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/awscli/default.nix b/tests/awscli/default.nix index 3aaf55a32..073a384b8 100644 --- a/tests/awscli/default.nix +++ b/tests/awscli/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, runCommand }: +{ poetry2nix, runCommand }: poetry2nix.mkPoetryApplication { projectDir = ./.; } diff --git a/tests/canonical-module-names/default.nix b/tests/canonical-module-names/default.nix index 3bc9807d1..e127110a4 100644 --- a/tests/canonical-module-names/default.nix +++ b/tests/canonical-module-names/default.nix @@ -10,9 +10,9 @@ poetry2nix.mkPoetryApplication { poetry2nix.defaultPoetryOverrides (import ./poetry-git-overlay.nix { inherit pkgs; }) ( - self: super: { + _self: super: { pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs ( - old: { + _old: { postPatch = '' touch LICENSE substituteInPlace setup.py --replace 'setup_requires=["pytest-runner"],' "" diff --git a/tests/canonical-module-names/poetry-git-overlay.nix b/tests/canonical-module-names/poetry-git-overlay.nix index 902f16198..e54e460c2 100644 --- a/tests/canonical-module-names/poetry-git-overlay.nix +++ b/tests/canonical-module-names/poetry-git-overlay.nix @@ -1,5 +1,5 @@ { pkgs }: -self: super: { +_self: super: { pyramid-deferred-sqla = super.pyramid-deferred-sqla.overridePythonAttrs ( _: { diff --git a/tests/cffi-pandas-wheel/default.nix b/tests/cffi-pandas-wheel/default.nix index 106c09d58..ec959420d 100644 --- a/tests/cffi-pandas-wheel/default.nix +++ b/tests/cffi-pandas-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/composable-defaults/default.nix b/tests/composable-defaults/default.nix index 938bd89ef..cceb0eea3 100644 --- a/tests/composable-defaults/default.nix +++ b/tests/composable-defaults/default.nix @@ -1,10 +1,10 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: let - p2nix = poetry2nix.overrideScope' (self: super: { + p2nix = poetry2nix.overrideScope' (_self: super: { - defaultPoetryOverrides = (super.defaultPoetryOverrides.extend (pyself: pysuper: { - my-custom-pkg = super.my-custom-pkg.overridePythonAttrs (oldAttrs: { }); - })); + defaultPoetryOverrides = super.defaultPoetryOverrides.extend (_pyself: _pysuper: { + my-custom-pkg = super.my-custom-pkg.overridePythonAttrs (_oldAttrs: { }); + }); }); @@ -12,7 +12,7 @@ in p2nix.mkPoetryApplication { python = python3; projectDir = ./.; - overrides = p2nix.overrides.withDefaults (self: super: { - customjox = super.customjox; + overrides = p2nix.overrides.withDefaults (_self: super: { + inherit (super) customjox; }); } diff --git a/tests/dependency-environment/default.nix b/tests/dependency-environment/default.nix index 6a15cb59b..e800360da 100644 --- a/tests/dependency-environment/default.nix +++ b/tests/dependency-environment/default.nix @@ -8,11 +8,9 @@ let }; # Test support for overriding the app passed to the environment - overridden = ( - app.overrideAttrs (old: { - name = "${old.pname}-overridden-${old.version}"; - }) - ); + overridden = app.overrideAttrs (old: { + name = "${old.pname}-overridden-${old.version}"; + }); depEnv = app.dependencyEnv.override { app = overridden; }; diff --git a/tests/dependency-groups/default.nix b/tests/dependency-groups/default.nix index dee8c804f..91f910624 100644 --- a/tests/dependency-groups/default.nix +++ b/tests/dependency-groups/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand, writeText }: +{ poetry2nix, runCommand, writeText }: let env = poetry2nix.mkPoetryEnv { diff --git a/tests/duckdb-wheel/default.nix b/tests/duckdb-wheel/default.nix index 37a0e1212..98ff452fc 100644 --- a/tests/duckdb-wheel/default.nix +++ b/tests/duckdb-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/editable-egg/default.nix b/tests/editable-egg/default.nix index 044a37a1b..7636b798e 100644 --- a/tests/editable-egg/default.nix +++ b/tests/editable-egg/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand, curl }: +{ poetry2nix, python3, runCommand, curl }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/editable/default.nix b/tests/editable/default.nix index 0b6abd49e..7d2c01b56 100644 --- a/tests/editable/default.nix +++ b/tests/editable/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/env/default.nix b/tests/env/default.nix index bb5973068..d341dfc21 100644 --- a/tests/env/default.nix +++ b/tests/env/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/fancycompleter-wheel/default.nix b/tests/fancycompleter-wheel/default.nix index f1fad260e..6a999c65c 100644 --- a/tests/fancycompleter-wheel/default.nix +++ b/tests/fancycompleter-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/fastapi-utils/default.nix b/tests/fastapi-utils/default.nix index a3eb53251..a88cfa4bf 100644 --- a/tests/fastapi-utils/default.nix +++ b/tests/fastapi-utils/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/fiona-wheel/default.nix b/tests/fiona-wheel/default.nix index 343fbcf6b..724382123 100644 --- a/tests/fiona-wheel/default.nix +++ b/tests/fiona-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/git-deps-pinned/poetry-git-overlay.nix b/tests/git-deps-pinned/poetry-git-overlay.nix index 8c9c86b4e..75ead0ff9 100644 --- a/tests/git-deps-pinned/poetry-git-overlay.nix +++ b/tests/git-deps-pinned/poetry-git-overlay.nix @@ -1,5 +1,5 @@ { pkgs }: -self: super: { +_self: super: { alembic = super.alembic.overridePythonAttrs ( _: { diff --git a/tests/grpcio-wheel/default.nix b/tests/grpcio-wheel/default.nix index 85b33a53e..b5db25770 100644 --- a/tests/grpcio-wheel/default.nix +++ b/tests/grpcio-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, pkgs, runCommand }: +{ poetry2nix, python3, pkgs, runCommand }: let inherit (pkgs.stdenv) isLinux; env = poetry2nix.mkPoetryEnv { @@ -7,7 +7,7 @@ let poetrylock = ./poetry.lock; preferWheels = false; overrides = poetry2nix.overrides.withDefaults ( - self: super: { + _self: super: { grpcio = super.grpcio.override { preferWheel = isLinux; }; diff --git a/tests/in-list/default.nix b/tests/in-list/default.nix index fe8b0d43b..64f496fca 100644 --- a/tests/in-list/default.nix +++ b/tests/in-list/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix }: +{ poetry2nix }: poetry2nix.mkPoetryApplication { projectDir = ./.; diff --git a/tests/jq/default.nix b/tests/jq/default.nix index a89426563..0beabca4a 100644 --- a/tests/jq/default.nix +++ b/tests/jq/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python311, runCommand }: +{ poetry2nix, python311, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python311; diff --git a/tests/legacy/default.nix b/tests/legacy/default.nix index a0797b41d..bc24dc22c 100644 --- a/tests/legacy/default.nix +++ b/tests/legacy/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: poetry2nix.mkPoetryApplication { python = python3; diff --git a/tests/markdown-it-py-wheel/default.nix b/tests/markdown-it-py-wheel/default.nix index 3d8187f96..2786772ca 100644 --- a/tests/markdown-it-py-wheel/default.nix +++ b/tests/markdown-it-py-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, pkgs, runCommand }: +{ poetry2nix, python3, pkgs, runCommand }: let inherit (pkgs.stdenv) isLinux; env = poetry2nix.mkPoetryEnv { @@ -7,7 +7,7 @@ let poetrylock = ./poetry.lock; preferWheels = false; overrides = poetry2nix.overrides.withDefaults ( - self: super: { + _self: super: { markdown-it-py = super.markdown-it-py.override { preferWheel = isLinux; }; diff --git a/tests/markupsafe2/default.nix b/tests/markupsafe2/default.nix index 5bc41cd53..3077ea90c 100644 --- a/tests/markupsafe2/default.nix +++ b/tests/markupsafe2/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/missing-iswheel/default.nix b/tests/missing-iswheel/default.nix index f41ffdb5f..76e676edf 100644 --- a/tests/missing-iswheel/default.nix +++ b/tests/missing-iswheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/mk-poetry-packages/default.nix b/tests/mk-poetry-packages/default.nix index d33b6c585..7be66e73f 100644 --- a/tests/mk-poetry-packages/default.nix +++ b/tests/mk-poetry-packages/default.nix @@ -3,7 +3,7 @@ Note: this test assumes that "certifi" lib is going to be a dep of "requests" in the future. */ -{ lib, poetry2nix, python3, python38 }: +{ poetry2nix, python3, python38 }: let inherit (builtins) elem map; drvPythonCurrent = poetry2nix.mkPoetryPackages { diff --git a/tests/mkdocstrings-wheel/default.nix b/tests/mkdocstrings-wheel/default.nix index e33166885..83d7a1bcb 100644 --- a/tests/mkdocstrings-wheel/default.nix +++ b/tests/mkdocstrings-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/ml-stack/default.nix b/tests/ml-stack/default.nix index 3b1b4d652..50c2d30fa 100644 --- a/tests/ml-stack/default.nix +++ b/tests/ml-stack/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python310, runCommand }: +{ poetry2nix, python310, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python310; @@ -6,7 +6,6 @@ let poetrylock = ./poetry.lock; preferWheels = true; }; - py = env.python; in # Note: torch.cuda() will print False, even if you have a GPU, when this runs *during test.* # But if you run the script below in your shell (rather than during build), it will print True. diff --git a/tests/nbconvert-wheel/default.nix b/tests/nbconvert-wheel/default.nix index 259c37b1c..2750b94cc 100644 --- a/tests/nbconvert-wheel/default.nix +++ b/tests/nbconvert-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/option/default.nix b/tests/option/default.nix index 8e962b6ad..3eba0dc73 100644 --- a/tests/option/default.nix +++ b/tests/option/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/override-default-support/default.nix b/tests/override-default-support/default.nix index 34dc8663c..881898430 100644 --- a/tests/override-default-support/default.nix +++ b/tests/override-default-support/default.nix @@ -1,4 +1,4 @@ -{ lib, python3, poetry2nix, runCommand }: +{ python3, poetry2nix, runCommand }: let p = poetry2nix.mkPoetryApplication { python = python3; @@ -8,21 +8,21 @@ let overrides = [ (( poetry2nix.defaultPoetryOverrides.overrideOverlay ( - self: super: { + _self: super: { alembic = super.alembic.overridePythonAttrs ( - old: { + _old: { TESTING_FOOBAR = 42; } ); } ) - ).extend (pyself: pysuper: { })) # Test .extend for good measure + ).extend (_pyself: _pysuper: { })) # Test .extend for good measure ]; }; in runCommand "test" { } '' - x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)} + x=${builtins.toString p.python.pkgs.alembic.TESTING_FOOBAR} [ "$x" = "42" ] || exit 1 mkdir $out '' diff --git a/tests/override-support/default.nix b/tests/override-support/default.nix index 9116f1875..ad7f5d505 100644 --- a/tests/override-support/default.nix +++ b/tests/override-support/default.nix @@ -1,4 +1,4 @@ -{ lib, python3, poetry2nix, runCommand }: +{ python3, poetry2nix, runCommand }: let p = poetry2nix.mkPoetryApplication { python = python3; @@ -6,9 +6,9 @@ let poetrylock = ./poetry.lock; pyproject = ./pyproject.toml; overrides = poetry2nix.overrides.withDefaults ( - self: super: { + _self: super: { alembic = super.alembic.overridePythonAttrs ( - old: { + _old: { TESTING_FOOBAR = 42; } ); @@ -18,7 +18,7 @@ let in runCommand "test" { } '' - x=${builtins.toString (p.python.pkgs.alembic.TESTING_FOOBAR)} + x=${builtins.toString p.python.pkgs.alembic.TESTING_FOOBAR} [ "$x" = "42" ] || exit 1 mkdir $out '' diff --git a/tests/panel-wheels/default.nix b/tests/panel-wheels/default.nix index b76362f55..cd36af7b6 100644 --- a/tests/panel-wheels/default.nix +++ b/tests/panel-wheels/default.nix @@ -11,7 +11,7 @@ let pyproject = ./pyproject.toml; poetrylock = ./poetry.lock; overrides = poetry2nix.overrides.withDefaults ( - self: super: { + _self: super: { bokeh = super.bokeh.override { preferWheel = true; }; diff --git a/tests/path-deps-develop/default.nix b/tests/path-deps-develop/default.nix index e3ed7c077..e0ab87e9f 100644 --- a/tests/path-deps-develop/default.nix +++ b/tests/path-deps-develop/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { diff --git a/tests/pendulum/default.nix b/tests/pendulum/default.nix index e2b52c646..50b906458 100644 --- a/tests/pendulum/default.nix +++ b/tests/pendulum/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, runCommand, python38 }: +{ lib, poetry2nix, python38 }: poetry2nix.mkPoetryApplication { pyproject = ./pyproject.toml; poetrylock = ./poetry.lock; diff --git a/tests/pep425/default.nix b/tests/pep425/default.nix index fd5090f2b..823b6132d 100644 --- a/tests/pep425/default.nix +++ b/tests/pep425/default.nix @@ -1,4 +1,4 @@ -{ writeText, stdenv, lib, pep425, pep425OSX, pep425PythonOldest }: +{ lib, pep425, pep425OSX, pep425PythonOldest }: lib.debug.runTests { @@ -14,7 +14,7 @@ lib.debug.runTests { ]; in { - expr = (pep425.selectWheel cs); + expr = pep425.selectWheel cs; expected = [{ file = "grpcio-1.25.0-cp27-cp27m-manylinux2010_x86_64.whl"; }]; }; @@ -26,7 +26,7 @@ lib.debug.runTests { ]; in { - expr = (pep425OSX.selectWheel cs); + expr = pep425OSX.selectWheel cs; expected = [{ file = "grpcio-1.25.0-cp27-cp27m-macosx_10_10_x86_64.whl"; }]; }; @@ -42,7 +42,7 @@ lib.debug.runTests { ]; in { - expr = (pep425PythonOldest.selectWheel cs); + expr = pep425PythonOldest.selectWheel cs; expected = [{ file = "grpcio-1.25.0-cp37-cp37m-manylinux2010_x86_64.whl"; }]; }; @@ -54,7 +54,7 @@ lib.debug.runTests { ]; in { - expr = (pep425OSX.selectWheel cs); + expr = pep425OSX.selectWheel cs; expected = [{ file = "grpcio-1.25.0-cp27-cp27m-macosx_10_12_x86_64.whl"; }]; }; @@ -66,7 +66,7 @@ lib.debug.runTests { ]; in { - expr = (pep425OSX.selectWheel cs); + expr = pep425OSX.selectWheel cs; expected = [ ]; }; @@ -78,7 +78,7 @@ lib.debug.runTests { ]; in { - expr = (pep425.selectWheel cs); + expr = pep425.selectWheel cs; expected = [{ file = "grpcio-1.25.0-cp27-cp27m-manylinux1_x86_64.whl"; }]; }; @@ -90,7 +90,7 @@ lib.debug.runTests { ]; in { - expr = (pep425.selectWheel cs); + expr = pep425.selectWheel cs; expected = [ ]; }; diff --git a/tests/pep600/default.nix b/tests/pep600/default.nix index c12be85ae..cc06b4761 100644 --- a/tests/pep600/default.nix +++ b/tests/pep600/default.nix @@ -1,12 +1,12 @@ -{ lib, poetry2nix, python38, runCommand }: +{ poetry2nix, python38, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python38; preferWheels = true; pyproject = ./pyproject.toml; poetrylock = ./poetry.lock; - overrides = poetry2nix.overrides.withDefaults (self: super: { - threadpoolctl = super.threadpoolctl.overridePythonAttrs (old: { + overrides = poetry2nix.overrides.withDefaults (_self: super: { + threadpoolctl = super.threadpoolctl.overridePythonAttrs (_old: { format = "wheel"; }); }); diff --git a/tests/prefer-wheel/default.nix b/tests/prefer-wheel/default.nix index 6d8d7624f..942fc1f8e 100644 --- a/tests/prefer-wheel/default.nix +++ b/tests/prefer-wheel/default.nix @@ -7,11 +7,11 @@ let overrides = poetry2nix.overrides.withDefaults # This is also in overrides.nix but repeated for completeness ( - self: super: { + _self: super: { maturin = super.maturin.override { preferWheel = true; }; - funcy = super.funcy.overridePythonAttrs (old: { + funcy = super.funcy.overridePythonAttrs (_old: { preferWheel = true; }); } diff --git a/tests/prefer-wheels/default.nix b/tests/prefer-wheels/default.nix index bfa01e6c2..fd77d197f 100644 --- a/tests/prefer-wheels/default.nix +++ b/tests/prefer-wheels/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let py = poetry2nix.mkPoetryPackages { python = python3; diff --git a/tests/pyarrow-wheel/default.nix b/tests/pyarrow-wheel/default.nix index 4262ca212..b23a92c34 100644 --- a/tests/pyarrow-wheel/default.nix +++ b/tests/pyarrow-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/pytesseract/default.nix b/tests/pytesseract/default.nix index ecfb87566..ecd3c08fa 100644 --- a/tests/pytesseract/default.nix +++ b/tests/pytesseract/default.nix @@ -6,7 +6,6 @@ let poetrylock = ./poetry.lock; preferWheels = true; }; - py = env.python; in runCommand "pytesseract-test" { } '' ${env}/bin/python -c 'import pytesseract; print(pytesseract.get_tesseract_version())' > $out diff --git a/tests/pytest-randomly/default.nix b/tests/pytest-randomly/default.nix index ed15669a0..9b0f96e90 100644 --- a/tests/pytest-randomly/default.nix +++ b/tests/pytest-randomly/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python39, runCommand }: +{ poetry2nix, python39, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python39; diff --git a/tests/returns/default.nix b/tests/returns/default.nix index da13d3b71..59a51a476 100644 --- a/tests/returns/default.nix +++ b/tests/returns/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/rpds-py-no-wheel/default.nix b/tests/rpds-py-no-wheel/default.nix index bf44026fd..be0f6f974 100644 --- a/tests/rpds-py-no-wheel/default.nix +++ b/tests/rpds-py-no-wheel/default.nix @@ -1,6 +1,5 @@ { poetry2nix, python3, pkgs }: let - inherit (pkgs.stdenv) isLinux; env = poetry2nix.mkPoetryEnv { python = python3; pyproject = ./pyproject.toml; diff --git a/tests/shandy-sqlfmt/default.nix b/tests/shandy-sqlfmt/default.nix index d56c850a0..ca83bf909 100644 --- a/tests/shandy-sqlfmt/default.nix +++ b/tests/shandy-sqlfmt/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/shapely-wheel/default.nix b/tests/shapely-wheel/default.nix index 3bc045f92..6352f48a3 100644 --- a/tests/shapely-wheel/default.nix +++ b/tests/shapely-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/source-filter/default.nix b/tests/source-filter/default.nix index 82b4a31fa..3ba0990ba 100644 --- a/tests/source-filter/default.nix +++ b/tests/source-filter/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: poetry2nix.mkPoetryApplication { python = python3; diff --git a/tests/textual-dev/default.nix b/tests/textual-dev/default.nix index e0e1b0afc..b490b065c 100644 --- a/tests/textual-dev/default.nix +++ b/tests/textual-dev/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/textual-textarea/default.nix b/tests/textual-textarea/default.nix index 77c6cc4d2..91343cd5e 100644 --- a/tests/textual-textarea/default.nix +++ b/tests/textual-textarea/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/trivial-poetry-1_2_0/default.nix b/tests/trivial-poetry-1_2_0/default.nix index e1b305604..0b4ee1ddc 100644 --- a/tests/trivial-poetry-1_2_0/default.nix +++ b/tests/trivial-poetry-1_2_0/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, runCommand }: let diff --git a/tests/trivial/default.nix b/tests/trivial/default.nix index a0797b41d..bc24dc22c 100644 --- a/tests/trivial/default.nix +++ b/tests/trivial/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3 }: +{ poetry2nix, python3 }: poetry2nix.mkPoetryApplication { python = python3; diff --git a/tests/ubersmith/default.nix b/tests/ubersmith/default.nix index 3695f6052..049f0b952 100644 --- a/tests/ubersmith/default.nix +++ b/tests/ubersmith/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3; diff --git a/tests/utf8-pyproject/default.nix b/tests/utf8-pyproject/default.nix index 967c36175..44a136e0a 100644 --- a/tests/utf8-pyproject/default.nix +++ b/tests/utf8-pyproject/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python39 }: +{ poetry2nix, python39 }: poetry2nix.mkPoetryApplication { python = python39; diff --git a/tests/wheel-wheel/default.nix b/tests/wheel-wheel/default.nix index 6d02710c0..70eec4edd 100644 --- a/tests/wheel-wheel/default.nix +++ b/tests/wheel-wheel/default.nix @@ -1,4 +1,4 @@ -{ lib, poetry2nix, python3, runCommand }: +{ poetry2nix, python3, runCommand }: let env = poetry2nix.mkPoetryEnv { python = python3;