diff --git a/lib/renderers.nix b/lib/renderers.nix index df26bc4..39009e6 100644 --- a/lib/renderers.nix +++ b/lib/renderers.nix @@ -69,7 +69,7 @@ in Example: # buildPythonPackage { project = lib.project.loadPyproject ...; python = pkgs.python3; } - { pname = "blinker"; version = "1.3.3.7"; propagatedBuildInputs = [ ]; } + { pname = "blinker"; version = "1.3.3.7"; dependencies = [ ]; } */ buildPythonPackage = { @@ -82,7 +82,7 @@ in , # Map a Python extras group name to a Nix attribute set like: # { dev = "checkInputs"; } # This is intended to be used with optionals such as test dependencies that you might - # want to add to checkInputs instead of propagatedBuildInputs + # want to add to checkInputs instead of dependencies extrasAttrMappings ? { } , # Which package format to pass to buildPythonPackage # If the format is "wheel" PEP-518 build-systems are excluded from the build. @@ -142,19 +142,20 @@ in foldl' (attrs: group: let - attr = extrasAttrMappings.${group} or "propagatedBuildInputs"; + attr = extrasAttrMappings.${group} or "dependencies"; in attrs // { ${attr} = attrs.${attr} or [ ] ++ map (dep: python.pkgs.${dep}) namedDeps.extras.${group}; }) ({ - propagatedBuildInputs = map (dep: python.pkgs.${dep}) namedDeps.dependencies; - inherit format meta; - passthru = { - optional-dependencies = lib.mapAttrs (_group: deps: map (dep: python.pkgs.${dep.name}) deps) project.dependencies.extras; - }; + pyproject = format == "pyproject"; + dependencies = map (dep: python.pkgs.${dep}) namedDeps.dependencies; + optional-dependencies = lib.mapAttrs (_group: deps: map (dep: python.pkgs.${dep.name}) deps) project.dependencies.extras; + inherit meta; + } // optionalAttrs (format != "pyproject") { + inherit format; } // optionalAttrs (format != "wheel") { - nativeBuildInputs = + build-system = if namedDeps.build-systems != [ ] then map (dep: pythonPackages.${dep}) namedDeps.build-systems else [ pythonPackages.setuptools pythonPackages.wheel ]; } // optionalAttrs (pyproject.project ? name) { diff --git a/lib/test_project.nix b/lib/test_project.nix index 5f7870f..097f47a 100644 --- a/lib/test_project.nix +++ b/lib/test_project.nix @@ -45,10 +45,10 @@ lib.fix (self: { getPkgs' = getPkgs mocks.cpythonLinux38; in { - format = "pyproject"; + pyproject = true; disabled = true; meta = { description = "Powerful data structures for data analysis, time series, and statistics"; }; - passthru.optional-dependencies = lib.mapAttrs (_: getPkgs') { + optional-dependencies = lib.mapAttrs (_: getPkgs') { all = [ "beautifulsoup4" "bottleneck" "brotlipy" "fastparquet" "fsspec" "gcsfs" "html5lib" "hypothesis" "Jinja2" "lxml" "matplotlib" "numba" "numexpr" "odfpy" "openpyxl" "pandas-gbq" "psycopg2" "pyarrow" "PyMySQL" "PyQt5" "pyreadstat" "pytest" "pytest-xdist" "pytest-asyncio" "python-snappy" "pyxlsb" "QtPy" "scipy" "s3fs" "SQLAlchemy" "tables" "tabulate" "xarray" "xlrd" "xlsxwriter" "zstandard" ]; aws = [ "s3fs" ]; clipboard = [ "PyQt5" "QtPy" ]; @@ -71,7 +71,7 @@ lib.fix (self: { test = [ "hypothesis" "pytest" "pytest-xdist" "pytest-asyncio" ]; xml = [ "lxml" ]; }; - nativeBuildInputs = getPkgs' [ + build-system = getPkgs' [ "meson-python" "meson" "wheel" @@ -80,7 +80,7 @@ lib.fix (self: { "versioneer" ]; pname = "pandas"; - propagatedBuildInputs = getPkgs' [ + dependencies = getPkgs' [ "numpy" "python-dateutil" "pytz" @@ -117,8 +117,8 @@ lib.fix (self: { { disabled = false; src = true; - format = "pyproject"; - passthru.optional-dependencies = lib.mapAttrs (_: getPkgs') { + pyproject = true; + optional-dependencies = lib.mapAttrs (_: getPkgs') { all = [ "pdm" ]; cookiecutter = [ "cookiecutter" ]; copier = [ "copier" ]; @@ -144,11 +144,11 @@ lib.fix (self: { }; mainProgram = "pdm"; }; - nativeBuildInputs = getPkgs mocks.cpythonLinux38 [ + build-system = getPkgs mocks.cpythonLinux38 [ "pdm-backend" ]; pname = "pdm"; - propagatedBuildInputs = getPkgs mocks.cpythonLinux38 [ + dependencies = getPkgs mocks.cpythonLinux38 [ "blinker" "certifi" "packaging" @@ -189,8 +189,8 @@ lib.fix (self: { getPkgs' = getPkgs mocks.cpythonLinux38; in { - format = "pyproject"; - passthru.optional-dependencies = lib.mapAttrs (_: getPkgs') { + pyproject = true; + optional-dependencies = lib.mapAttrs (_: getPkgs') { dev = [ "pre-commit" ]; github-actions = [ "pytest-github-actions-annotate-failures" ]; test = [ "cachy" "deepdiff" "deepdiff" "httpretty" "pytest" "pytest-cov" "pytest-mock" "pytest-randomly" "pytest-xdist" "zipp" ]; @@ -209,11 +209,11 @@ lib.fix (self: { }; mainProgram = "poetry"; }; - nativeBuildInputs = getPkgs mocks.cpythonLinux38 [ + build-system = getPkgs mocks.cpythonLinux38 [ "poetry-core" ]; pname = "poetry"; - propagatedBuildInputs = getPkgs mocks.cpythonLinux38 [ + dependencies = getPkgs mocks.cpythonLinux38 [ "build" "cachecontrol" "cleo" diff --git a/lib/test_renderers.nix b/lib/test_renderers.nix index 664a8ed..d761a7d 100644 --- a/lib/test_renderers.nix +++ b/lib/test_renderers.nix @@ -20,11 +20,9 @@ let # Clear drv inputs from stuff like version and just return the name string # so our tests don't start failing randomly just because we upgrade and nixpkgs moved clearDrvInputs = attrs: attrs // { - propagatedBuildInputs = map (drv: drv.pname) attrs.propagatedBuildInputs; - nativeBuildInputs = map (drv: drv.pname) attrs.nativeBuildInputs; - passthru = attrs.passthru // { - optional-dependencies = lib.mapAttrs (_group: deps: map (drv: drv.pname) deps) attrs.passthru.optional-dependencies; - }; + dependencies = map (drv: drv.pname) attrs.dependencies; + build-system = map (drv: drv.pname) attrs.build-system; + optional-dependencies = lib.mapAttrs (_group: deps: map (drv: drv.pname) deps) attrs.optional-dependencies; } // optionalAttrs (attrs ? checkInputs) { checkInputs = map (drv: drv.pname) attrs.checkInputs; }; @@ -55,16 +53,16 @@ in }); expected = { disabled = false; - format = "pyproject"; + pyproject = true; meta = { description = "A modern Python package and dependency manager supporting the latest PEP standards"; license = lib.licenses.mit; mainProgram = "pdm"; }; - nativeBuildInputs = [ "pdm-backend" ]; + build-system = [ "pdm-backend" ]; pname = "pdm"; - passthru = { optional-dependencies = { all = [ "pdm" ]; cookiecutter = [ "cookiecutter" ]; copier = [ "copier" ]; doc = [ "mkdocs" "mkdocs-material" "mkdocstrings" "mike" "setuptools" "markdown-exec" "mkdocs-redirects" ]; keyring = [ "keyring" ]; pytest = [ "pytest" "pytest-mock" ]; template = [ "pdm" ]; test = [ "pdm" "pytest-cov" "pytest-xdist" "pytest-rerunfailures" "pytest-httpserver" ]; tox = [ "tox" "tox-pdm" ]; truststore = [ "truststore" ]; workflow = [ "pdm-pep517" "parver" "towncrier" "pycomplete" ]; }; }; - propagatedBuildInputs = [ "blinker" "certifi" "packaging" "platformdirs" "rich" "virtualenv" "pyproject-hooks" "requests-toolbelt" "unearth" "findpython" "tomlkit" "shellingham" "python-dotenv" "resolvelib" "installer" "cachecontrol" "tomli" "importlib-resources" "importlib-metadata" ]; + optional-dependencies = { all = [ "pdm" ]; cookiecutter = [ "cookiecutter" ]; copier = [ "copier" ]; doc = [ "mkdocs" "mkdocs-material" "mkdocstrings" "mike" "setuptools" "markdown-exec" "mkdocs-redirects" ]; keyring = [ "keyring" ]; pytest = [ "pytest" "pytest-mock" ]; template = [ "pdm" ]; test = [ "pdm" "pytest-cov" "pytest-xdist" "pytest-rerunfailures" "pytest-httpserver" ]; tox = [ "tox" "tox-pdm" ]; truststore = [ "truststore" ]; workflow = [ "pdm-pep517" "parver" "towncrier" "pycomplete" ]; }; + dependencies = [ "blinker" "certifi" "packaging" "platformdirs" "rich" "virtualenv" "pyproject-hooks" "requests-toolbelt" "unearth" "findpython" "tomlkit" "shellingham" "python-dotenv" "resolvelib" "installer" "cachecontrol" "tomli" "importlib-resources" "importlib-metadata" ]; }; }; @@ -94,16 +92,16 @@ in expected = { disabled = false; checkInputs = [ "tox" "tox-pdm" ]; - format = "pyproject"; + pyproject = true; meta = { description = "A modern Python package and dependency manager supporting the latest PEP standards"; license = lib.licenses.mit; mainProgram = "pdm"; }; - nativeBuildInputs = [ "pdm-backend" ]; + build-system = [ "pdm-backend" ]; pname = "pdm"; - passthru = { optional-dependencies = { all = [ "pdm" ]; cookiecutter = [ "cookiecutter" ]; copier = [ "copier" ]; doc = [ "mkdocs" "mkdocs-material" "mkdocstrings" "mike" "setuptools" "markdown-exec" "mkdocs-redirects" ]; keyring = [ "keyring" ]; pytest = [ "pytest" "pytest-mock" ]; template = [ "pdm" ]; test = [ "pdm" "pytest-cov" "pytest-xdist" "pytest-rerunfailures" "pytest-httpserver" ]; tox = [ "tox" "tox-pdm" ]; truststore = [ "truststore" ]; workflow = [ "pdm-pep517" "parver" "towncrier" "pycomplete" ]; }; }; - propagatedBuildInputs = [ "blinker" "certifi" "packaging" "platformdirs" "rich" "virtualenv" "pyproject-hooks" "requests-toolbelt" "unearth" "findpython" "tomlkit" "shellingham" "python-dotenv" "resolvelib" "installer" "cachecontrol" "tomli" "importlib-resources" "importlib-metadata" ]; + optional-dependencies = { all = [ "pdm" ]; cookiecutter = [ "cookiecutter" ]; copier = [ "copier" ]; doc = [ "mkdocs" "mkdocs-material" "mkdocstrings" "mike" "setuptools" "markdown-exec" "mkdocs-redirects" ]; keyring = [ "keyring" ]; pytest = [ "pytest" "pytest-mock" ]; template = [ "pdm" ]; test = [ "pdm" "pytest-cov" "pytest-xdist" "pytest-rerunfailures" "pytest-httpserver" ]; tox = [ "tox" "tox-pdm" ]; truststore = [ "truststore" ]; workflow = [ "pdm-pep517" "parver" "towncrier" "pycomplete" ]; }; + dependencies = [ "blinker" "certifi" "packaging" "platformdirs" "rich" "virtualenv" "pyproject-hooks" "requests-toolbelt" "unearth" "findpython" "tomlkit" "shellingham" "python-dotenv" "resolvelib" "installer" "cachecontrol" "tomli" "importlib-resources" "importlib-metadata" ]; }; }; };