From c5409117ebaa27021dd1e6b344d7591ae7d49d11 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 2 Jun 2026 23:53:53 +0200 Subject: [PATCH] python3Packages.deptry: init at 0.25.1 Find unused, missing and transitive dependencies in a Python project https://github.com/osprey-oss/deptry --- pkgs/by-name/de/deptry/package.nix | 5 ++ .../python-modules/deptry/default.nix | 74 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 81 insertions(+) create mode 100644 pkgs/by-name/de/deptry/package.nix create mode 100644 pkgs/development/python-modules/deptry/default.nix diff --git a/pkgs/by-name/de/deptry/package.nix b/pkgs/by-name/de/deptry/package.nix new file mode 100644 index 000000000000..e2633aa766b0 --- /dev/null +++ b/pkgs/by-name/de/deptry/package.nix @@ -0,0 +1,5 @@ +{ python3Packages }: +with python3Packages; +(toPythonApplication deptry).overrideAttrs (_: { + __structuredAttrs = true; +}) diff --git a/pkgs/development/python-modules/deptry/default.nix b/pkgs/development/python-modules/deptry/default.nix new file mode 100644 index 000000000000..3fef82922dfc --- /dev/null +++ b/pkgs/development/python-modules/deptry/default.nix @@ -0,0 +1,74 @@ +{ + lib, + buildPythonPackage, + cargo, + click, + colorama, + fetchFromGitHub, + packaging, + python, + pytest-xdist, + pytestCheckHook, + requirements-parser, + rustc, + rustPlatform, + tomli, +}: + +buildPythonPackage (finalAttrs: { + pname = "deptry"; + version = "0.25.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "osprey-oss"; + repo = "deptry"; + tag = finalAttrs.version; + hash = "sha256-GQWivQMWQ8wi6cWsCbmvSSyPEx1yl9QidO+9mTDrN1c="; + }; + + cargoDeps = rustPlatform.fetchCargoVendor { + inherit (finalAttrs) pname version src; + hash = "sha256-axUqKks3vxiJF2bRI/Qwk7iKjoUNQQc3NynI60n3quY="; + }; + + build-system = [ + cargo + rustPlatform.cargoSetupHook + rustPlatform.maturinBuildHook + rustc + ]; + + dependencies = [ + click + colorama + packaging + requirements-parser + tomli + ]; + + nativeCheckInputs = [ + pytest-xdist + pytestCheckHook + ]; + + preCheck = '' + cp $out/${python.sitePackages}/deptry/rust*.so python/deptry/ + ''; + + disabledTestPaths = [ + # Don't run CLI tests + "tests/functional/cli/" + ]; + + pythonImportsCheck = [ "deptry" ]; + + meta = { + description = "Find unused, missing and transitive dependencies in a Python project"; + homepage = "https://github.com/osprey-oss/deptry"; + changelog = "https://github.com/osprey-oss/deptry/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ fab ]; + mainProgram = "deptry"; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2803ff10fc33..aeded1d39d61 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3884,6 +3884,8 @@ self: super: with self; { deprecation-alias = callPackage ../development/python-modules/deprecation-alias { }; + deptry = callPackage ../development/python-modules/deptry { }; + depyf = callPackage ../development/python-modules/depyf { }; derpconf = callPackage ../development/python-modules/derpconf { };