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 Cache to speed up tests
|
||||||
.nix/
|
.nix/
|
||||||
|
.nix-dev-installed
|
||||||
|
|
||||||
# Ignore logs
|
# Ignore logs
|
||||||
*.log
|
*.log
|
||||||
|
|||||||
23
flake.nix
23
flake.nix
@@ -25,7 +25,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
packages = forAllSystems (system:
|
packages = forAllSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
pyPkgs = pkgs.python311Packages;
|
pyPkgs = pkgs.python311Packages;
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
pyPkgs.wheel
|
pyPkgs.wheel
|
||||||
];
|
];
|
||||||
|
|
||||||
# Runtime dependencies (matches [project.dependencies])
|
# Runtime dependencies (matches [project.dependencies] in pyproject.toml)
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
pyPkgs.pyyaml
|
pyPkgs.pyyaml
|
||||||
pyPkgs.pip
|
pyPkgs.pip
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
pythonImportsCheck = [ "pkgmgr" ];
|
pythonImportsCheck = [ "pkgmgr" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
default = pkgmgr;
|
default = pkgmgr;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -65,29 +66,35 @@
|
|||||||
devShells = forAllSystems (system:
|
devShells = forAllSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
pkgmgrPkg = self.packages.${system}.pkgmgr;
|
|
||||||
|
|
||||||
ansiblePkg =
|
ansiblePkg =
|
||||||
if pkgs ? ansible-core then pkgs.ansible-core
|
if pkgs ? ansible-core then pkgs.ansible-core
|
||||||
else pkgs.ansible;
|
else pkgs.ansible;
|
||||||
|
|
||||||
# Python 3 + pip für alles, was "python3 -m pip" macht
|
# Python 3.11 + pip + PyYAML direkt aus Nix
|
||||||
pythonWithPip = pkgs.python3.withPackages (ps: [
|
pythonWithDeps = pkgs.python311.withPackages (ps: [
|
||||||
ps.pip
|
ps.pip
|
||||||
|
ps.pyyaml
|
||||||
]);
|
]);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pythonWithPip
|
pythonWithDeps
|
||||||
pkgmgrPkg
|
|
||||||
pkgs.git
|
pkgs.git
|
||||||
ansiblePkg
|
ansiblePkg
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
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 "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]
|
[tool.setuptools.package-data]
|
||||||
"config" = ["defaults.yaml"]
|
"config" = ["defaults.yaml"]
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ docker run --rm \
|
|||||||
set -e;
|
set -e;
|
||||||
git config --global --add safe.directory /src || true;
|
git config --global --add safe.directory /src || true;
|
||||||
nix develop .#default --no-write-lock-file -c \
|
nix develop .#default --no-write-lock-file -c \
|
||||||
python -m unittest discover \
|
python3 -m unittest discover \
|
||||||
-s tests/integration \
|
-s tests/integration \
|
||||||
-t /src \
|
-t /src \
|
||||||
-p "$TEST_PATTERN";
|
-p "$TEST_PATTERN";
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ docker run --rm \
|
|||||||
set -e;
|
set -e;
|
||||||
git config --global --add safe.directory /src || true;
|
git config --global --add safe.directory /src || true;
|
||||||
nix develop .#default --no-write-lock-file -c \
|
nix develop .#default --no-write-lock-file -c \
|
||||||
python -m unittest discover \
|
python3 -m unittest discover \
|
||||||
-s tests/unit \
|
-s tests/unit \
|
||||||
-t /src \
|
-t /src \
|
||||||
-p "$TEST_PATTERN";
|
-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