Commit graph

4,975 commits

Author SHA1 Message Date
dcbd4b1c84 lib: Change Iterable to Collection for truthy checks
Change parameter types from Iterable[str] to Collection[str] wherever
the parameter is tested for emptiness (if not names). This satisfies
the new truthy-iterable mypy rule, since bare Iterable values are
always truthy even when empty.

Affected files:
- Distro.py: install, delete, select, _select, _select_by_name
- rpm.py: query_packages
- suse/Distro.py: _select_by_name
- Cmd.py (secrets): _match_files, _list_template_files, etc.
- DistroContext.py: list_template_files, list_secret_paths, etc.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-09 11:31:15 +00:00
cbd6bac84c pyproject.toml: Enable mypy.warn_unused_ignores
Add warn_unused_ignores = true to the mypy configuration. This warns
when a '# type: ignore' comment has no associated error code,
ensuring all type ignores are explicit about which error they suppress.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-09 11:30:33 +00:00
fec0304543 App, AsyncSSH: Allow unused "type: ignore" comments
Some '# type: ignore' comments are needed because they complain about missing
but optional third-party packages: argcomplete, paramiko, asyncssh. The next
commit will enable warn_unused_ignores, and since nor mypy nor pyright have a
way of knowing that this is a tolerable lack of packages, this commit teaches
them in advance.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-09 11:27:00 +00:00
64edcec48c
pyproject.toml: Enable mypy.disallow_any_generics
Add disallow_any_generics = true to the mypy configuration. This
requires all generic types (dict, list, Iterable, Types, etc.) to
have explicit type arguments instead of using bare generic aliases.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:27 +02:00
49bf2b2442
Distro, Cmd, AsyncSSH: Fix bare generic types
Add explicit type arguments to all generic type annotations that were
previously bare, satisfying the new disallow_any_generics mypy rule.

Fixes:
- Distro.py: Iterable[str] for expand_macros fmt parameter
- Cmd.py: Types[Any] for add_subcommands cmds parameter
- AsyncSSH.py: dict[str, Any] for _connect_kwargs return type

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:27 +02:00
7f1809d6d1
pyproject.toml: Enable mypy.strict_equality
Set mypy.strict_equality = true, forcing type-equal equality.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:27 +02:00
e464daf2f3
Distro._reboot_required(): Fix comparison
The comparison ret != 0 is comparing a Result object against the
integer 0, which is always True since Result has no __eq__ defined.

This commit fixes the bug by comparing ret.status instead, which is
the actual exit code we care about. This satisfies the new
strict_equality mypy rule which enables the comparison-overlap check.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:27 +02:00
dc14aac068
pyproject.toml: Enable mypy.warn_redundant_casts
Add warn_redundant_casts = true to the mypy configuration template.
This rule detects casts that mypy proves unnecessary, helping to
clean up redundant type casts that clutter the codebase.

This is one of the boolean-flag rules being gradually adopted from
the stricter mypy profile in /tmp/pyproject.toml. It produces just
1 error during initial rollout.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:27 +02:00
044d2cb065
util: Remove redundant cast in run_curl_into
The cast to 'T' in run_curl_into was redundant: mypy already narrows
the return value of json.loads() to type T after the isinstance(ret,
expected_type) check (where expected_type: type[T]).

