diff --git a/lib/test.nix b/lib/test.nix index 151aa1b..4b075ad 100644 --- a/lib/test.nix +++ b/lib/test.nix @@ -61,6 +61,11 @@ let pname = "poetry-plugin-export"; version = "1.4.0"; }; + + python3 = { + pname = "python3"; + inherit (pkgs.python3) version; + }; }; stdenv = { inherit isLinux isDarwin; diff --git a/lib/test_project.nix b/lib/test_project.nix index 102e38a..276feb9 100644 --- a/lib/test_project.nix +++ b/lib/test_project.nix @@ -6,6 +6,10 @@ }: let inherit (project) loadPyproject loadPoetryPyproject; + + # Get python packages from a set + getPkgs = set: pnames: map (pname: set.pkgs.${pname}) pnames; + in { loadPyproject = { @@ -33,90 +37,30 @@ in }; mainProgram = "pdm"; }; - nativeBuildInputs = [ - { - pname = "pdm-backend"; - version = "2.1.4"; - } + nativeBuildInputs = getPkgs mocks.cpythonLinux38 [ + "pdm-backend" ]; pname = "pdm"; - propagatedBuildInputs = [ - { - pname = "blinker"; - version = "1.5"; - } - { - pname = "certifi"; - version = "2023.05.07"; - } - { - pname = "packaging"; - version = "23.1"; - } - { - pname = "platformdirs"; - version = "3.9.1"; - } - { - pname = "rich"; - version = "13.3.5"; - } - { - pname = "virtualenv"; - version = "20.24.0"; - } - { - pname = "pyproject-hooks"; - version = "1.0.0"; - } - { - pname = "requests-toolbelt"; - version = "1.0.0"; - } - { - pname = "unearth"; - version = "0.9.1"; - } - { - pname = "findpython"; - version = "0.4.0"; - } - { - pname = "tomlkit"; - version = "0.12.1"; - } - { - pname = "shellingham"; - version = "1.5.1"; - } - { - pname = "python-dotenv"; - version = "1.0.0"; - } - { - pname = "resolvelib"; - version = "0.5.5"; - } - { - pname = "installer"; - version = "0.7.0"; - } - { - pname = "cachecontrol"; - version = "0.13.1"; - } - { - pname = "tomli"; - version = "2.0.1"; - } - { - pname = "importlib-resources"; - version = "5.12.0"; - } - { - pname = "importlib-metadata"; - version = "6.8.0"; - } + propagatedBuildInputs = getPkgs mocks.cpythonLinux38 [ + "blinker" + "certifi" + "packaging" + "platformdirs" + "rich" + "virtualenv" + "pyproject-hooks" + "requests-toolbelt" + "unearth" + "findpython" + "tomlkit" + "shellingham" + "python-dotenv" + "resolvelib" + "installer" + "cachecontrol" + "tomli" + "importlib-resources" + "importlib-metadata" ]; }; }; @@ -133,50 +77,20 @@ in expected = { format = "pyproject"; meta = { description = "Powerful data structures for data analysis, time series, and statistics"; }; - nativeBuildInputs = [ - { - pname = "meson-python"; - version = "0.13.1"; - } - { - pname = "meson"; - version = "1.2.0"; - } - { - pname = "wheel"; - version = "0.41.1"; - } - { - pname = "cython"; - version = "0.29.36"; - } - { - pname = "oldest-supported-numpy"; - version = "1.0.0"; - } - { - pname = "versioneer"; - version = "0.29"; - } + nativeBuildInputs = getPkgs mocks.cpythonLinux38 [ + "meson-python" + "meson" + "wheel" + "cython" + "oldest-supported-numpy" + "versioneer" ]; pname = "pandas"; - propagatedBuildInputs = [ - { - pname = "numpy"; - version = "1.25.1"; - } - { - pname = "python-dateutil"; - version = "2.8.2"; - } - { - pname = "pytz"; - version = "2023.3"; - } - { - pname = "tzdata"; - version = "2022.7"; - } + propagatedBuildInputs = getPkgs mocks.cpythonLinux38 [ + "numpy" + "python-dateutil" + "pytz" + "tzdata" ]; }; }; @@ -207,130 +121,40 @@ in url = "https://spdx.org/licenses/MIT.html"; }; }; - nativeBuildInputs = [ - { - pname = "poetry-core"; - version = "1.6.1"; - } + nativeBuildInputs = getPkgs mocks.cpythonLinux38 [ + "poetry-core" ]; pname = "poetry"; - propagatedBuildInputs = [ - { - pname = "build"; - version = "0.10.0"; - } - { - pname = "cachecontrol"; - version = "0.13.1"; - } - { - pname = "cleo"; - version = "2.0.1"; - } - { - pname = "crashtest"; - version = "0.4.1"; - } - { - pname = "dulwich"; - version = "0.21.6"; - } - { - pname = "filelock"; - version = "3.12.2"; - } - { - pname = "html5lib"; - version = "1.1"; - } - { - pname = "importlib-metadata"; - version = "6.8.0"; - } - { - pname = "installer"; - version = "0.7.0"; - } - { - pname = "jsonschema"; - version = "4.18.4"; - } - { - pname = "keyring"; - version = "24.2.0"; - } - { - pname = "lockfile"; - version = "0.12.2"; - } - { - pname = "packaging"; - version = "23.1"; - } - { - pname = "pexpect"; - version = "4.8.0"; - } - { - pname = "pkginfo"; - version = "1.9.6"; - } - { - pname = "platformdirs"; - version = "3.9.1"; - } - { - pname = "poetry-core"; - version = "1.6.1"; - } - { - pname = "poetry-plugin-export"; - version = "1.4.0"; - } - { - pname = "pyproject-hooks"; - version = "1.0.0"; - } - { - pname = "python3"; - version = "3.10.12"; - } - { - pname = "requests"; - version = "2.31.0"; - } - { - pname = "requests-toolbelt"; - version = "1.0.0"; - } - { - pname = "shellingham"; - version = "1.5.1"; - } - { - pname = "tomli"; - version = "2.0.1"; - } - { - pname = "tomlkit"; - version = "0.12.1"; - } - { - pname = "trove-classifiers"; - version = "2023.7.6"; - } - { - pname = "urllib3"; - version = "1.26.16"; - } - { - pname = "virtualenv"; - version = "20.24.0"; - } - { - pname = "pre-commit"; - version = "3.3.3"; - } + propagatedBuildInputs = getPkgs mocks.cpythonLinux38 [ + "build" + "cachecontrol" + "cleo" + "crashtest" + "dulwich" + "filelock" + "html5lib" + "importlib-metadata" + "installer" + "jsonschema" + "keyring" + "lockfile" + "packaging" + "pexpect" + "pkginfo" + "platformdirs" + "poetry-core" + "poetry-plugin-export" + "pyproject-hooks" + "python3" + "requests" + "requests-toolbelt" + "shellingham" + "tomli" + "tomlkit" + "trove-classifiers" + "urllib3" + "virtualenv" + "pre-commit" ]; version = "1.4.2"; };