1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 setuptools,
9 setuptools-scm,
10
11 # dependencies
12 flexcache,
13 flexparser,
14 platformdirs,
15 typing-extensions,
16
17 # tests
18 pytestCheckHook,
19 pytest-subtests,
20 pytest-benchmark,
21 numpy,
22 matplotlib,
23 uncertainties,
24}:
25
26buildPythonPackage rec {
27 pname = "pint";
28 version = "0.24.4";
29 pyproject = true;
30
31 disabled = pythonOlder "3.9";
32
33 src = fetchFromGitHub {
34 owner = "hgrecco";
35 repo = "pint";
36 tag = version;
37 hash = "sha256-Pr+BRLj6BjEDwKJ24qxmfiJswpgQJDumAx3rT6tQHSY=";
38 };
39
40 build-system = [
41 setuptools
42 setuptools-scm
43 ];
44
45 dependencies = [
46 flexcache
47 flexparser
48 platformdirs
49 typing-extensions
50
51 # Both uncertainties and numpy are not necessarily needed for every
52 # function of pint, but needed for the pint-convert executable which we
53 # necessarily distribute with this package as it is.
54 uncertainties
55 numpy
56 ];
57
58 nativeCheckInputs = [
59 pytestCheckHook
60 pytest-subtests
61 pytest-benchmark
62 matplotlib
63 ];
64
65 pytestFlags = [ "--benchmark-disable" ];
66
67 preCheck = ''
68 export HOME=$(mktemp -d)
69 '';
70
71 meta = {
72 changelog = "https://github.com/hgrecco/pint/blob/${version}/CHANGES";
73 description = "Physical quantities module";
74 mainProgram = "pint-convert";
75 license = lib.licenses.bsd3;
76 homepage = "https://github.com/hgrecco/pint/";
77 maintainers = with lib.maintainers; [ doronbehar ];
78 };
79}