Remove the unnecessary cast and clean up the unused 'cast' import.
This satisfies the new warn_redundant_casts mypy rule.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:27 +02:00
f689d083d7
pyproject.toml: Enable mypy.truthy-bool
Add the truthy-bool error code to the mypy configuration. This
detects conditions and expressions that are always truthy because
the type has no __bool__ or __len__ method.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:26 +02:00
38c776e638
lib.Distro: Fix mypy.truthy-bool fallout
The _select() method in Distro.py has an assert on a PackageFilter
parameter that doesn't define __bool__ or __len__. Since the type
signature already guarantees it is not None, the assertion is
redundant and is now removed.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:26 +02:00
7e7341bf1b
pyproject.toml: Enable mypy.possibly-undefined
Add the possibly-undefined error code to the mypy configuration.
This detects variables that may not be defined on all execution
paths, catching a class of NameError bugs at type-check time.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:26 +02:00
a9bbbb9a89
lib.log: Fix mypy.possibly-undefined fallout
The log_m() function has margs conditionally assigned inside an if
block but used unconditionally afterwards. Initialize margs outside
the if to guarantee it is always defined.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:26 +02:00
5f6559dbe0
pyproject.toml: Enable mypy.ignore-without-code
Add the ignore-without-code error code to the mypy configuration.
This requires all # type: ignore comments to include a specific error
code, improving the precision and maintainability of type ignore
annotations.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:26 +02:00
c939df2bd0
lib.AsyncRunner: Fix mypy.ignore-without-code fallout
Annotate the one existing bare "# type: ignore" in AsyncRunner.py
with arg-type and var-annotated codes to prepare for
mypy.ignore-without-code.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1
2026-08-07 18:02:26 +02:00
df5785cefd
pyproject.toml, pyrightconfig.json: Require @override
Add mypy's explicit-override error code and pyrightconfig's
reportImplicitOverride "error" directive. This requires all methods
that override base class methods to be decorated with @override from
typing. The change complements the previous commit, which added
exactly that decorator to all relevant methods.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:26 +02:00
5fa008be5a
App, lib, cmds: Fix mypy.explicit-override fallout
This commit adds @override decorators to approximately 300 methods
across 76 files that inherit from base classes such as AbstractCmd,
FileContext, ExecContext, Distro, SSHClient, and others.

The decorator ensures the type checker can verify that overridden
methods have compatible signatures and prevents accidental shadowing
of inherited methods without intent.

Files modified include command classes, library modules, distro
implementations, and SSH client implementations.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-07 18:02:26 +02:00
30a00df5c7
Release 1.0.0-249@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 3m59s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m20s
CI / Packaging test (push) Successful in 0s
2026-07-27 23:27:12 +00:00
0f03e10290
Release 1.0.0-249@kali-rolling/amd64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m41s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m19s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-07-26 23:11:51 +00:00
f7710bacf8
Start version: 1.0.0-249
Signed-off-by: janware DevOps <devops@janware.com>
2026-07-26 23:10:45 +00:00
a4306ad0c5
install-files.mk: Add missing target "test"
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m11s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m12s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m45s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m53s
CI / Packaging test (push) Successful in 0s
install-files.mk lacks a "test" target, so this commit adds a stub.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:39:22 +02:00
d306e8cbdc
projects-dir.mk: Support check targets
Add support for the targets "check" and "check-post" to
projects-dir.mk to make them usable from inside the projects
directory.

