1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 setuptools, 8 9 # dependencies 10 jsonargparse, 11 looseversion, 12 packaging, 13 tomlkit, 14 typing-extensions, 15 16 # tests 17 pytest-timeout, 18 pytestCheckHook, 19}: 20 21buildPythonPackage rec { 22 pname = "lightning-utilities"; 23 version = "0.15.2"; 24 pyproject = true; 25 26 src = fetchFromGitHub { 27 owner = "Lightning-AI"; 28 repo = "utilities"; 29 tag = "v${version}"; 30 hash = "sha256-0unIL5jylunxTJxFTN+Q4aCFtD5zIHRNWEAWSbw+Fsk="; 31 }; 32 33 postPatch = '' 34 substituteInPlace src/lightning_utilities/install/requirements.py \ 35 --replace-fail "from distutils.version import LooseVersion" "from looseversion import LooseVersion" 36 ''; 37 38 build-system = [ setuptools ]; 39 40 dependencies = [ 41 jsonargparse 42 looseversion 43 packaging 44 tomlkit 45 typing-extensions 46 ]; 47 48 pythonImportsCheck = [ "lightning_utilities" ]; 49 50 nativeCheckInputs = [ 51 pytest-timeout 52 pytestCheckHook 53 ]; 54 55 disabledTests = [ 56 # DocTestFailure 57 "lightning_utilities.core.imports.RequirementCache" 58 59 # NameError: name 'operator' is not defined. Did you forget to import 'operator' 60 "lightning_utilities.core.imports.compare_version" 61 62 # importlib.metadata.PackageNotFoundError: No package metadata was found for pytorch-lightning==1.8.0 63 "lightning_utilities.core.imports.get_dependency_min_version_spec" 64 65 # weird doctests fail on imports, but providing the dependency 66 # fails another test 67 "lightning_utilities.core.imports.ModuleAvailableCache" 68 ]; 69 70 disabledTestPaths = [ 71 "docs" 72 # doctests that expect docs.txt in the wrong location 73 "src/lightning_utilities/install/requirements.py" 74 ]; 75 76 meta = { 77 changelog = "https://github.com/Lightning-AI/utilities/releases/tag/v${version}"; 78 description = "Common Python utilities and GitHub Actions in Lightning Ecosystem"; 79 homepage = "https://github.com/Lightning-AI/utilities"; 80 license = lib.licenses.asl20; 81 maintainers = with lib.maintainers; [ GaetanLepage ]; 82 }; 83}