diff --git a/pkgs/development/python-modules/decopatch/default.nix b/pkgs/development/python-modules/decopatch/default.nix new file mode 100644 index 000000000000..7fa3c6465db4 --- /dev/null +++ b/pkgs/development/python-modules/decopatch/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchPypi +, makefun +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "decopatch"; + version = "1.4.8"; + + src = fetchPypi { + inherit pname version; + sha256 = "0i6i811s2j1z0cl6y177dwsbfxib8dvb5c2jpgklvc2xy4ahhsy6"; + }; + + nativeBuildInputs = [ setuptools-scm ]; + + propagatedBuildInputs = [ makefun ]; + + postPatch = '' + substituteInPlace setup.py --replace "'pytest-runner', " "" + ''; + + # Tests would introduce multiple cirucular dependencies + # Affected: makefun, pytest-cases + doCheck = false; + + pythonImportsCheck = [ "decopatch" ]; + + meta = with lib; { + description = "Python helper for decorators"; + homepage = "https://github.com/smarie/python-decopatch"; + license = licenses.bsd3; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/labelbox/default.nix b/pkgs/development/python-modules/labelbox/default.nix index ce7cff4d79b8..957b8ad5fd1f 100644 --- a/pkgs/development/python-modules/labelbox/default.nix +++ b/pkgs/development/python-modules/labelbox/default.nix @@ -1,38 +1,67 @@ { lib -, buildPythonPackage -, fetchPypi -, requests -, jinja2 -, pillow -, rasterio -, shapely -, ndjson , backoff -, google-api-core , backports-datetime-fromisoformat +, buildPythonPackage +, dataclasses +, fetchFromGitHub +, google-api-core +, jinja2 +, ndjson +, pillow +, pydantic +, pytest-cases +, pytestCheckHook +, pythonOlder +, rasterio +, requests +, shapely }: buildPythonPackage rec { pname = "labelbox"; - version = "2.5.1"; + version = "2.5.4"; + disabled = pythonOlder "3.6"; - src = fetchPypi { - inherit pname version; - sha256 = "7f2cbc5d4869d8acde865ad519fc1cc85338247cd7cf534334f988a040679219"; + src = fetchFromGitHub { + owner = "Labelbox"; + repo = "labelbox-python"; + rev = "v${version}"; + sha256 = "0182klvm8bjcm8fkl9w8ypj12s026czgid8ldl6jjvmzhxpmss68"; }; propagatedBuildInputs = [ - jinja2 requests pillow rasterio shapely ndjson backoff - google-api-core backports-datetime-fromisoformat + backoff + backports-datetime-fromisoformat + dataclasses + google-api-core + jinja2 + ndjson + pillow + pydantic + rasterio + requests + shapely + ]; + + postPatch = '' + substituteInPlace setup.py --replace "pydantic==1.8" "pydantic>=1.8" + ''; + + checkInputs = [ + pytest-cases + pytestCheckHook + ]; + + disabledTestPaths = [ + # Requires network access + "tests/integration" ]; - # Test cases are not running on pypi or GitHub - doCheck = false; pythonImportsCheck = [ "labelbox" ]; meta = with lib; { - homepage = "https://github.com/Labelbox/Labelbox"; description = "Platform API for LabelBox"; + homepage = "https://github.com/Labelbox/labelbox-python"; license = licenses.asl20; maintainers = with maintainers; [ rakesh4g ]; }; diff --git a/pkgs/development/python-modules/pytest-cases/default.nix b/pkgs/development/python-modules/pytest-cases/default.nix new file mode 100644 index 000000000000..2914b3cf9aac --- /dev/null +++ b/pkgs/development/python-modules/pytest-cases/default.nix @@ -0,0 +1,51 @@ +{ lib +, buildPythonPackage +, fetchPypi +, makefun +, decopatch +, pythonOlder +, pytest +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "pytest-cases"; + version = "3.4.6"; + disabled = pythonOlder "3.6"; + + src = fetchPypi { + inherit pname version; + sha256 = "17w4s6622i97q81g15zamqm536ib00grgdfk2f4kk9bw2k7sdlq6"; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + + buildInputs = [ + pytest + ]; + + propagatedBuildInputs = [ + decopatch + makefun + ]; + + postPatch = '' + substituteInPlace setup.cfg --replace "pytest-runner" "" + ''; + + # Tests have dependencies (pytest-harvest, pytest-steps) which + # are not available in Nixpkgs. Most of the packages (decopatch, + # makefun, pytest-*) have circular dependecies. + doCheck = false; + + pythonImportsCheck = [ "pytest_cases" ]; + + meta = with lib; { + description = "Separate test code from test cases in pytest"; + homepage = "https://github.com/smarie/python-pytest-cases"; + license = licenses.bsd3; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 18445278c1bc..33559777930e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1733,6 +1733,8 @@ in { decorator = callPackage ../development/python-modules/decorator { }; + decopatch = callPackage ../development/python-modules/decopatch { }; + deep_merge = callPackage ../development/python-modules/deep_merge { }; deepdiff = callPackage ../development/python-modules/deepdiff { }; @@ -6267,6 +6269,8 @@ in { pytest-cache = self.pytestcache; # added 2021-01-04 pytestcache = callPackage ../development/python-modules/pytestcache { }; + pytest-cases = callPackage ../development/python-modules/pytest-cases{ }; + pytest-catchlog = callPackage ../development/python-modules/pytest-catchlog { }; pytest-celery = callPackage ../development/python-modules/pytest-celery { };