Skip to content

Commit

Permalink
Merge pull request #265256 from natsukium/line-profiler
Browse files Browse the repository at this point in the history
python311Packages.line-profiler: 4.0.2 -> 4.1.2; rename from line_profiler
  • Loading branch information
natsukium authored Nov 11, 2023
2 parents 3a99d1b + 2f188cd commit 881d394
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
{ 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;

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;

preBuild = ''
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 = [
Expand Down
70 changes: 70 additions & 0 deletions pkgs/development/python-modules/ubelt/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
48 changes: 48 additions & 0 deletions pkgs/development/python-modules/xdoctest/default.nix
Original file line number Diff line number Diff line change
@@ -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";
};
}
1 change: 1 addition & 0 deletions pkgs/top-level/python-aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };

Expand Down Expand Up @@ -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 { };
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit 881d394

Please sign in to comment.