depot/third_party/nixpkgs/pkgs/development/python-modules/lightning-utilities/default.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

80 lines
1.9 KiB
Nix

{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
# build
setuptools,
# runtime
looseversion,
packaging,
typing-extensions,
# tests
pytest-timeout,
pytest7CheckHook,
}:
buildPythonPackage rec {
pname = "lightning-utilities";
version = "0.11.6";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "Lightning-AI";
repo = "utilities";
rev = "refs/tags/v${version}";
hash = "sha256-Bw28mLz9GaMucqP+EqR1F3OKLxDJiIVacrCBIV35G/I=";
};
postPatch = ''
substituteInPlace src/lightning_utilities/install/requirements.py \
--replace-fail "from distutils.version import LooseVersion" "from looseversion import LooseVersion"
'';
build-system = [ setuptools ];
dependencies = [
looseversion
packaging
typing-extensions
];
pythonImportsCheck = [ "lightning_utilities" ];
nativeCheckInputs = [
pytest-timeout
pytest7CheckHook
];
disabledTests = [
"lightning_utilities.core.enums.StrEnum"
"lightning_utilities.core.imports.RequirementCache"
"lightning_utilities.core.imports.compare_version"
"lightning_utilities.core.imports.get_dependency_min_version_spec"
# weird doctests fail on imports, but providing the dependency
# fails another test
"lightning_utilities.core.imports.ModuleAvailableCache"
"lightning_utilities.core.imports.requires"
# Failed: DID NOT RAISE <class 'AssertionError'>
"test_no_warning_call"
];
disabledTestPaths = [
"docs"
# doctests that expect docs.txt in the wrong location
"src/lightning_utilities/install/requirements.py"
];
meta = {
changelog = "https://github.com/Lightning-AI/utilities/releases/tag/v${version}";
description = "Common Python utilities and GitHub Actions in Lightning Ecosystem";
homepage = "https://github.com/Lightning-AI/utilities";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}