python3Packages.auto-lazy-imports: init at 0.4.2 (#405188)
This commit is contained in:
@@ -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 ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
hatch-vcs,
|
||||
hatchling,
|
||||
pytestCheckHook,
|
||||
build,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "hatch-autorun";
|
||||
version = "1.1.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ofek";
|
||||
repo = "hatch-autorun";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-79k3KolvmjGf8ubCQMhtOH5+OeqQrmz2Q6r0ZG98424=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
hatch-vcs
|
||||
hatchling
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
hatchling
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
"hatch_autorun"
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
build
|
||||
];
|
||||
|
||||
disabledTestPaths = [
|
||||
# requires network via invoking pip
|
||||
"tests/test_build.py"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Hatch build hook plugin to inject code that will automatically run";
|
||||
homepage = "https://github.com/ofek/hatch-autorun";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ pbsds ];
|
||||
};
|
||||
}
|
||||
@@ -1122,6 +1122,8 @@ self: super: with self; {
|
||||
|
||||
authres = callPackage ../development/python-modules/authres { };
|
||||
|
||||
auto-lazy-imports = callPackage ../development/python-modules/auto-lazy-imports { };
|
||||
|
||||
autobahn = callPackage ../development/python-modules/autobahn { };
|
||||
|
||||
autocommand = callPackage ../development/python-modules/autocommand { };
|
||||
@@ -6230,6 +6232,8 @@ self: super: with self; {
|
||||
|
||||
hatasmota = callPackage ../development/python-modules/hatasmota { };
|
||||
|
||||
hatch-autorun = callPackage ../development/python-modules/hatch-autorun { };
|
||||
|
||||
hatch-babel = callPackage ../development/python-modules/hatch-babel { };
|
||||
|
||||
hatch-fancy-pypi-readme = callPackage ../development/python-modules/hatch-fancy-pypi-readme { };
|
||||
|
||||
Reference in New Issue
Block a user