diff --git a/pkgs/development/python-modules/line_profiler/default.nix b/pkgs/development/python-modules/line-profiler/default.nix similarity index 73% rename from pkgs/development/python-modules/line_profiler/default.nix rename to pkgs/development/python-modules/line-profiler/default.nix index d929b5e214bf9d..10decb4f3f5231 100644 --- a/pkgs/development/python-modules/line_profiler/default.nix +++ b/pkgs/development/python-modules/line-profiler/default.nix @@ -1,19 +1,19 @@ { lib , buildPythonPackage , fetchPypi -, cython +, cython_3 , isPyPy , ipython -, python , scikit-build , cmake , pythonOlder , pytestCheckHook +, ubelt }: buildPythonPackage rec { pname = "line-profiler"; - version = "4.0.2"; + version = "4.1.2"; format = "setuptools"; disabled = pythonOlder "3.6" || isPyPy; @@ -21,22 +21,23 @@ buildPythonPackage rec { src = fetchPypi { pname = "line_profiler"; inherit version; - hash = "sha256-JejJ1CSNxIkFgBhR/4p1ucdIJ6CHHRGNEQTY5D1/sPw="; + hash = "sha256-qlZXiw/1p1b+GAs/2nvWfCe71Hiz0BJGEtjPAOSiHfI="; }; nativeBuildInputs = [ - cython + cython_3 cmake scikit-build ]; - propagatedBuildInputs = [ - ipython - ]; + passthru.optional-dependencies = { + ipython = [ ipython ]; + }; nativeCheckInputs = [ pytestCheckHook - ]; + ubelt + ] ++ passthru.optional-dependencies.ipython; dontUseCmakeConfigure = true; @@ -44,8 +45,9 @@ buildPythonPackage rec { rm -f _line_profiler.c ''; - checkPhase = '' - PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH cd tests && ${python.interpreter} -m unittest discover -s . + preCheck = '' + rm -r line_profiler + export PATH=$out/bin:$PATH ''; pythonImportsCheck = [ diff --git a/pkgs/development/python-modules/ubelt/default.nix b/pkgs/development/python-modules/ubelt/default.nix new file mode 100644 index 00000000000000..a85be00ddf799e --- /dev/null +++ b/pkgs/development/python-modules/ubelt/default.nix @@ -0,0 +1,70 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchFromGitHub +, pythonOlder +, setuptools +, wheel +, numpy +, python-dateutil +, xxhash +, pytestCheckHook +, requests +, xdoctest +}: + +buildPythonPackage rec { + pname = "ubelt"; + version = "1.3.4"; + pyproject = true; + + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "Erotemic"; + repo = "ubelt"; + rev = "refs/tags/v${version}"; + hash = "sha256-pvCmmdPRLupMUCiOvfa+JTX8NPFZ/UcXSPEaaDG3eTk="; + }; + + nativeBuildInputs = [ + setuptools + wheel + ]; + + passthru.optional-dependencies = { + optional = [ + numpy + python-dateutil + xxhash + ]; + }; + + nativeCheckInputs = [ + pytestCheckHook + requests + xdoctest + ]; + + preCheck = '' + export HOME=$TMPDIR + ''; + + disabledTests = lib.optionals stdenv.isDarwin [ + # fail due to sandbox environment + "CacheStamp.expired" + "userhome" + ]; + + pythonImportsCheck = [ "ubelt" ]; + + __darwinAllowLocalNetworking = true; + + meta = with lib; { + description = "A Python utility library with a stdlib like feel and extra batteries. Paths, Progress, Dicts, Downloads, Caching, Hashing: ubelt makes it easy"; + homepage = "https://github.com/Erotemic/ubelt"; + changelog = "https://github.com/Erotemic/ubelt/blob/${src.rev}/CHANGELOG.md"; + license = licenses.asl20; + maintainers = with maintainers; [ natsukium ]; + }; +} diff --git a/pkgs/development/python-modules/xdoctest/default.nix b/pkgs/development/python-modules/xdoctest/default.nix new file mode 100644 index 00000000000000..357e605d853495 --- /dev/null +++ b/pkgs/development/python-modules/xdoctest/default.nix @@ -0,0 +1,48 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonOlder +, setuptools +, wheel +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "xdoctest"; + version = "1.1.2"; + pyproject = true; + + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "Erotemic"; + repo = "xdoctest"; + rev = "refs/tags/v${version}"; + hash = "sha256-yTu5ldr9TkpYRP8hjgUPpexBVLjaK2gfPvISjMJLY74="; + }; + + nativeBuildInputs = [ + setuptools + wheel + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + preCheck = '' + export HOME=$TMPDIR + export PATH=$out/bin:$PATH + ''; + + pythonImportsCheck = [ "xdoctest" ]; + + meta = with lib; { + description = "A rewrite of Python's builtin doctest module (with pytest plugin integration) with AST instead of REGEX"; + homepage = "https://github.com/Erotemic/xdoctest"; + changelog = "https://github.com/Erotemic/xdoctest/blob/${src.rev}/CHANGELOG.md"; + license = licenses.asl20; + maintainers = with maintainers; [ natsukium ]; + mainProgram = "xdoctest"; + }; +} diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index b23c39627f8159..ea0ab64e20498f 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -221,6 +221,7 @@ mapAliases ({ lazr_delegates = lazr-delegates; # added 2023-11-03 lazy_imports = lazy-imports; # added 2023-10-13 lektor = throw "lektor has been promoted to a top-level attribute"; # added 2023-08-01 + line_profiler = line-profiler; # added 2023-11-04 logilab_astng = throw "logilab-astng has not been released since 2013 and is unmaintained"; # added 2022-11-29 logilab_common = logilab-common; # added 2022-11-21 loo-py = loopy; # added 2022-05-03 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 8d631c0e2f6a06..8837eaac5da0ea 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6336,7 +6336,7 @@ self: super: with self; { lineedit = callPackage ../development/python-modules/lineedit { }; - line_profiler = callPackage ../development/python-modules/line_profiler { }; + line-profiler = callPackage ../development/python-modules/line-profiler { }; linetable = callPackage ../development/python-modules/linetable { }; @@ -15159,6 +15159,8 @@ self: super: with self; { uasiren = callPackage ../development/python-modules/uasiren { }; + ubelt = callPackage ../development/python-modules/ubelt { }; + uc-micro-py = callPackage ../development/python-modules/uc-micro-py { }; ucsmsdk = callPackage ../development/python-modules/ucsmsdk { }; @@ -15789,6 +15791,8 @@ self: super: with self; { xdis = callPackage ../development/python-modules/xdis { }; + xdoctest = callPackage ../development/python-modules/xdoctest { }; + xdot = callPackage ../development/python-modules/xdot { inherit (pkgs) graphviz; };