summary refs log tree commit diff
path: root/pkgs/development/tools/poetry2nix/poetry2nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/poetry2nix/poetry2nix')
-rwxr-xr-xpkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix17
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/cli.nix2
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/default.nix297
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix1
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/lib.nix107
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix15
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix266
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix3
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix359
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/semver.nix109
10 files changed, 603 insertions, 573 deletions
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix b/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix
index 95576b987f5..355cebfd50c 100755
--- a/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix
@@ -8,11 +8,16 @@ import json
 import sys
 
 
-argparser = argparse.ArgumentParser(description="Generate overrides for git hashes",)
-argparser.add_argument(
+argparser = argparse.ArgumentParser(description="Poetry2nix CLI")
+
+subparsers = argparser.add_subparsers(dest="subcommand")
+subparsers.required = True
+
+parser_lock = subparsers.add_parser("lock", help="Generate overrides for git hashes",)
+parser_lock.add_argument(
     "--lock", default="poetry.lock", help="Path to input poetry.lock",
 )
-argparser.add_argument(
+parser_lock.add_argument(
     "--out", default="poetry-git-overlay.nix", help="Output file",
 )
 
@@ -74,7 +79,7 @@ if __name__ == "__main__":
                 indent(
                     textwrap.dedent(
                         """
-              %s = super.%s.overrideAttrs (
+              %s = super.%s.overridePythonAttrs (
                 _: {
                   src = pkgs.fetchgit {
                     url = "%s";
@@ -92,7 +97,7 @@ if __name__ == "__main__":
 
         expr = "\n".join(lines)
 
-    with open(args.out, "w") as f:
-        f.write(expr)
+    with open(args.out, "w") as fout:
+        fout.write(expr)
 
     print(f"Wrote {args.out}")
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/cli.nix b/pkgs/development/tools/poetry2nix/poetry2nix/cli.nix
index db85d4ddd3c..fbcee749b7c 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/cli.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/cli.nix
@@ -2,10 +2,8 @@
 , lib ? pkgs.lib
 , version
 }:
-
 let
   inherit (pkgs) python3;
-
 in
 pkgs.stdenv.mkDerivation {
   pname = "poetry2nix";
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/default.nix
index 7d3164fcec6..e7f718519a5 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/default.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/default.nix
@@ -7,7 +7,7 @@ let
   inherit (poetryLib) isCompatible readTOML;
 
   # Poetry2nix version
-  version = "1.6.0";
+  version = "1.7.1";
 
   /* The default list of poetry2nix override overlays */
   defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; });
@@ -34,91 +34,95 @@ let
     , overrides ? [ defaultPoetryOverrides ]
     , python ? pkgs.python3
     , pwd ? projectDir
-    }@attrs: let
-      poetryPkg = poetry.override { inherit python; };
-
-      pyProject = readTOML pyproject;
-      poetryLock = readTOML poetrylock;
-      lockFiles = lib.getAttrFromPath [ "metadata" "files" ] poetryLock;
+    }@attrs:
+      let
+        poetryPkg = poetry.override { inherit python; };
 
-      specialAttrs = [
-        "overrides"
-        "poetrylock"
-        "pwd"
-      ];
-      passedAttrs = builtins.removeAttrs attrs specialAttrs;
+        pyProject = readTOML pyproject;
+        poetryLock = readTOML poetrylock;
+        lockFiles = lib.getAttrFromPath [ "metadata" "files" ] poetryLock;
 
-      evalPep508 = mkEvalPep508 python;
+        specialAttrs = [
+          "overrides"
+          "poetrylock"
+          "projectDir"
+          "pwd"
+        ];
+        passedAttrs = builtins.removeAttrs attrs specialAttrs;
 
-      # Filter packages by their PEP508 markers & pyproject interpreter version
-      partitions = let
-        supportsPythonVersion = pkgMeta: if pkgMeta ? marker then (evalPep508 pkgMeta.marker) else true;
-      in
-        lib.partition supportsPythonVersion poetryLock.package;
+        evalPep508 = mkEvalPep508 python;
 
-      compatible = partitions.right;
-      incompatible = partitions.wrong;
+        # Filter packages by their PEP508 markers & pyproject interpreter version
+        partitions = let
+          supportsPythonVersion = pkgMeta: if pkgMeta ? marker then (evalPep508 pkgMeta.marker) else true;
+        in
+          lib.partition supportsPythonVersion poetryLock.package;
+
+        compatible = partitions.right;
+        incompatible = partitions.wrong;
+
+        # Create an overriden version of pythonPackages
+        #
+        # We need to avoid mixing multiple versions of pythonPackages in the same
+        # closure as python can only ever have one version of a dependency
+        baseOverlay = self: super:
+          let
+            getDep = depName: self.${depName};
+
+            lockPkgs = builtins.listToAttrs (
+              builtins.map (
+                pkgMeta: rec {
+                  name = pkgMeta.name;
+                  value = self.mkPoetryDep (
+                    pkgMeta // {
+                      inherit pwd;
+                      source = pkgMeta.source or null;
+                      files = lockFiles.${name};
+                      pythonPackages = self;
+                      sourceSpec = pyProject.tool.poetry.dependencies.${name} or pyProject.tool.poetry.dev-dependencies.${name};
+                    }
+                  );
+                }
+              ) compatible
+            );
+          in
+            lockPkgs;
+        overlays = builtins.map getFunctorFn (
+          [
+            (
+              self: super:
+                let
+                  hooks = self.callPackage ./hooks {};
+                in
+                  {
+                    mkPoetryDep = self.callPackage ./mk-poetry-dep.nix {
+                      inherit pkgs lib python poetryLib;
+                    };
+                    poetry = poetryPkg;
+                    # The canonical name is setuptools-scm
+                    setuptools-scm = super.setuptools_scm;
+
+                    inherit (hooks) removePathDependenciesHook poetry2nixFixupHook;
+                  }
+            )
+            # Null out any filtered packages, we don't want python.pkgs from nixpkgs
+            (self: super: builtins.listToAttrs (builtins.map (x: { name = x.name; value = null; }) incompatible))
+            # Create poetry2nix layer
+            baseOverlay
+          ] ++ # User provided overrides
+          overrides
+        );
 
-      # Create an overriden version of pythonPackages
-      #
-      # We need to avoid mixing multiple versions of pythonPackages in the same
-      # closure as python can only ever have one version of a dependency
-      baseOverlay = self: super:
-        let
-          getDep = depName: self.${depName};
+        packageOverrides = lib.foldr lib.composeExtensions (self: super: {}) overlays;
 
-          lockPkgs = builtins.listToAttrs (
-            builtins.map (
-              pkgMeta: rec {
-                name = pkgMeta.name;
-                value = self.mkPoetryDep (
-                  pkgMeta // {
-                    inherit pwd;
-                    source = pkgMeta.source or null;
-                    files = lockFiles.${name};
-                    pythonPackages = self;
-                  }
-                );
-              }
-            ) compatible
-          );
-        in
-          lockPkgs;
-      overlays = builtins.map getFunctorFn (
-        [
-          (
-            self: super: let
-              hooks = self.callPackage ./hooks {};
-            in
-              {
-                mkPoetryDep = self.callPackage ./mk-poetry-dep.nix {
-                  inherit pkgs lib python poetryLib;
-                };
-                poetry = poetryPkg;
-                # The canonical name is setuptools-scm
-                setuptools-scm = super.setuptools_scm;
-
-                inherit (hooks) removePathDependenciesHook poetry2nixFixupHook;
-              }
-          )
-          # Null out any filtered packages, we don't want python.pkgs from nixpkgs
-          (self: super: builtins.listToAttrs (builtins.map (x: { name = x.name; value = null; }) incompatible))
-          # Create poetry2nix layer
-          baseOverlay
-        ] ++ # User provided overrides
-        overrides
-      );
-
-      packageOverrides = lib.foldr lib.composeExtensions (self: super: {}) overlays;
-
-      py = python.override { inherit packageOverrides; self = py; };
-    in
-      {
-        python = py;
-        poetryPackages = map (pkg: py.pkgs.${pkg.name}) compatible;
-        poetryLock = poetryLock;
-        inherit pyProject;
-      };
+        py = python.override { inherit packageOverrides; self = py; };
+      in
+        {
+          python = py;
+          poetryPackages = map (pkg: py.pkgs.${pkg.name}) compatible;
+          poetryLock = poetryLock;
+          inherit pyProject;
+        };
 
   /* Returns a package with a python interpreter and all packages specified in the poetry.lock lock file.
 
@@ -153,76 +157,78 @@ let
     , python ? pkgs.python3
     , pwd ? projectDir
     , ...
-    }@attrs: let
-      poetryPython = mkPoetryPackages {
-        inherit pyproject poetrylock overrides python pwd;
-      };
-      py = poetryPython.python;
-
-      inherit (poetryPython) pyProject;
-
-      specialAttrs = [
-        "overrides"
-        "poetrylock"
-        "pwd"
-        "pyproject"
-      ];
-      passedAttrs = builtins.removeAttrs attrs specialAttrs;
-
-      # Get dependencies and filter out depending on interpreter version
-      getDeps = depAttr: let
-        compat = isCompatible py.pythonVersion;
-        deps = pyProject.tool.poetry.${depAttr} or {};
-        depAttrs = builtins.map (d: lib.toLower d) (builtins.attrNames deps);
-      in
-        builtins.map (
-          dep: let
-            pkg = py.pkgs."${dep}";
-            constraints = deps.${dep}.python or "";
-            isCompat = compat constraints;
+    }@attrs:
+      let
+        poetryPython = mkPoetryPackages {
+          inherit pyproject poetrylock overrides python pwd;
+        };
+        py = poetryPython.python;
+
+        inherit (poetryPython) pyProject;
+
+        specialAttrs = [
+          "overrides"
+          "poetrylock"
+          "projectDir"
+          "pwd"
+          "pyproject"
+        ];
+        passedAttrs = builtins.removeAttrs attrs specialAttrs;
+
+        # Get dependencies and filter out depending on interpreter version
+        getDeps = depAttr:
+          let
+            compat = isCompatible py.pythonVersion;
+            deps = pyProject.tool.poetry.${depAttr} or {};
+            depAttrs = builtins.map (d: lib.toLower d) (builtins.attrNames deps);
           in
-            if isCompat then pkg else null
-        ) depAttrs;
-
-      getInputs = attr: attrs.${attr} or [];
-      mkInput = attr: extraInputs: getInputs attr ++ extraInputs;
-
-      buildSystemPkgs = poetryLib.getBuildSystemPkgs {
-        inherit pyProject;
-        pythonPackages = py.pkgs;
-      };
-
-    in
-      py.pkgs.buildPythonApplication (
-        passedAttrs // {
-          pname = pyProject.tool.poetry.name;
-          version = pyProject.tool.poetry.version;
+            builtins.map (
+              dep:
+                let
+                  pkg = py.pkgs."${dep}";
+                  constraints = deps.${dep}.python or "";
+                  isCompat = compat constraints;
+                in
+                  if isCompat then pkg else null
+            ) depAttrs;
+
+        getInputs = attr: attrs.${attr} or [];
+        mkInput = attr: extraInputs: getInputs attr ++ extraInputs;
+
+        buildSystemPkgs = poetryLib.getBuildSystemPkgs {
+          inherit pyProject;
+          pythonPackages = py.pkgs;
+        };
+      in
+        py.pkgs.buildPythonApplication (
+          passedAttrs // {
+            pname = pyProject.tool.poetry.name;
+            version = pyProject.tool.poetry.version;
 
-          inherit src;
+            inherit src;
 
-          format = "pyproject";
+            format = "pyproject";
 
-          buildInputs = mkInput "buildInputs" buildSystemPkgs;
-          propagatedBuildInputs = mkInput "propagatedBuildInputs" (getDeps "dependencies") ++ ([ py.pkgs.setuptools ]);
-          nativeBuildInputs = mkInput "nativeBuildInputs" [ pkgs.yj py.pkgs.removePathDependenciesHook ];
-          checkInputs = mkInput "checkInputs" (getDeps "dev-dependencies");
+            buildInputs = mkInput "buildInputs" buildSystemPkgs;
+            propagatedBuildInputs = mkInput "propagatedBuildInputs" (getDeps "dependencies") ++ ([ py.pkgs.setuptools ]);
+            nativeBuildInputs = mkInput "nativeBuildInputs" [ pkgs.yj py.pkgs.removePathDependenciesHook ];
+            checkInputs = mkInput "checkInputs" (getDeps "dev-dependencies");
 
-          passthru = {
-            python = py;
-          };
+            passthru = {
+              python = py;
+            };
 
-          meta = meta // {
-            inherit (pyProject.tool.poetry) description homepage;
-            inherit (py.meta) platforms;
-            license = getLicenseBySpdxId (pyProject.tool.poetry.license or "unknown");
-          };
+            meta = meta // {
+              inherit (pyProject.tool.poetry) description homepage;
+              inherit (py.meta) platforms;
+              license = getLicenseBySpdxId (pyProject.tool.poetry.license or "unknown");
+            };
 
-        }
-      );
+          }
+        );
 
   /* Poetry2nix CLI used to supplement SHA-256 hashes for git dependencies  */
   cli = import ./cli.nix { inherit pkgs lib version; };
-
 in
 {
   inherit mkPoetryEnv mkPoetryApplication mkPoetryPackages cli version;
@@ -236,11 +242,12 @@ in
   */
   defaultPoetryOverrides = {
     __functor = defaultPoetryOverrides;
-    overrideOverlay = fn: self: super: let
-      defaultSet = defaultPoetryOverrides self super;
-      customSet = fn self super;
-    in
-      defaultSet // customSet;
+    overrideOverlay = fn: self: super:
+      let
+        defaultSet = defaultPoetryOverrides self super;
+        customSet = fn self super;
+      in
+        defaultSet // customSet;
   };
 
   /*
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix
index ec3fa0afa69..12d2bc96206 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix
@@ -3,7 +3,6 @@
 , makeSetupHook
 , yj
 }:
-
 let
   pythonInterpreter = python.pythonForBuild.interpreter;
 in
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix b/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
index b816feb38e8..f4497afb8bc 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
@@ -9,29 +9,30 @@ let
   );
 
   # Compare a semver expression with a version
-  isCompatible = version: let
-    operators = {
-      "||" = cond1: cond2: cond1 || cond2;
-      "," = cond1: cond2: cond1 && cond2; # , means &&
-      "&&" = cond1: cond2: cond1 && cond2;
-    };
-    splitRe = "(" + (builtins.concatStringsSep "|" (builtins.map (x: lib.replaceStrings [ "|" ] [ "\\|" ] x) (lib.attrNames operators))) + ")";
-  in
-    expr:
-      let
-        tokens = builtins.filter (x: x != "") (builtins.split splitRe expr);
-        combine = acc: v:
-          let
-            isOperator = builtins.typeOf v == "list";
-            operator = if isOperator then (builtins.elemAt v 0) else acc.operator;
-          in
-            if isOperator then (acc // { inherit operator; }) else {
-              inherit operator;
-              state = operators."${operator}" acc.state (satisfiesSemver version v);
-            };
-        initial = { operator = "&&"; state = true; };
-      in
-        if expr == "" then true else (builtins.foldl' combine initial tokens).state;
+  isCompatible = version:
+    let
+      operators = {
+        "||" = cond1: cond2: cond1 || cond2;
+        "," = cond1: cond2: cond1 && cond2; # , means &&
+        "&&" = cond1: cond2: cond1 && cond2;
+      };
+      splitRe = "(" + (builtins.concatStringsSep "|" (builtins.map (x: lib.replaceStrings [ "|" ] [ "\\|" ] x) (lib.attrNames operators))) + ")";
+    in
+      expr:
+        let
+          tokens = builtins.filter (x: x != "") (builtins.split splitRe expr);
+          combine = acc: v:
+            let
+              isOperator = builtins.typeOf v == "list";
+              operator = if isOperator then (builtins.elemAt v 0) else acc.operator;
+            in
+              if isOperator then (acc // { inherit operator; }) else {
+                inherit operator;
+                state = operators."${operator}" acc.state (satisfiesSemver version v);
+              };
+          initial = { operator = "&&"; state = true; };
+        in
+          if expr == "" then true else (builtins.foldl' combine initial tokens).state;
 
   fromTOML = builtins.fromTOML or
     (
@@ -88,23 +89,25 @@ let
   getBuildSystemPkgs =
     { pythonPackages
     , pyProject
-    }: let
-      buildSystem = lib.getAttrFromPath [ "build-system" "build-backend" ] pyProject;
-      drvAttr = builtins.elemAt (builtins.split "\\.|:" buildSystem) 0;
-    in
-      if buildSystem == "" then [] else (
-        [ pythonPackages.${drvAttr} or (throw "unsupported build system ${buildSystem}") ]
-      );
+    }:
+      let
+        buildSystem = lib.getAttrFromPath [ "build-system" "build-backend" ] pyProject;
+        drvAttr = builtins.elemAt (builtins.split "\\.|:" buildSystem) 0;
+      in
+        if buildSystem == "" then [] else (
+          [ pythonPackages.${drvAttr} or (throw "unsupported build system ${buildSystem}") ]
+        );
 
   # Find gitignore files recursively in parent directory stopping with .git
-  findGitIgnores = path: let
-    parent = path + "/..";
-    gitIgnore = path + "/.gitignore";
-    isGitRoot = builtins.pathExists (path + "/.git");
-    hasGitIgnore = builtins.pathExists gitIgnore;
-    gitIgnores = if hasGitIgnore then [ gitIgnore ] else [];
-  in
-    lib.optionals (builtins.toString path != "/" && ! isGitRoot) (findGitIgnores parent) ++ gitIgnores;
+  findGitIgnores = path:
+    let
+      parent = path + "/..";
+      gitIgnore = path + "/.gitignore";
+      isGitRoot = builtins.pathExists (path + "/.git");
+      hasGitIgnore = builtins.pathExists gitIgnore;
+      gitIgnores = if hasGitIgnore then [ gitIgnore ] else [];
+    in
+      lib.optionals (builtins.toString path != "/" && ! isGitRoot) (findGitIgnores parent) ++ gitIgnores;
 
   /*
   Provides a source filtering mechanism that:
@@ -113,21 +116,21 @@ let
   - Filters pycache/pyc files
   - Uses cleanSourceFilter to filter out .git/.hg, .o/.so, editor backup files & nix result symlinks
   */
-  cleanPythonSources = { src }: let
-    gitIgnores = findGitIgnores src;
-    pycacheFilter = name: type:
-      (type == "directory" && ! lib.strings.hasInfix "__pycache__" name)
-      || (type == "regular" && ! lib.strings.hasSuffix ".pyc" name)
-    ;
-  in
-    lib.cleanSourceWith {
-      filter = lib.cleanSourceFilter;
-      src = lib.cleanSourceWith {
-        filter = pkgs.nix-gitignore.gitignoreFilterPure pycacheFilter gitIgnores src;
-        inherit src;
+  cleanPythonSources = { src }:
+    let
+      gitIgnores = findGitIgnores src;
+      pycacheFilter = name: type:
+        (type == "directory" && ! lib.strings.hasInfix "__pycache__" name)
+        || (type == "regular" && ! lib.strings.hasSuffix ".pyc" name)
+      ;
+    in
+      lib.cleanSourceWith {
+        filter = lib.cleanSourceFilter;
+        src = lib.cleanSourceWith {
+          filter = pkgs.nix-gitignore.gitignoreFilterPure pycacheFilter gitIgnores src;
+          inherit src;
+        };
       };
-    };
-
 in
 {
   inherit
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix b/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix
index 5ae35dfed49..5e71190d28f 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix
@@ -14,6 +14,7 @@
 , pythonPackages
 , python-versions
 , pwd
+, sourceSpec
 , supportedExtensions ? lib.importJSON ./extensions.json
 , ...
 }:
@@ -22,9 +23,7 @@ pythonPackages.callPackage (
   { preferWheel ? false
   , ...
   }@args:
-
     let
-
       inherit (poetryLib) isCompatible getManyLinuxDeps fetchFromPypi;
 
       inherit (import ./pep425.nix {
@@ -68,7 +67,6 @@ pythonPackages.callPackage (
         lockFileEntry = builtins.head entries;
 
         _isEgg = isEgg lockFileEntry;
-
       in
         rec {
           inherit (lockFileEntry) file hash;
@@ -92,7 +90,6 @@ pythonPackages.callPackage (
       baseBuildInputs = lib.optional (! lib.elem name skipSetupToolsSCM) pythonPackages.setuptools-scm;
 
       format = if isLocal then "pyproject" else if isGit then "setuptools" else fileInfo.format;
-
     in
 
       buildPythonPackage {
@@ -123,10 +120,11 @@ pythonPackages.callPackage (
           compat = isCompatible python.pythonVersion;
           deps = lib.filterAttrs (n: v: v) (
             lib.mapAttrs (
-              n: v: let
-                constraints = v.python or "";
-              in
-                compat constraints
+              n: v:
+                let
+                  constraints = v.python or "";
+                in
+                  compat constraints
             ) dependencies
           );
           depAttrs = lib.attrNames deps;
@@ -150,6 +148,7 @@ pythonPackages.callPackage (
           builtins.fetchGit {
             inherit (source) url;
             rev = source.reference;
+            ref = sourceSpec.branch or sourceSpec.rev or sourceSpec.tag or "HEAD";
           }
         ) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else fetchFromPypi {
           pname = name;
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
index 9eb3f92bd12..8301dcd49b8 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
@@ -6,14 +6,14 @@
 self: super:
 
 {
-  astroid = super.astroid.overrideAttrs (
+  astroid = super.astroid.overridePythonAttrs (
     old: rec {
       buildInputs = old.buildInputs ++ [ self.pytest-runner ];
       doCheck = false;
     }
   );
 
-  av = super.av.overrideAttrs (
+  av = super.av.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [
         pkgs.pkgconfig
@@ -22,7 +22,7 @@ self: super:
     }
   );
 
-  bcrypt = super.bcrypt.overrideAttrs (
+  bcrypt = super.bcrypt.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ pkgs.libffi ];
     }
@@ -31,14 +31,14 @@ self: super:
   cffi =
     # cffi is bundled with pypy
     if self.python.implementation == "pypy" then null else (
-      super.cffi.overrideAttrs (
+      super.cffi.overridePythonAttrs (
         old: {
           buildInputs = old.buildInputs ++ [ pkgs.libffi ];
         }
       )
     );
 
-  cftime = super.cftime.overrideAttrs (
+  cftime = super.cftime.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [
         self.cython
@@ -46,14 +46,14 @@ self: super:
     }
   );
 
-  cryptography = super.cryptography.overrideAttrs (
+  cryptography = super.cryptography.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ pkgs.openssl ];
     }
   );
 
   django = (
-    super.django.overrideAttrs (
+    super.django.overridePythonAttrs (
       old: {
         propagatedNativeBuildInputs = (old.propagatedNativeBuildInputs or [])
         ++ [ pkgs.gettext ];
@@ -61,7 +61,7 @@ self: super:
     )
   );
 
-  django-bakery = super.django-bakery.overrideAttrs (
+  django-bakery = super.django-bakery.overridePythonAttrs (
     old: {
       configurePhase = ''
         if ! test -e LICENSE; then
@@ -71,7 +71,7 @@ self: super:
     }
   );
 
-  dlib = super.dlib.overrideAttrs (
+  dlib = super.dlib.overridePythonAttrs (
     old: {
       # Parallel building enabled
       inherit (pkgs.python.pkgs.dlib) patches;
@@ -87,14 +87,14 @@ self: super:
   # Environment markers are not always included (depending on how a dep was defined)
   enum34 = if self.pythonAtLeast "3.4" then null else super.enum34;
 
-  faker = super.faker.overrideAttrs (
+  faker = super.faker.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ self.pytest-runner ];
       doCheck = false;
     }
   );
 
-  fancycompleter = super.fancycompleter.overrideAttrs (
+  fancycompleter = super.fancycompleter.overridePythonAttrs (
     old: {
       postPatch = ''
         substituteInPlace setup.py \
@@ -104,14 +104,20 @@ self: super:
     }
   );
 
-  grandalf = super.grandalf.overrideAttrs (
+  fastparquet = super.fastparquet.overridePythonAttrs (
+    old: {
+      buildInputs = old.buildInputs ++ [ self.pytest-runner ];
+    }
+  );
+
+  grandalf = super.grandalf.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ self.pytest-runner ];
       doCheck = false;
     }
   );
 
-  h5py = super.h5py.overrideAttrs (
+  h5py = super.h5py.overridePythonAttrs (
     old: rec {
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
       buildInputs = old.buildInputs ++ [ pkgs.hdf5 self.pkgconfig self.cython ];
@@ -122,20 +128,20 @@ self: super:
     }
   );
 
-  horovod = super.horovod.overrideAttrs (
+  horovod = super.horovod.overridePythonAttrs (
     old: {
       propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.openmpi ];
     }
   );
 
   # importlib-metadata has an incomplete dependency specification
-  importlib-metadata = super.importlib-metadata.overrideAttrs (
+  importlib-metadata = super.importlib-metadata.overridePythonAttrs (
     old: {
       propagatedBuildInputs = old.propagatedBuildInputs ++ lib.optional self.python.isPy2 self.pathlib2;
     }
   );
 
-  jupyter = super.jupyter.overrideAttrs (
+  jupyter = super.jupyter.overridePythonAttrs (
     old: rec {
       # jupyter is a meta-package. Everything relevant comes from the
       # dependencies. It does however have a jupyter.py file that conflicts
@@ -144,7 +150,7 @@ self: super:
     }
   );
 
-  lap = super.lap.overrideAttrs (
+  lap = super.lap.overridePythonAttrs (
     old: {
       propagatedBuildInputs = old.propagatedBuildInputs ++ [
         self.numpy
@@ -152,7 +158,7 @@ self: super:
     }
   );
 
-  llvmlite = super.llvmlite.overrideAttrs (
+  llvmlite = super.llvmlite.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.llvm ];
 
@@ -175,59 +181,59 @@ self: super:
     }
   );
 
-  lockfile = super.lockfile.overrideAttrs (
+  lockfile = super.lockfile.overridePythonAttrs (
     old: {
       propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.pbr ];
     }
   );
 
-  lxml = super.lxml.overrideAttrs (
+  lxml = super.lxml.overridePythonAttrs (
     old: {
       nativeBuildInputs = with pkgs; old.nativeBuildInputs ++ [ pkgconfig libxml2.dev libxslt.dev ];
       buildInputs = with pkgs; old.buildInputs ++ [ libxml2 libxslt ];
     }
   );
 
-  markupsafe = super.markupsafe.overrideAttrs (
+  markupsafe = super.markupsafe.overridePythonAttrs (
     old: {
       src = old.src.override { pname = builtins.replaceStrings [ "markupsafe" ] [ "MarkupSafe" ] old.pname; };
     }
   );
 
-  matplotlib = super.matplotlib.overrideAttrs (
-    old: let
-      enableGhostscript = old.passthru.enableGhostscript or false;
-      enableGtk3 = old.passthru.enableTk or false;
-      enableQt = old.passthru.enableQt or false;
-      enableTk = old.passthru.enableTk or false;
+  matplotlib = super.matplotlib.overridePythonAttrs (
+    old:
+      let
+        enableGhostscript = old.passthru.enableGhostscript or false;
+        enableGtk3 = old.passthru.enableTk or false;
+        enableQt = old.passthru.enableQt or false;
+        enableTk = old.passthru.enableTk or false;
 
-      inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa;
+        inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa;
+      in
+        {
+          NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${pkgs.libcxx}/include/c++/v1";
 
-    in
-      {
-        NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${pkgs.libcxx}/include/c++/v1";
+          XDG_RUNTIME_DIR = "/tmp";
 
-        XDG_RUNTIME_DIR = "/tmp";
+          buildInputs = old.buildInputs
+          ++ lib.optional enableGhostscript pkgs.ghostscript
+          ++ lib.optional stdenv.isDarwin [ Cocoa ];
 
-        buildInputs = old.buildInputs
-        ++ lib.optional enableGhostscript pkgs.ghostscript
-        ++ lib.optional stdenv.isDarwin [ Cocoa ];
-
-        nativeBuildInputs = old.nativeBuildInputs ++ [
-          pkgs.pkgconfig
-        ];
+          nativeBuildInputs = old.nativeBuildInputs ++ [
+            pkgs.pkgconfig
+          ];
 
-        propagatedBuildInputs = old.propagatedBuildInputs ++ [
-          pkgs.libpng
-          pkgs.freetype
-        ]
-        ++ stdenv.lib.optionals enableGtk3 [ pkgs.cairo self.pycairo pkgs.gtk3 pkgs.gobject-introspection self.pygobject3 ]
-        ++ stdenv.lib.optionals enableTk [ pkgs.tcl pkgs.tk self.tkinter pkgs.libX11 ]
-        ++ stdenv.lib.optionals enableQt [ self.pyqt5 ]
-        ;
+          propagatedBuildInputs = old.propagatedBuildInputs ++ [
+            pkgs.libpng
+            pkgs.freetype
+          ]
+          ++ stdenv.lib.optionals enableGtk3 [ pkgs.cairo self.pycairo pkgs.gtk3 pkgs.gobject-introspection self.pygobject3 ]
+          ++ stdenv.lib.optionals enableTk [ pkgs.tcl pkgs.tk self.tkinter pkgs.libX11 ]
+          ++ stdenv.lib.optionals enableQt [ self.pyqt5 ]
+          ;
 
-        inherit (super.matplotlib) patches;
-      }
+          inherit (super.matplotlib) patches;
+        }
   );
 
   # Calls Cargo at build time for source builds and is really tricky to package
@@ -235,14 +241,14 @@ self: super:
     preferWheel = true;
   };
 
-  mccabe = super.mccabe.overrideAttrs (
+  mccabe = super.mccabe.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ self.pytest-runner ];
       doCheck = false;
     }
   );
 
-  netcdf4 = super.netcdf4.overrideAttrs (
+  netcdf4 = super.netcdf4.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [
         self.cython
@@ -265,40 +271,41 @@ self: super:
     }
   );
 
-  numpy = super.numpy.overrideAttrs (
-    old: let
-      blas = old.passthru.args.blas or pkgs.openblasCompat;
-      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 = "";
-            };
-          }
-        );
-      };
-    in
-      {
-        nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gfortran ];
-        buildInputs = old.buildInputs ++ [ blas self.cython ];
-        enableParallelBuilding = true;
-        preBuild = ''
-          ln -s ${cfg} site.cfg
-        '';
-        passthru = old.passthru // {
-          blas = blas;
-          inherit blasImplementation cfg;
+  numpy = super.numpy.overridePythonAttrs (
+    old:
+      let
+        blas = old.passthru.args.blas or pkgs.openblasCompat;
+        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 = "";
+              };
+            }
+          );
         };
-      }
+      in
+        {
+          nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gfortran ];
+          buildInputs = old.buildInputs ++ [ blas self.cython ];
+          enableParallelBuilding = true;
+          preBuild = ''
+            ln -s ${cfg} site.cfg
+          '';
+          passthru = old.passthru // {
+            blas = blas;
+            inherit blasImplementation cfg;
+          };
+        }
   );
 
-  openexr = super.openexr.overrideAttrs (
+  openexr = super.openexr.overridePythonAttrs (
     old: rec {
       buildInputs = old.buildInputs ++ [ pkgs.openexr pkgs.ilmbase ];
       NIX_CFLAGS_COMPILE = [ "-I${pkgs.openexr.dev}/include/OpenEXR" "-I${pkgs.ilmbase.dev}/include/OpenEXR" ];
@@ -306,38 +313,39 @@ self: super:
   );
 
   peewee = super.peewee.overridePythonAttrs (
-    old: let
-      withPostgres = old.passthru.withPostgres or false;
-      withMysql = old.passthru.withMysql or false;
-    in
-      {
-        buildInputs = old.buildInputs ++ [ self.cython pkgs.sqlite ];
-        propagatedBuildInputs = old.propagatedBuildInputs
-        ++ lib.optional withPostgres self.psycopg2
-        ++ lib.optional withMysql self.mysql-connector;
-      }
+    old:
+      let
+        withPostgres = old.passthru.withPostgres or false;
+        withMysql = old.passthru.withMysql or false;
+      in
+        {
+          buildInputs = old.buildInputs ++ [ self.cython pkgs.sqlite ];
+          propagatedBuildInputs = old.propagatedBuildInputs
+          ++ lib.optional withPostgres self.psycopg2
+          ++ lib.optional withMysql self.mysql-connector;
+        }
   );
 
-  pillow = super.pillow.overrideAttrs (
+  pillow = super.pillow.overridePythonAttrs (
     old: {
       nativeBuildInputs = [ pkgs.pkgconfig ] ++ old.nativeBuildInputs;
       buildInputs = with pkgs; [ freetype libjpeg zlib libtiff libwebp tcl lcms2 ] ++ old.buildInputs;
     }
   );
 
-  psycopg2 = super.psycopg2.overrideAttrs (
+  psycopg2 = super.psycopg2.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.postgresql ];
     }
   );
 
-  psycopg2-binary = super.psycopg2-binary.overrideAttrs (
+  psycopg2-binary = super.psycopg2-binary.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.postgresql ];
     }
   );
 
-  pyarrow = super.pyarrow.overrideAttrs (
+  pyarrow = super.pyarrow.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [
         self.cython
@@ -352,7 +360,7 @@ self: super:
           format = "other";
         }
       )
-    ).overrideAttrs (
+    ).overridePythonAttrs (
       old: {
 
         nativeBuildInputs = old.nativeBuildInputs ++ [
@@ -371,7 +379,7 @@ self: super:
     )
   ) super.pycairo;
 
-  pycocotools = super.pycocotools.overrideAttrs (
+  pycocotools = super.pycocotools.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [
         self.cython
@@ -380,21 +388,21 @@ self: super:
     }
   );
 
-  pygobject = super.pygobject.overrideAttrs (
+  pygobject = super.pygobject.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
       buildInputs = old.buildInputs ++ [ pkgs.glib pkgs.gobject-introspection ];
     }
   );
 
-  pylint = super.pylint.overrideAttrs (
+  pylint = super.pylint.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ self.pytest-runner ];
       doCheck = false;
     }
   );
 
-  pyopenssl = super.pyopenssl.overrideAttrs (
+  pyopenssl = super.pyopenssl.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ pkgs.openssl ];
     }
@@ -501,7 +509,7 @@ self: super:
       }
     );
 
-  pytest-datadir = super.pytest-datadir.overrideAttrs (
+  pytest-datadir = super.pytest-datadir.overridePythonAttrs (
     old: {
       postInstall = ''
         rm -f $out/LICENSE
@@ -517,7 +525,7 @@ self: super:
 
   pytest-runner = super.pytest-runner or super.pytestrunner;
 
-  python-prctl = super.python-prctl.overrideAttrs (
+  python-prctl = super.python-prctl.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [
         pkgs.libcap
@@ -525,14 +533,14 @@ self: super:
     }
   );
 
-  pyzmq = super.pyzmq.overrideAttrs (
+  pyzmq = super.pyzmq.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
       propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.zeromq ];
     }
   );
 
-  rockset = super.rockset.overrideAttrs (
+  rockset = super.rockset.overridePythonAttrs (
     old: rec {
       postPatch = ''
         cp ./setup_rockset.py ./setup.py
@@ -540,7 +548,7 @@ self: super:
     }
   );
 
-  scaleapi = super.scaleapi.overrideAttrs (
+  scaleapi = super.scaleapi.overridePythonAttrs (
     old: {
       postPatch = ''
         substituteInPlace setup.py --replace "install_requires = ['requests>=2.4.2', 'enum34']" "install_requires = ['requests>=2.4.2']" || true
@@ -548,7 +556,7 @@ self: super:
     }
   );
 
-  pandas = super.pandas.overrideAttrs (
+  pandas = super.pandas.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [ self.cython ];
     }
@@ -565,7 +573,7 @@ self: super:
     }
   );
 
-  scipy = super.scipy.overrideAttrs (
+  scipy = super.scipy.overridePythonAttrs (
     old: {
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gfortran ];
       propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.pybind11 ];
@@ -599,7 +607,7 @@ self: super:
     }
   );
 
-  shapely = super.shapely.overrideAttrs (
+  shapely = super.shapely.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ [ pkgs.geos self.cython ];
       inherit (pkgs.python3.pkgs.shapely) patches GEOS_LIBRARY_PATH;
@@ -614,7 +622,7 @@ self: super:
     )
   ) else super.shellingham;
 
-  tables = super.tables.overrideAttrs (
+  tables = super.tables.overridePythonAttrs (
     old: {
       HDF5_DIR = "${pkgs.hdf5}";
       nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.pkgconfig ];
@@ -622,7 +630,7 @@ self: super:
     }
   );
 
-  tensorpack = super.tensorpack.overrideAttrs (
+  tensorpack = super.tensorpack.overridePythonAttrs (
     old: {
       postPatch = ''
         substituteInPlace setup.cfg --replace "# will call find_packages()" ""
@@ -630,7 +638,7 @@ self: super:
     }
   );
 
-  urwidtrees = super.urwidtrees.overrideAttrs (
+  urwidtrees = super.urwidtrees.overridePythonAttrs (
     old: {
       propagatedBuildInputs = old.propagatedBuildInputs ++ [
         self.urwid
@@ -638,7 +646,7 @@ self: super:
     }
   );
 
-  vose-alias-method = super.vose-alias-method.overrideAttrs (
+  vose-alias-method = super.vose-alias-method.overridePythonAttrs (
     old: {
       postInstall = ''
         rm -f $out/LICENSE
@@ -646,7 +654,7 @@ self: super:
     }
   );
 
-  uvloop = super.uvloop.overrideAttrs (
+  uvloop = super.uvloop.overridePythonAttrs (
     old: {
       buildInputs = old.buildInputs ++ lib.optionals stdenv.isDarwin [
         pkgs.darwin.apple_sdk.frameworks.ApplicationServices
@@ -667,16 +675,24 @@ self: super:
   );
 
   zipp =
-    if lib.versionAtLeast super.zipp.version "2.0.0" then (
-      super.zipp.overridePythonAttrs (
-        old: {
-          prePatch = ''
-            substituteInPlace setup.py --replace \
-            'setuptools.setup()' \
-            'setuptools.setup(version="${super.zipp.version}")'
-          '';
-        }
-      )
-    ) else super.zipp;
+    (
+      if lib.versionAtLeast super.zipp.version "2.0.0" then (
+        super.zipp.overridePythonAttrs (
+          old: {
+            prePatch = ''
+              substituteInPlace setup.py --replace \
+              'setuptools.setup()' \
+              'setuptools.setup(version="${super.zipp.version}")'
+            '';
+          }
+        )
+      ) else super.zipp
+    ).overridePythonAttrs (
+      old: {
+        propagatedBuildInputs = old.propagatedBuildInputs ++ [
+          self.toml
+        ];
+      }
+    );
 
 }
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
index b2e11205c36..cda4e8c78d4 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
@@ -1,5 +1,4 @@
 { lib, stdenv, python, isLinux ? stdenv.isLinux }:
-
 let
   inherit (lib.strings) hasSuffix hasInfix splitString removeSuffix;
 
@@ -94,12 +93,10 @@ let
           if isLinux
           then chooseLinux files
           else chooseOSX files;
-
     in
       if (builtins.length filtered == 0)
       then []
       else choose (filtered);
-
 in
 {
   inherit selectWheel toWheelAttrs isPyVersionCompatible;
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix
index ae0c29f3683..67ffdddb4bd 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix
@@ -1,5 +1,4 @@
 { lib, stdenv, poetryLib }: python:
-
 let
   inherit (poetryLib) ireplace;
 
@@ -37,195 +36,199 @@ let
   );
 
   # Make a tree out of expression groups (parens)
-  findSubExpressions = expr: let
-    acc = builtins.foldl' findSubExpressionsFun {
-      exprs = [];
-      expr = expr;
-      pos = 0;
-      openP = 0;
-      exprPos = 0;
-      startPos = 0;
-    } (lib.stringToCharacters 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 + " "))
-    );
-
-    mapfn = expr: (
-      if (builtins.match "^ ?$" expr != null) then null  # Filter empty
-      else if (builtins.elem expr [ "and" "or" ]) then {
-        type = "bool";
-        value = expr;
-      }
-      else {
-        type = "expr";
-        value = expr;
-      }
-    );
+  findSubExpressions = expr:
+    let
+      acc = builtins.foldl' findSubExpressionsFun {
+        exprs = [];
+        expr = expr;
+        pos = 0;
+        openP = 0;
+        exprPos = 0;
+        startPos = 0;
+      } (lib.stringToCharacters 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 + " "))
+      );
 
-    parse = expr: builtins.filter (x: x != null) (builtins.map mapfn (splitCond expr));
+      mapfn = expr: (
+        if (builtins.match "^ ?$" expr != null) then null  # Filter empty
+        else if (builtins.elem expr [ "and" "or" ]) then {
+          type = "bool";
+          value = expr;
+        }
+        else {
+          type = "expr";
+          value = expr;
+        }
+      );
 
-  in
-    builtins.foldl' (
-      acc: v: acc ++ (
-        if builtins.typeOf v == "string" then parse v else [ (parseExpressions v) ]
-      )
-    ) [] exprs;
+      parse = expr: builtins.filter (x: x != null) (builtins.map mapfn (splitCond expr));
+    in
+      builtins.foldl' (
+        acc: v: acc ++ (
+          if builtins.typeOf v == "string" then parse v else [ (parseExpressions v) ]
+        )
+      ) [] exprs;
 
   # Transform individual expressions to structured expressions
   # This function also performs variable substitution, replacing environment markers with their explicit values
-  transformExpressions = exprs: let
-    variables = {
-      os_name = (
-        if python.pname == "jython" then "java"
-        else "posix"
-      );
-      sys_platform = (
-        if stdenv.isLinux then "linux"
-        else if stdenv.isDarwin then "darwin"
-        else throw "Unsupported platform"
-      );
-      platform_machine = stdenv.platform.kernelArch;
-      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}"
+  transformExpressions = exprs:
+    let
+      variables = {
+        os_name = (
+          if python.pname == "jython" then "java"
+          else "posix"
         );
-      platform_release = ""; # Field not reproducible
-      platform_system = (
-        if stdenv.isLinux then "Linux"
-        else if stdenv.isDarwin then "Darwin"
-        else throw "Unsupported platform"
-      );
-      platform_version = ""; # Field not reproducible
-      python_version = python.passthru.pythonVersion;
-      python_full_version = python.version;
-      implementation_name = python.implementation;
-      implementation_version = python.version;
-      extra = "";
-    };
-
-    substituteVar = value: if builtins.hasAttr value variables then (builtins.toJSON variables."${value}") else value;
-
-    processVar = value: builtins.foldl' (acc: v: v acc) value [
-      stripStr
-      substituteVar
-    ];
-
-  in
-    if builtins.typeOf exprs == "set" then (
-      if exprs.type == "expr" then (
-        let
-          mVal = ''[a-zA-Z0-9\'"_\. ]+'';
-          mOp = "in|[!=<>]+";
-          e = stripStr exprs.value;
-          m = builtins.map stripStr (builtins.match ''^(${mVal}) *(${mOp}) *(${mVal})$'' e);
+        sys_platform = (
+          if stdenv.isLinux then "linux"
+          else if stdenv.isDarwin then "darwin"
+          else throw "Unsupported platform"
+        );
+        platform_machine = stdenv.platform.kernelArch;
+        platform_python_implementation = let
+          impl = python.passthru.implementation;
         in
-          {
-            type = "expr";
-            value = {
-              op = builtins.elemAt m 1;
-              values = [
-                (processVar (builtins.elemAt m 0))
-                (processVar (builtins.elemAt m 2))
-              ];
-            };
-          }
-      ) else exprs
-    ) else builtins.map transformExpressions exprs;
+          (
+            if impl == "cpython" then "CPython"
+            else if impl == "pypy" then "PyPy"
+            else throw "Unsupported implementation ${impl}"
+          );
+        platform_release = ""; # Field not reproducible
+        platform_system = (
+          if stdenv.isLinux then "Linux"
+          else if stdenv.isDarwin then "Darwin"
+          else throw "Unsupported platform"
+        );
+        platform_version = ""; # Field not reproducible
+        python_version = python.passthru.pythonVersion;
+        python_full_version = python.version;
+        implementation_name = python.implementation;
+        implementation_version = python.version;
+        extra = "";
+      };
+
+      substituteVar = value: if builtins.hasAttr value variables then (builtins.toJSON variables."${value}") else value;
+
+      processVar = value: builtins.foldl' (acc: v: v acc) value [
+        stripStr
+        substituteVar
+      ];
+    in
+      if builtins.typeOf exprs == "set" then (
+        if exprs.type == "expr" then (
+          let
+            mVal = ''[a-zA-Z0-9\'"_\. ]+'';
+            mOp = "in|[!=<>]+";
+            e = stripStr exprs.value;
+            m = builtins.map stripStr (builtins.match ''^(${mVal}) *(${mOp}) *(${mVal})$'' e);
+          in
+            {
+              type = "expr";
+              value = {
+                op = builtins.elemAt m 1;
+                values = [
+                  (processVar (builtins.elemAt m 0))
+                  (processVar (builtins.elemAt m 2))
+                ];
+              };
+            }
+        ) else exprs
+      ) else builtins.map transformExpressions exprs;
 
   # Recursively eval all expressions
-  evalExpressions = exprs: let
-    unmarshal = v: (
-      # TODO: Handle single quoted values
-      if v == "True" then true
-      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 = {
-      "<=" = x: y: (unmarshal x) <= (unmarshal y);
-      "<" = x: y: (unmarshal x) < (unmarshal y);
-      "!=" = x: y: x != y;
-      "==" = x: y: x == y;
-      ">=" = x: y: (unmarshal x) >= (unmarshal y);
-      ">" = x: y: (unmarshal x) > (unmarshal y);
-      "~=" = v: c: let
-        parts = builtins.splitVersion c;
-        pruned = lib.take ((builtins.length parts) - 1) parts;
-        upper = builtins.toString (
-          (lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
-        );
-        upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
-      in
-        op.">=" v c && op."<" v upperConstraint;
-      "===" = x: y: x == y;
-      "in" = x: y: let
-        values = builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " (unmarshal y));
-      in
-        builtins.elem (unmarshal x) values;
-    };
-  in
-    if builtins.typeOf exprs == "set" then (
-      if exprs.type == "expr" then (
-        let
-          expr = exprs;
-          result = (op."${expr.value.op}") (builtins.elemAt expr.value.values 0) (builtins.elemAt expr.value.values 1);
-        in
-          {
-            type = "value";
-            value = result;
-          }
-      ) else exprs
-    ) else builtins.map evalExpressions exprs;
+  evalExpressions = exprs:
+    let
+      unmarshal = v: (
+        # TODO: Handle single quoted values
+        if v == "True" then true
+        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 = {
+        "<=" = x: y: (unmarshal x) <= (unmarshal y);
+        "<" = x: y: (unmarshal x) < (unmarshal y);
+        "!=" = x: y: x != y;
+        "==" = x: y: x == y;
+        ">=" = x: y: (unmarshal x) >= (unmarshal y);
+        ">" = x: y: (unmarshal x) > (unmarshal y);
+        "~=" = v: c:
+          let
+            parts = builtins.splitVersion c;
+            pruned = lib.take ((builtins.length parts) - 1) parts;
+            upper = builtins.toString (
+              (lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
+            );
+            upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
+          in
+            op.">=" v c && op."<" v upperConstraint;
+        "===" = x: y: x == y;
+        "in" = x: y:
+          let
+            values = builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " (unmarshal y));
+          in
+            builtins.elem (unmarshal x) values;
+      };
+    in
+      if builtins.typeOf exprs == "set" then (
+        if exprs.type == "expr" then (
+          let
+            expr = exprs;
+            result = (op."${expr.value.op}") (builtins.elemAt expr.value.values 0) (builtins.elemAt expr.value.values 1);
+          in
+            {
+              type = "value";
+              value = result;
+            }
+        ) else exprs
+      ) else builtins.map evalExpressions exprs;
 
   # Now that we have performed an eval all that's left to do is to concat the graph into a single bool
-  reduceExpressions = exprs: let
-    cond = {
-      "and" = x: y: x && y;
-      "or" = x: y: x || y;
-    };
-    reduceExpressionsFun = acc: v: (
-      if builtins.typeOf v == "set" then (
-        if v.type == "value" then (
-          acc // {
-            value = cond."${acc.cond}" acc.value v.value;
-          }
-        ) else if v.type == "bool" then (
-          acc // {
-            cond = v.value;
-          }
+  reduceExpressions = exprs:
+    let
+      cond = {
+        "and" = x: y: x && y;
+        "or" = x: y: x || y;
+      };
+      reduceExpressionsFun = acc: v: (
+        if builtins.typeOf v == "set" then (
+          if v.type == "value" then (
+            acc // {
+              value = cond."${acc.cond}" acc.value v.value;
+            }
+          ) else if v.type == "bool" then (
+            acc // {
+              cond = v.value;
+            }
+          ) else throw "Unsupported type"
+        ) else if builtins.typeOf v == "list" then (
+          let
+            ret = builtins.foldl' reduceExpressionsFun {
+              value = true;
+              cond = "and";
+            } v;
+          in
+            acc // {
+              value = cond."${acc.cond}" acc.value ret.value;
+            }
         ) else throw "Unsupported type"
-      ) else if builtins.typeOf v == "list" then (
-        let
-          ret = builtins.foldl' reduceExpressionsFun {
-            value = true;
-            cond = "and";
-          } v;
-        in
-          acc // {
-            value = cond."${acc.cond}" acc.value ret.value;
-          }
-      ) else throw "Unsupported type"
-    );
-  in
-    (
-      builtins.foldl' reduceExpressionsFun {
-        value = true;
-        cond = "and";
-      } exprs
-    ).value;
-
+      );
+    in
+      (
+        builtins.foldl' reduceExpressionsFun {
+          value = true;
+          cond = "and";
+        } exprs
+      ).value;
 in
 e: builtins.foldl' (acc: v: v acc) e [
   findSubExpressions
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/semver.nix b/pkgs/development/tools/poetry2nix/poetry2nix/semver.nix
index 784589a4ca4..07dcbbc5eac 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/semver.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/semver.nix
@@ -1,26 +1,27 @@
 { lib, ireplace }:
-
 let
   inherit (builtins) elemAt match;
 
   operators = let
     matchWildCard = s: match "([^\*])(\.[\*])" s;
     mkComparison = ret: version: v: builtins.compareVersions version v == ret;
-    mkIdxComparison = idx: version: v: let
-      ver = builtins.splitVersion v;
-      minor = builtins.toString (lib.toInt (elemAt ver idx) + 1);
-      upper = builtins.concatStringsSep "." (ireplace idx minor ver);
-    in
-      operators.">=" version v && operators."<" version upper;
-    dropWildcardPrecision = f: version: constraint: let
-      m = matchWildCard constraint;
-      hasWildcard = m != null;
-      c = if hasWildcard then (elemAt m 0) else constraint;
-      v =
-        if hasWildcard then (builtins.substring 0 (builtins.stringLength c) version)
-        else version;
-    in
-      f v c;
+    mkIdxComparison = idx: version: v:
+      let
+        ver = builtins.splitVersion v;
+        minor = builtins.toString (lib.toInt (elemAt ver idx) + 1);
+        upper = builtins.concatStringsSep "." (ireplace idx minor ver);
+      in
+        operators.">=" version v && operators."<" version upper;
+    dropWildcardPrecision = f: version: constraint:
+      let
+        m = matchWildCard constraint;
+        hasWildcard = m != null;
+        c = if hasWildcard then (elemAt m 0) else constraint;
+        v =
+          if hasWildcard then (builtins.substring 0 (builtins.stringLength c) version)
+          else version;
+      in
+        f v c;
   in
     {
       # Prefix operators
@@ -33,16 +34,17 @@ let
       # Semver specific operators
       "~" = mkIdxComparison 1;
       "^" = mkIdxComparison 0;
-      "~=" = v: c: let
-        # Prune constraint
-        parts = builtins.splitVersion c;
-        pruned = lib.take ((builtins.length parts) - 1) parts;
-        upper = builtins.toString (
-          (lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
-        );
-        upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
-      in
-        operators.">=" v c && operators."<" v upperConstraint;
+      "~=" = v: c:
+        let
+          # Prune constraint
+          parts = builtins.splitVersion c;
+          pruned = lib.take ((builtins.length parts) - 1) parts;
+          upper = builtins.toString (
+            (lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
+          );
+          upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
+        in
+          operators.">=" v c && operators."<" v upperConstraint;
       # Infix operators
       "-" = version: v: operators.">=" version v.vl && operators."<=" version v.vu;
       # Arbitrary equality clause, just run simple comparison
@@ -55,33 +57,34 @@ let
     version = "([0-9\.\*x]+)";
   };
 
-  parseConstraint = constraint: let
-    constraintStr = builtins.replaceStrings [ " " ] [ "" ] constraint;
-    # The common prefix operators
-    mPre = match "${re.operators} *${re.version}" constraintStr;
-    # 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"
-    );
-
-  satisfiesSemver = version: constraint: let
-    inherit (parseConstraint constraint) op v;
-  in
-    if constraint == "*" then true else operators."${op}" version v;
+  parseConstraint = constraint:
+    let
+      constraintStr = builtins.replaceStrings [ " " ] [ "" ] constraint;
+      # The common prefix operators
+      mPre = match "${re.operators} *${re.version}" constraintStr;
+      # 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"
+      );
 
+  satisfiesSemver = version: constraint:
+    let
+      inherit (parseConstraint constraint) op v;
+    in
+      if constraint == "*" then true else operators."${op}" version v;
 in
 { inherit satisfiesSemver; }