Refine Nix dev shell, ensure PyYAML availability, fix Python invocation, and
expose pkgmgr.cli for Python 3.13 compatibility - Add `.nix-dev-installed` to .gitignore - Improve flake.nix: * unify pkgs/pyPkgs definitions * provide python311.withPackages including pip + PyYAML * remove unused pkgmgrPkg reference from devShell * fix PYTHONPATH export and devShell help message - Update unit/integration test scripts to use `python3 -m unittest` - Add top-level pkgmgr.__init__ exposing `cli` attribute for pkgutil.resolve_name compatibility under Python 3.13+
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,6 +26,7 @@ Thumbs.db
|
||||
|
||||
# Nix Cache to speed up tests
|
||||
.nix/
|
||||
.nix-dev-installed
|
||||
|
||||
# Ignore logs
|
||||
*.log
|
||||
|
||||
21
flake.nix
21
flake.nix
@@ -45,7 +45,7 @@
|
||||
pyPkgs.wheel
|
||||
];
|
||||
|
||||
# Runtime dependencies (matches [project.dependencies])
|
||||
# Runtime dependencies (matches [project.dependencies] in pyproject.toml)
|
||||
propagatedBuildInputs = [
|
||||
pyPkgs.pyyaml
|
||||
pyPkgs.pip
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
pythonImportsCheck = [ "pkgmgr" ];
|
||||
};
|
||||
|
||||
default = pkgmgr;
|
||||
}
|
||||
);
|
||||
@@ -65,29 +66,35 @@
|
||||
devShells = forAllSystems (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgmgrPkg = self.packages.${system}.pkgmgr;
|
||||
|
||||
ansiblePkg =
|
||||
if pkgs ? ansible-core then pkgs.ansible-core
|
||||
else pkgs.ansible;
|
||||
|
||||
# Python 3 + pip für alles, was "python3 -m pip" macht
|
||||
pythonWithPip = pkgs.python3.withPackages (ps: [
|
||||
# Python 3.11 + pip + PyYAML direkt aus Nix
|
||||
pythonWithDeps = pkgs.python311.withPackages (ps: [
|
||||
ps.pip
|
||||
ps.pyyaml
|
||||
]);
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pythonWithPip
|
||||
pkgmgrPkg
|
||||
pythonWithDeps
|
||||
pkgs.git
|
||||
ansiblePkg
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
# Ensure src/ layout is importable:
|
||||
# pkgmgr lives in ./src/pkgmgr
|
||||
export PYTHONPATH="$PWD/src:${PYTHONPATH:-}"
|
||||
# Also add repo root in case tools/tests rely on it
|
||||
export PYTHONPATH="$PWD:$PYTHONPATH"
|
||||
|
||||
echo "Entered pkgmgr development shell for ${system}"
|
||||
echo "pkgmgr CLI is available via the flake build"
|
||||
echo "pkgmgr CLI (from source) is available via:"
|
||||
echo " python -m pkgmgr.cli --help"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -49,4 +49,3 @@ include = ["pkgmgr*", "config*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"config" = ["defaults.yaml"]
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ docker run --rm \
|
||||
set -e;
|
||||
git config --global --add safe.directory /src || true;
|
||||
nix develop .#default --no-write-lock-file -c \
|
||||
python -m unittest discover \
|
||||
python3 -m unittest discover \
|
||||
-s tests/integration \
|
||||
-t /src \
|
||||
-p "$TEST_PATTERN";
|
||||
|
||||
@@ -20,7 +20,7 @@ docker run --rm \
|
||||
set -e;
|
||||
git config --global --add safe.directory /src || true;
|
||||
nix develop .#default --no-write-lock-file -c \
|
||||
python -m unittest discover \
|
||||
python3 -m unittest discover \
|
||||
-s tests/unit \
|
||||
-t /src \
|
||||
-p "$TEST_PATTERN";
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
"""
|
||||
Top-level package for Kevin's package manager (pkgmgr).
|
||||
|
||||
We re-export the CLI subpackage as the attribute ``cli`` so that
|
||||
``pkgutil.resolve_name("pkgmgr.cli.commands.release")`` and similar
|
||||
lookups work reliably under Python 3.13+.
|
||||
"""
|
||||
|
||||
# Re-export the CLI subpackage as an attribute on the package.
|
||||
from . import cli as cli # type: ignore[F401]
|
||||
|
||||
__all__ = ["cli"]
|
||||
|
||||
Reference in New Issue
Block a user