push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
{
lib,
python,
buildPythonPackage,
fetchFromGitHub,
hatchling,
hatch-autorun,
pytestCheckHook,
runCommand,
}:
buildPythonPackage rec {
pname = "auto-lazy-imports"; # matches pypi
version = "0.4.2";
pyproject = true;
src = fetchFromGitHub {
owner = "hmiladhia";
repo = "lazyimports";
tag = "v${version}";
hash = "sha256-DPk/fupBuYmm7Xy5+qFkqeRoglflECuX8A0C2ncARhI=";
};
build-system = [
hatchling
hatch-autorun
];
pythonImportsCheck = [
"lazyimports"
];
nativeCheckInputs = [
pytestCheckHook
];
preInstallCheck = ''
if [[ -f "$out/${python.sitePackages}"/hatch_autorun_auto_lazy_imports.pth ]]; then
echo >&2 "Found hatch_autorun_auto_lazy_imports.pth in site-packages"
else
echo >&2 "ERROR: no hatch_autorun_auto_lazy_imports.pth file found in site-packages, please re-check derivation assumptions"
false
fi
'';
preCheck = ''
# Makes python load the .pth file in site-packages
export NIX_PYTHONPATH="$out/${python.sitePackages}''${NIX_PYTHONPATH:+:"$NIX_PYTHONPATH"}"
'';
# check if NIX_PYTHONPATH is properly set in downstream environments
passthru.tests = {
check-autorun-pyenv =
runCommand "${pname}-check-autorun-pyenv"
{
nativeBuildInputs = [
(python.withPackages (ps: [
ps.auto-lazy-imports
ps.pytest
]))
];
}
''
pytest ${src}/tests && touch $out
'';
# TODO: this requires user to set NIX_PYTHONPATH
# check-autorun-env =
# runCommand "${pname}-check-autorun-env"
# {
# nativeBuildInputs = [
# python
# python.pkgs.auto-lazy-imports
# python.pkgs.pytest
# ];
# }
# ''
# pytest ${src}/tests && touch $out
# '';
};
meta = {
description = "Enable lazy imports using native python syntax";
homepage = "https://github.com/hmiladhia/lazyimports";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ pbsds ];
};
}