Note that "check-pre" is intentionally left out: Running "make check"
in a project before its prerequisite projects have built their
__init__.py files will fail due to broken import resolution.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:38:04 +02:00
e1ccbc1115
projects-dir.mk: Add target test
projects-dir.mk lacks a "test" target, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:36:46 +02:00
41ca202142
cmds.projects.CmdBuild: Support --dep-flavours
CmdBuild supports the targets all, clean and pkg-*. It uses builtin
dependency flavours matching those targets to resolve build order. To
make it more flexible in general, and allow it to support more
targets, e.g. "check" and "test", this commit adds a --dep-flavours
option.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:35:27 +02:00
b7431e5bc6
rules.mk / defs.mk: Disable BUILD_MAKEDIR
BUILD_MAKEDIR is a variable which exists for consistency's sake. On
the other hand, nor jw-pkg nor any downstream package ever copies
makefile snippets during build time. The rule introduced by
BUILD_MAKEDIR is quite costly in terms of performance and makes
caching harder to understand. This commit disables the variable.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:34:08 +02:00
79edaff1dd
py-path.mk: Add target py-path
Add target py-path to py-path.mk. At this point, it's mostly
introduced for documentation purposes, giving people and machines a
defined, easily accessible and omni-present way to determine how
Python imports should be resolved.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:32:51 +02:00
4bf6445412
py-check.mk: Add target py-check-bad-patterns
Add target py-check-bad-patterns, which currently looks for leftover
breakpoints and orphaned "export" comments on the closing line of a
function prototype.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:31:34 +02:00
dcbe959843
lib: Fix misplaced "# export" markers
A couple of "# export" markers after function prototypes have been
pushed along with the closing parenthesis onto the wrong line by the
code formatter, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:30:17 +02:00
eea3e5f14b
py-check.mk: Add file
Add py-check.mk and use it from py-topdir.mk and py-rules.mk. This
removes redundant check definitions, making sure that that checks run
from a repo's subdirectory match the checks run from its toplevel
directory.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:28:59 +02:00
c63b3cc06f
py-defs.mk: Allow inclusion without defs.mk
py-defs.mk uses the variables ECHO and SED defined in defs.mk. The
complexity this introduces doesn't justify the reduced redundancy,
though, so this commit defines them redundantly in py-defs.mk and to
allow inclusion without prior defs.mk.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:27:43 +02:00
6743808000
py-run.mk: Remove dead code
Remove disabled included statements which are not going to be enabled
anymore.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:26:26 +02:00
d59dba37e0
ldlibpath.mk: Don't include py-path.mk anylonger
For backwards compatibility, ldlibpath.mk kept py-path.mk included.
The projects depending on that have been fixed by now and this is no
longer needed. So, move it to the py-defs.mk where it belongs and has
narrower scope.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:25:09 +02:00
100d8f9abb
test/integration/jw-pkg/projects/cache: Add directory
Add tests for jw-pkg.py calls run during makefile caching. Broken
caching can compromise the build without causing it to fail entirely,
i.e. in non-obvious ways.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:23:52 +02:00
c8ffae57fc
test/integration/jw-pkg/projects: Add directory
Add a directory for integration tests of "jw-pkg projects".

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:22:37 +02:00
1062be24db
App: Remove hardcoded local/src from App and defs.mk
local/src is a janware-specific path, remove it from App and defs.mk.
It's still in pkg.sh as a safety measure. Will have to go, too, but
is kept in for now until further audit.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:20:18 +02:00
701d8a33e7
lib.ec.ssh.Paramiko: Tolerate import-not-found
Tolera$te missing paramiko imports. jw-pkg is designed to
work with what it finds and use plain /usr/bin/ssh if need
be.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:08:28 +02:00
4f91d47b25
Release 1.0.0-248@kali-rolling/amd64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m40s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m13s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-07-22 23:11:19 +00:00
5b4710b613
Start version: 1.0.0-248
Signed-off-by: janware DevOps <devops@janware.com>
2026-07-22 23:10:13 +00:00
36af4a590f
py-xxx.mk: Clean more python tool caches
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m6s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m6s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m2s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m54s
CI / Packaging test (push) Successful in 0s
.mypy_cache, .ruff_cache and .pytest_cache are not consistently
cleaned in all subdirectories. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 14:41:38 +02:00
d90c0ebf18
cache.mk: Include from topdir.mk, not make.mk
During a topdir "make all", caching variables is currently not the
first thing that happens. Instead, variables are cached as soon as a
project recurses into the make subdirectory. That was necessary,
because some makefiles were regenerated in the make subdirectory by
autoconf, potentially contributing variables that needed to be
cached.

As of now, autoconf is long gone and this is no longer true. And for
some variables, the two step process becomes involved, notably for
PYTHONPATH, which coding agents would like to look at from the topdir
very early on.

