1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build
7 setuptools,
8
9 # runtime
10 looseversion,
11 packaging,
12 typing-extensions,
13
14 # tests
15 pytest-timeout,
16 pytest7CheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "lightning-utilities";
21 version = "0.11.9";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "Lightning-AI";
26 repo = "utilities";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-7fRn7KvB7CEq8keVR8nrf6IY2G8omAQqNX+DPEf+7nc=";
29 };
30
31 postPatch = ''
32 substituteInPlace src/lightning_utilities/install/requirements.py \
33 --replace-fail "from distutils.version import LooseVersion" "from looseversion import LooseVersion"
34 '';
35
36 build-system = [ setuptools ];
37
38 dependencies = [
39 looseversion
40 packaging
41 typing-extensions
42 ];
43
44 pythonImportsCheck = [ "lightning_utilities" ];
45
46 nativeCheckInputs = [
47 pytest-timeout
48 pytest7CheckHook
49 ];
50
51 disabledTests = [
52 "lightning_utilities.core.enums.StrEnum"
53 "lightning_utilities.core.imports.RequirementCache"
54 "lightning_utilities.core.imports.compare_version"
55 "lightning_utilities.core.imports.get_dependency_min_version_spec"
56 # weird doctests fail on imports, but providing the dependency
57 # fails another test
58 "lightning_utilities.core.imports.ModuleAvailableCache"
59 "lightning_utilities.core.imports.requires"
60 # Failed: DID NOT RAISE <class 'AssertionError'>
61 "test_no_warning_call"
62 ];
63
64 disabledTestPaths = [
65 "docs"
66 # doctests that expect docs.txt in the wrong location
67 "src/lightning_utilities/install/requirements.py"
68 ];
69
70 meta = {
71 changelog = "https://github.com/Lightning-AI/utilities/releases/tag/v${version}";
72 description = "Common Python utilities and GitHub Actions in Lightning Ecosystem";
73 homepage = "https://github.com/Lightning-AI/utilities";
74 license = lib.licenses.asl20;
75 maintainers = with lib.maintainers; [ GaetanLepage ];
76 };
77}