1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonAtLeast,
6
7 # build
8 setuptools,
9
10 # runtime
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.2";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "Lightning-AI";
26 repo = "utilities";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-IT9aRAUNc2cP2erLr0MglZSVLfDjOxg8PVIIe9AvO0o=";
29 };
30
31 build-system = [ setuptools ];
32
33 dependencies = [
34 packaging
35 typing-extensions
36 ];
37
38 pythonImportsCheck = [ "lightning_utilities" ];
39
40 nativeCheckInputs = [
41 pytest-timeout
42 pytest7CheckHook
43 ];
44
45 disabledTests = [
46 "lightning_utilities.core.enums.StrEnum"
47 "lightning_utilities.core.imports.RequirementCache"
48 "lightning_utilities.core.imports.compare_version"
49 "lightning_utilities.core.imports.get_dependency_min_version_spec"
50 # weird doctests fail on imports, but providing the dependency
51 # fails another test
52 "lightning_utilities.core.imports.ModuleAvailableCache"
53 "lightning_utilities.core.imports.requires"
54 # Failed: DID NOT RAISE <class 'AssertionError'>
55 "test_no_warning_call"
56 ];
57
58 disabledTestPaths = [
59 "docs"
60 # doctests that expect docs.txt in the wrong location
61 "src/lightning_utilities/install/requirements.py"
62 ];
63
64 pytestFlagsArray = [
65 # warns about distutils removal in python 3.12
66 "-W"
67 "ignore::DeprecationWarning"
68 ];
69
70 meta = with lib; {
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 = licenses.asl20;
75 maintainers = with maintainers; [ GaetanLepage ];
76 broken = pythonAtLeast "3.12";
77 };
78}