diff --git a/pkgs/by-name/in/inventree-part-import/package.nix b/pkgs/by-name/in/inventree-part-import/package.nix new file mode 100644 index 000000000000..d673e1d2bb95 --- /dev/null +++ b/pkgs/by-name/in/inventree-part-import/package.nix @@ -0,0 +1,76 @@ +{ + lib, + python3Packages, + fetchFromGitHub, + + # tests + versionCheckHook, + writableTmpDirAsHomeHook, +}: +python3Packages.buildPythonApplication (finalAttrs: { + pname = "inventree-part-import"; + version = "1.9.2"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "30350n"; + repo = "inventree-part-import"; + tag = finalAttrs.version; + hash = "sha256-EzPojJNFTptqxIeGuqbA2ZlcTmj1BI6IUcOeld64apk="; + }; + + # Tests have not been updated to use the new class name + postPatch = '' + substituteInPlace tests/test_cli.py \ + --replace-fail "ParameterTemplate" "PartParameterTemplate" + ''; + + build-system = with python3Packages; [ + hatchling + ]; + + dependencies = with python3Packages; [ + beautifulsoup4 + browser-cookie3 + click + cutie + error-helper + fake-useragent + inventree + isocodes + mouser + platformdirs + pyyaml + requests + requests-oauthlib + tablib + thefuzz + ]; + + pytestImportsCheck = [ "inventree_part_import" ]; + + nativeCheckInputs = [ + versionCheckHook + writableTmpDirAsHomeHook + ] + ++ (with python3Packages; [ + pytestCheckHook + ]); + + disabledTests = [ + # Requires access to inventree server + "setup_categories" + ]; + + meta = { + description = "CLI to import parts from suppliers like DigiKey, LCSC, Mouser, etc. to InvenTree"; + mainProgram = "inventree-part-import"; + homepage = "https://github.com/30350n/inventree-part-import"; + changelog = "https://github.com/30350n/inventree-part-import/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + gigahawk + ]; + }; +}) diff --git a/pkgs/development/python-modules/cutie/default.nix b/pkgs/development/python-modules/cutie/default.nix new file mode 100644 index 000000000000..60025fa60a4c --- /dev/null +++ b/pkgs/development/python-modules/cutie/default.nix @@ -0,0 +1,61 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies + readchar, + colorama, + + # tests + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "cutie"; + version = "0.3.2"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "kamik423"; + repo = "cutie"; + tag = finalAttrs.version; + hash = "sha256-Z9GNvTrCgb+EDqlhHcOjn78Pli0Uc1HuVN2FrjTQobs="; + }; + + # https://docs.python.org/3/whatsnew/3.12.html#whatsnew312-removed-imp + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "import imp" "import types" \ + --replace-fail \ + 'cutie = imp.new_module("cutie")' \ + 'cutie = types.ModuleType("cutie")' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ + colorama + readchar + ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + pythonImportsCheck = [ "cutie" ]; + + meta = { + description = "Command line User Tools for Input Easification"; + homepage = "https://github.com/kamik423/cutie"; + changelog = "https://github.com/kamik423/cutie/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + gigahawk + ]; + }; +}) diff --git a/pkgs/development/python-modules/error-helper/default.nix b/pkgs/development/python-modules/error-helper/default.nix new file mode 100644 index 000000000000..4a93a3df9655 --- /dev/null +++ b/pkgs/development/python-modules/error-helper/default.nix @@ -0,0 +1,41 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + + # build-system + hatchling, +}: + +buildPythonPackage (finalAttrs: { + pname = "error-helper"; + version = "1.5"; + pyproject = true; + __structuredAttrs = true; + + # GitHub source doesn't build correctly (fails imports check) + src = fetchPypi { + inherit (finalAttrs) version; + pname = "error_helper"; + hash = "sha256-7kbzGmidsZzhoE5p9Ddjn6oDc+HUzkN02ykS0e0JodY="; + }; + + build-system = [ + hatchling + ]; + + # No tests in the Pypi archive. + doCheck = false; + + pythonImportsCheck = [ "error_helper" ]; + + meta = { + description = "Minimalistic python module to print colorful messages"; + homepage = "https://github.com/30350n/error_helper"; + changelog = "https://github.com/30350n/error_helper/releases/tag/${finalAttrs.version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + gigahawk + ]; + }; +}) diff --git a/pkgs/development/python-modules/inventree/default.nix b/pkgs/development/python-modules/inventree/default.nix new file mode 100644 index 000000000000..abe0eb3edca0 --- /dev/null +++ b/pkgs/development/python-modules/inventree/default.nix @@ -0,0 +1,83 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies + coveralls, + invoke, + pillow, + requests, + + # tests + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "inventree"; + version = "0.21.1"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "inventree"; + repo = "inventree-python"; + tag = finalAttrs.version; + hash = "sha256-n/iJ2/xFxwRFbZKjcrbWMnx2lp7ITJsyHDLcCtdmEDI="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + coveralls + invoke + pillow + requests + ]; + + nativeCheckInputs = [ pytestCheckHook ]; + pytestImportsCheck = [ "inventree" ]; + + disabledTests = [ + # Disable tests requiring dev server + "file_download" + "timeout" + "details" + "token" + "create_stuff" + "add_result" + "add_template" + "get_widget" + ]; + + disabledTestPaths = [ + # Disable tests requiring dev server + "test/test_base.py" + "test/test_build.py" + "test/test_company.py" + "test/test_currency.py" + "test/test_internal_price.py" + "test/test_label.py" + "test/test_order.py" + "test/test_part.py" + "test/test_plugin.py" + "test/test_project_codes.py" + "test/test_report.py" + "test/test_stock.py" + ]; + + meta = { + description = "Python library for communication with inventree via API"; + homepage = "https://github.com/inventree/inventree-python/"; + changelog = "https://github.com/inventree/inventree-python/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + gigahawk + ]; + }; +}) diff --git a/pkgs/development/python-modules/isocodes/default.nix b/pkgs/development/python-modules/isocodes/default.nix new file mode 100644 index 000000000000..0119cf53411e --- /dev/null +++ b/pkgs/development/python-modules/isocodes/default.nix @@ -0,0 +1,51 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # tests + pytestCheckHook, + pyinstaller, + busybox, +}: + +buildPythonPackage (finalAttrs: { + pname = "isocodes"; + version = "2025.8.25"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "Atem18"; + repo = "isocodes"; + tag = finalAttrs.version; + hash = "sha256-rGARvUNaTZ8/CuQ2vhPRx4whYty8lJLSE+5AZTS3eQw="; + }; + + build-system = [ + setuptools + ]; + + nativeCheckInputs = [ + pyinstaller + pytestCheckHook + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + busybox + ]; + pythonImportsCheck = [ "isocodes" ]; + + meta = { + description = "This project provides lists of various ISO standards (e.g. country, language, language scripts, and currency names) in one place"; + homepage = "https://github.com/Atem18/isocodes"; + changelog = "https://github.com/Atem18/isocodes/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.lgpl21Only; + maintainers = with lib.maintainers; [ + gigahawk + ]; + }; +}) diff --git a/pkgs/development/python-modules/mouser/default.nix b/pkgs/development/python-modules/mouser/default.nix new file mode 100644 index 000000000000..52364f0fc7cd --- /dev/null +++ b/pkgs/development/python-modules/mouser/default.nix @@ -0,0 +1,55 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + poetry-core, + + # dependencies + click, + requests, + + # tests + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "mouser"; + version = "0.1.6"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "sparkmicro"; + repo = "mouser-api"; + tag = finalAttrs.version; + hash = "sha256-E8RYtuY4OONl9fI25I2utk3JfElVJHlpfCuOPvHo5Dg="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + click + requests + ]; + + nativeCheckInputs = [ pytestCheckHook ]; + pythonImportsCheck = [ "mouser" ]; + disabledTests = [ + # Search tests require an API key and network access + "search" + ]; + + meta = { + description = "Mouser Python API"; + homepage = "https://github.com/sparkmicro/mouser-api"; + changelog = "https://github.com/sparkmicro/mouser-api/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + gigahawk + ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 33eb3cf94660..8097b5d9e8f8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3452,6 +3452,8 @@ self: super: with self; { cut-cross-entropy = callPackage ../development/python-modules/cut-cross-entropy { }; + cutie = callPackage ../development/python-modules/cutie { }; + cv2-enumerate-cameras = callPackage ../development/python-modules/cv2-enumerate-cameras { }; cvelib = callPackage ../development/python-modules/cvelib { }; @@ -5120,6 +5122,8 @@ self: super: with self; { eradicate = callPackage ../development/python-modules/eradicate { }; + error-helper = callPackage ../development/python-modules/error-helper { }; + es-client = callPackage ../development/python-modules/es-client { }; escapism = callPackage ../development/python-modules/escapism { }; @@ -7669,6 +7673,8 @@ self: super: with self; { into-dbus-python = callPackage ../development/python-modules/into-dbus-python { }; + inventree = callPackage ../development/python-modules/inventree { }; + invisible-watermark = callPackage ../development/python-modules/invisible-watermark { }; invocations = callPackage ../development/python-modules/invocations { }; @@ -7791,6 +7797,8 @@ self: super: with self; { iso8601 = callPackage ../development/python-modules/iso8601 { }; + isocodes = callPackage ../development/python-modules/isocodes { }; + isodate = callPackage ../development/python-modules/isodate { }; isoduration = callPackage ../development/python-modules/isoduration { }; @@ -10306,6 +10314,8 @@ self: super: with self; { mouseinfo = callPackage ../development/python-modules/mouseinfo { }; + mouser = callPackage ../development/python-modules/mouser { }; + moviepy = callPackage ../development/python-modules/moviepy { }; moyopy = callPackage ../development/python-modules/moyopy { };