This commit moves the .project-cache.mk creation to topdir.mk, and
.projects-cache.mk creation to jw-pkg/Makefile to address that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 14:38:24 +02:00
193c2ee0bd
py-topdir.mk: PY_CHECK_ROOTS: Don't += assign
py-topdir.mk has this:

  ifndef PY_CHECK_ROOTS
    PY_CHECK_ROOTS += ...
  endif

That is too involved: Either PY_CHECK_ROOTS is defined, then nothing
is appended, or it's undefined, then a simple "=" would be just fine.
Use that instead.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 12:34:05 +02:00
6325f9ea19
platform.mk: Fix make -C $(TOPDIR)/make clean all
If run from $(TOPDIR), "make clean all" runs fine, because it
recurses twice into $(TOPDIR)/make, once for every target. If invoked
directly from $(TOPDIR)/make, it can break in two different ways:

If the cache files don't exist, "make clean all" in $(TOPDIR)/make
tries to create them too early as implicit make target. This leaves
variables empty which should have a value.

If the cache files do exist, "make clean all" in $(TOPDIR)/make
includes them, cleans them, and re-creates them from the same
variables just read from cache. Undesirable for cache purging.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 12:34:05 +02:00
11ccaef832
cmds.projects.CmdPythonpath: Reverse PYTHONPATH
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m48s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m55s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m46s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m54s
CI / Packaging test (push) Successful in 0s
CmdPythonpath, AKA pythonpath, prints a PYTHONPATH which runs from
root first to dependency leaves last. This works now but doesn't
give local overrides the advantage it should. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 12:01:30 +02:00
60bd4b461b
cmds.projects.CmdCreateFile: Add self to extra_paths
pyrightconfig.json as generated by CmdCreateFile, doesn't contain the
repository's own Python source location in "extra_paths", fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 12:01:29 +02:00
96409e50f7
lib.Uri: Treat paths starting with "~" specially
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m50s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m51s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m50s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m10s
CI / Packaging test (push) Successful in 0s
An Uri instance constructed from "~/some/path" returns
"file://~/some/path" as the .full property, i.e. with the "~" in the
authority part. That's not accurate and doesn't make the intended
sense in an URL context, see RFC 8089:

  Common UNIX shells such as the Bourne-Again SHell (bash) and Z
  SHell (zsh) provide a function known as "tilde expansion"
  [Bash-Tilde] or "filename expansion" [Zsh-Tilde], where a path
  that begins with a tilde character "~" can be expanded out to a
  special directory name.  No such facility exists using the file
  URI scheme; a tilde in a file URI is always just a tilde.

The "fix" introduced by this commit makes .full return the path
without file:// prepended. That's conservative. It could also chose
to expand the tilde, which is arguably cleaner. To be introduced by a
later change after this commit has seen more coverage.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 11:40:56 +02:00
2c38c8a144
lib.distros.suse.Distro: Fix duplicate zypper opts
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m16s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m10s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m48s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m17s
CI / Packaging test (push) Successful in 0s
In non-interactive mode, "zypper dup" runs with the options
--force-resolution and --auto-agree-with-licenses duplicated, fix
that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 11:06:58 +02:00
7f19432360
lib.Types: Exception log beautification
Be a bit more verbose if a broken (i.e. non-class-type) type filter
parameter gets passed.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 11:06:58 +02:00
db09928ffa
cmds.projects.CmdBuild: Code and log beautification
Improve CmdBuild some more:

 - Fix more broken f-strings
 - Better varable name prereq_type -> dep_flavour
 - Add stricter typing
 - Beautify logging

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 11:06:58 +02:00
d3e581f03d
create-mkspec.sh: Tolerate comma-separated subpackages
subpackages = "run, devel" is not tolerated by create-mkspec.sh. It
expects "run devel", which goes against the grain of the other
metadata, so make it at least tolerate the more common
comma-separated variant.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 11:06:58 +02:00
670472abf5
cmds.CmdPlatform: Fix typo "comamnds" -> "commands"
CmdPlatform's help message contains the string "comamnds", fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 11:06:58 +02:00