Commit graph

5,070 commits

Author SHA1 Message Date
d8ed0c95d3
lib.App: Warn on invalid exit status
__run() only accepts a return value from _run() as the process exit
status if it is an int between 0 and 255, and silently drops any other
value. A command that returns, for instance, 300 therefore exits with
status 0, which presents a failure as a success to the caller without
any trace of the mistake.

Log an error when the returned exit status is out of range so that the
programming error is visible, while still exiting with 0 instead of
passing an invalid status to the shell.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:47 +02:00
3ac649cdf1
lib.App: Tidy up subcommand registration
The subcommand registration in _build_parser() defines a SubCommand
helper class inside the add_cmds_to_parser() closure, so a fresh class
object is created on every call. It also stores command names and
aliases in a dictionary without checking for duplicates, so a colliding
name or alias is silently overwritten, and it relies on every subparser
level sharing the dest = 'command' attribute to descend one level per
re-parse, an invariant that is not documented anywhere.

Hoist the helper to a module-level _SubCommand NamedTuple, log a
warning when a subcommand name or alias collides with an earlier one at
the same level, and document the dest = 'command' invariant next to the
re-parse.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:47 +02:00
0be539a40a
lib.App: Use parser in _add_arguments()
_add_arguments() adds the global options to self.__parser instead of
to the parser it receives. The two are the same object, because the
only caller passes self.__parser, so the change is not observable.

Use the parser parameter instead, so that the method honors its
argument the way Cmd.add_arguments() does, and so that the global
options can be shared with other parsers, e.g. the subcommand
parsers, without rewriting this method.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:47 +02:00
f706477f18
lib.App: Use args parameter in _run()
_run() receives the parsed arguments as its args parameter, but then
checks the private __args attribute for the func attribute and resolves
the command function through the args property. Both refer to the same
object today, so the mixing is harmless, but it obscures the data flow
and would silently diverge if a caller ever passed a namespace other
than the stored one.

Use the args parameter consistently in _run().

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:47 +02:00
3fce4b27f8
lib.App: Rebuild parser from run() argv
__init__() builds the parser and the lazy subcommand registration
inside it decides which subcommands to register by re-parsing
sys.argv. run() then parses a different argv, so if the caller passes
an argv that is deeper than the one in sys.argv, the required
subparsers have not been registered and the invocation fails with an
"unrecognized arguments" error. run_sub_commands() passes argv to
run(), so the mismatch is reachable from the public API.

Move the parser construction from __init__() into _build_parser() and
call it from run() when an argv is given, so that registration and
parsing are driven by the same command line. The top-level command
instances are created once in __init__() and reused when the parser
is rebuilt.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:46 +02:00
845601ff10
lib.App: Restore previous event loop in run()
When run() creates an event loop, it installs it with
set_event_loop() but never restores the thread's previous loop, so
after run() returns, the thread is left with the now-closed loop
created by run(). Any code that calls get_event_loop() afterwards
gets a closed loop, and on Python 3.13+ a thread that had no loop at
all starts emitting or raising deprecation errors that run() caused.

Capture the thread's current loop with _get_current_event_loop()
before installing a new one, and restore it in the finally block. If
there was no previous loop, unset the loop with set_event_loop(None)
so that the thread is left without a loop instead of with the closed
one.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:46 +02:00
157fa86fb7
lib.App: Release async runner in close()
close() closes the application's own event loop, but the AsyncRunner
is only released in the finally block of run(). An application that
creates a runner through call_async() and then calls close(), for
instance through the async context manager, therefore leaks the
runner, and close() does not fulfill its contract of releasing all
resources.

Move the AsyncRunner cleanup from the finally block of run() into
close() and reset the own-loop flag when the loop is closed, so that
close() releases everything and run() only has to call it.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:46 +02:00
679e66898e
lib.App: Implement __aenter__() and __aexit__()
__aenter__() and __aexit__() are empty stubs. Using the application
as an async context manager therefore binds None in the as clause,
and releases nothing on exit: an AsyncRunner created through
call_async() keeps running in its thread, and since that thread is
not a daemon, the process does not exit after the block.

Return self from __aenter__(), and call close() from __aexit__(), so
that the context manager binds the application and releases all
resources on exit, whether the block exits normally or with an
exception.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:46 +02:00
8c47726a8d
lib.App: Fix crash on invalid log options
The --log-level and --log-flags options are added without a type
converter, so argparse never validates their values. _build_parser()
then hands the raw string to set_log_level() and set_log_flags() during
its first parse, and an unparseable value such as "INVALID" crashes
__init__() with a raw ValueError traceback instead of a usage error.

Pass type = parse_log_level() and type = parse_log_flags() when adding
the options, so that argparse reports invalid values with the standard
usage error and exit status 2. argparse only applies the converter to
command-line strings, so the int and LogFlag defaults are unaffected.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-15 15:58:46 +02:00
25fc4d89f7
pkg.lib.App: Fix event loop for Python 3.14+
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m36s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m24s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m17s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m18s
CI / Packaging test (push) Successful in 0s
asyncio.get_event_loop() is removed in Python 3.14 when called from
outside an async context. The current code calls it in __init__(),
which crashes on 3.14+.

To fix this, drop the eager loop creation from __init__(). Instead,
lazily create a loop in run() via asyncio.new_event_loop() when no
external loop was provided, and close it in the finally block. This
makes the lifecycle symmetric: run() owns the full create-use-close
cycle and supports re-entrant calls.

Replace __del__() with an explicit close() method, guarding against
double-close via is_closed(). close() always clears __eloop to None
so a closed loop never lingers.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-14 22:53:57 +02:00
147d7eb566
Release 1.0.0-252@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 3m45s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m6s
CI / Packaging test (push) Successful in 0s
2026-08-12 03:57:37 +00:00
965f7bba05
Release 1.0.0-252@kali-rolling/amd64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 4m6s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m59s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-12 03:33:22 +00:00
34169e7f71
Start version: 1.0.0-252
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-12 03:32:24 +00:00
6e988bea21
projects-dir.mk: Add diff-projects target
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m6s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m18s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m40s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m7s
CI / Packaging test (push) Successful in 0s
The diff-all and diff targets diff all projects in the workspace
without filtering.

Add a target "diff-projects". It sets PGIT_SH_PROJECTS to the list of
projects from build-order, limiting the diff to the dependency
closure around $(PROJECTS).

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-11 16:45:14 +02:00
5d77955ed9
py-check.mk: Run isort with "make format"
If /usr/bin/isort is found, run it during "make format" to get a
defined way the imports are sorted. tool.isort in pyproject.toml is
updated to match the other fixers.

Commit the fallout of this change. Running the other fixers alone
doesn't change the formatting, so this should be safe.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-11 16:45:14 +02:00
a7dd607667
platform.mk: Remove --topdir-format from JW_PKG_PY
Some uses of $(JW_PKG_PY) need to ensure their own topdir format,
which results in two options on jw-pkg.py's command line, with the
second overwriting the first. This works but is a minor uglyness.
Since the default built into jw-pkg works for all other cases, remove
--topdir-format from the JW_PKG_PY variable.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-11 16:45:14 +02:00
f70b14e92b
defs.mk: Disable BUILD_PKG_CONFIG
BUILD_PKG_CONFIG installs files across project directories into
$(JWBDIR) because of this:

   BUILD_PKG_CONFIGDIR      = $(JWBDIR)/pkgconfig

The concept is currently not used by any downstream project anymore,
hence it lacks sufficient testing at this point. Moreover, it breaks
building repos which are sandboxed to their own root directory,
because it tries to install the generated .pc file back into
$(JWBDIR). The concept itself isn't entirely off, so leave the code
in, disabled, with a comment.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-11 16:45:14 +02:00
2b04e387df
cache.mk: Avoid recaching stale variable values
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m5s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m0s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m41s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m33s
CI / Packaging test (push) Successful in 0s
If $(CACHE_PROJECT_MK) AKA .cache-project.mk already exists but needs
to be remade because of dependencies, it is included, its content
read, then the content cached again to the same file. That way stale
variables can leak into the refreshed cache.

This commit fixes the situation by removing it, then invoking make
again to remake it, thereby clearing the variable database and
forcing make to fill the variables afresh.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-11 14:25:34 +02:00
0861ed06ae
Revert "cmds.projects.CmdPythonpath: Reverse PYTHONPATH"
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m11s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m23s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m9s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m57s
CI / Packaging test (push) Successful in 0s
This reverts commit 11ccaef832.

PYTHONPATH was actually produced correctly by CmdPythonpath before
this commit. This was a red herring, suggested by a buggy downstream
project, revert the change.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-11 10:41:32 +02:00
768396e729
Release 1.0.0-251@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 3m41s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m5s
CI / Packaging test (push) Successful in 0s
2026-08-10 23:30:30 +00:00
4f581262a7
Release 1.0.0-251@kali-rolling/amd64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 3m32s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m57s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-10 23:11:15 +00:00
ee5b05c6e4
Start version: 1.0.0-251
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-10 23:10:15 +00:00
2eeaaf9681
lib.App: Make default log values overridable
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m0s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m11s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m40s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m59s
CI / Packaging test (push) Successful in 0s
The __init__() method reads default log configuration directly
from environment variables, making it impossible for subclasses to
change defaults.

Extract the defaults into _default_log_flags(), _default_log_level(),
_default_log_file(), and _default_show_backtrace() methods, then call
them from __init__(). Subclasses can now override these methods to
customize defaults without needing to override the entire __init__()
method.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-10 20:26:40 +02:00
90e221e106
lib.App: Make default env var names overridable
Add _default_*_env() helper methods that return the environment variable
names, and use them in __init__() instead of hard-coded strings. This
allows subclasses to override the names.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-10 20:26:40 +02:00
34ca0a7a95
lib.log.log(): Convert string-based flags to Flag
Replace the set of flag strings with a Flag enum for better type
safety and bitwise operations. Add parse_flags() to convert
comma-separated strings into a LogFlag value. Update set_flags() and
set_log_flags() to accept str | LogFlag | None.

set_flags() and set_log_flags() don't return str anylonger which is a
breaking change, but shouldn't be a problem because it's not used
anywhere.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-10 20:26:40 +02:00
c784c8ecb1
lib.log.log(): Use .join() to build argument string
The argument string builder in log() previously iterated with
enumerate and checked per-iteration whether to prepend a space.
Replace the loop with ' '.join(str(a) for a in args), which is a
single C-level operation.

Move the leading-space logic after the only_printable block so the
regex transformations see the raw joined content.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-10 20:26:40 +02:00
404b05ca26
lib.log.log(): Fix superfluous message whitespace
When prefix flags (position, prio, date) are combined with message
arguments, log() would double-space the output (e.g. '<N>  Created')
or omit the separator entirely (e.g. '<N>Created'). The root cause
was that log() prepended a space to every argument, regardless of
whether the prefix already ended with one.

Fix: only prepend a space before the first argument when the prefix
doesn't already end with one. This produces exactly one separator
between prefix and content regardless of which flags are active.

Also fix log_m(): skip empty strings (the sentinel '') so it doesn't
contribute a space. And fix the early return that dropped messages
when no prefix flags were set (previous commit).

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-10 20:26:40 +02:00
5d2e4fc03c
lib.log.log(): Fix early return without flags set
When position, prio, and date are all absent from the log flags, the
msg variable is empty. The early return 'if not len(msg): return'
would then skip printing the actual message in margs.

Fix by checking both msg and margs before returning. This ensures
messages are still printed even when no prefix flags are set.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-10 20:26:40 +02:00
b2fb37a668
Release 1.0.0-250@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 3m58s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m25s
CI / Packaging test (push) Successful in 0s
2026-08-09 23:32:11 +00:00
0d8c833964
Release 1.0.0-250@kali-rolling/amd64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 3m52s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m29s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-09 23:11:52 +00:00
55725ad0bd
Start version: 1.0.0-250
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-09 23:10:47 +00:00
be46a5ebcf pyrightconfig.json: Mirror strict mypy settings
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m6s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m12s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m9s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m0s
CI / Packaging test (push) Successful in 0s
Follow the changes in the mypy check profile by adding additional
checks.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-09 13:02:03 +00:00
9bbdcf5c39 pyproject.toml: Simplify mypy config using strict mode
Remove 8 redundant mypy settings that are already enabled by strict
mode: warn_redundant_casts, strict_equality, disallow_any_generics,
warn_unused_ignores, disallow_untyped_calls, warn_return_any,
disallow_incomplete_defs, disallow_untyped_defs.

Keep warn_unreachable explicitly since it's not part of strict mode.
Also remove the duplicate exhaustive-match entry from enable_error_code.

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 13:02:03 +00:00
fd521cb2a9 lib.App: Fix misc mypy errors
Fix fallout created by enabling the "strict" option:

  lib/App.py:196: error: Class cannot subclass
     "BaseCompleter" (has type "Any") [misc]

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-09 13:02:03 +00:00
989b800906 pyproject.toml: Enable mypy.disallow_untyped_defs
Add disallow_untyped_defs = true to the mypy configuration. This
requires all function definitions to have complete type annotations
for both parameters and return types. Since disallow_incomplete_defs
was already satisfied (all functions have partial annotations), this
final rule validates that no function is left without any type hints.

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 12:07:37 +00:00
88ba66c5b0 pyproject.toml: Enable mypy.disallow_incomplete_defs
Add disallow_incomplete_defs = true to the mypy configuration. This
requires all function definitions to have complete parameter and return
type annotations, catching partially-annotated function signatures.

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 12:07:37 +00:00
bbb9a9b17e pyproject.toml: Enable mypy.warn_return_any
Add warn_return_any = true to the mypy configuration. This detects
functions that return Any from contexts where a specific return type
is declared, encouraging more precise type 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-09 12:07:37 +00:00
1e613a39c6 App, cmds, lib: Fix Any returns from typed functions
Add type annotations and casts to functions that were returning Any
where a specific type was declared, satisfying the new warn_return_any
mypy rule.

Fixes:
- log.py: get_caller_pos return type via cast
- AsyncRunner.py: cast T for fut.result()
- util.py: cast for getattr result, str() for args.username
- FileContext.py: verbose_default bool annotation
- SSHClient.py: cast SSHClient for dynamic import
- lib/App.py: cast ArgumentParser, add return types to inner funcs
- pm/rpm.py, dpkg.py: cast Iterable[Package]
- App.py: cast for self.args.func(), add return types to inner funcs
- BaseCmdPkgRelations.py: cast str for args.delimiter

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 12:07:37 +00:00
b3fee32ee1 pyproject.toml: Enable mypy.disallow_untyped_calls
Add disallow_untyped_calls = true to the mypy configuration. This
requires all function calls from typed code to target typed functions,
ensuring better type safety across the codebase.

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:36:52 +00:00
410fd7ab5c App, lib: Add type annotations to untyped functions
Add missing type annotations to functions that are called from typed
contexts, satisfying the new disallow_untyped_calls mypy rule.

Fixes:
- Local.py: __log() with typed parameters
- lib/App.py: _add_arguments(), add_cmd_to_parser(), add_cmds_to_parser()
- pm/rpm.py, dpkg.py: meta_map() return type
- Exec.py: __init_askpass() return type
- App.py: strip_module_from_spec(), __get_project_refs_cached(),
  ResultCache.__init__ and run(), _add_arguments()
- Added Collection type for truthy-iterable compliance

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:36:04 +00:00
75c9879f67 pyproject.toml: Enable mypy.warn_unreachable
Add warn_unreachable = true to the mypy configuration. This detects
statements that mypy proves are unreachable, such as code after
an unconditional return or assertions that can never be true.

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:35:16 +00:00
c16e054aaa App, lib, cmds: Remove unreachable code
Remove dead code paths detected by the new warn_unreachable mypy
rule. These include:

- Removed always-false isinstance checks (ssh/util.py, templates.py)
- Removed unreachable return statements after raise (FileContext.py)
- Removed unreachable None checks for typed variables (Result.py,
  ExecContext.py, CmdGetAuthInfo.py)
- Simplified __uri function by removing impossible None check
  (CopyContext.py)
- Changed assert False to explicit error (Cmd.py)
- Removed unreachable None case from match (App.py)
- Removed redundant outer case _: pass (pkg_relations.py)
- Restructured stdin write to avoid unreachable warning (AsyncSSH.py)

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:34:27 +00:00
a1d192b048 pyproject.toml: Enable mypy.exhaustive-match
Add the exhaustive-match error code to the mypy configuration. This
requires all match statements to be exhaustive, handling all possible
values of the matched expression.

The fix is to add 'case _: pass' to each match statement that is
intended to be non-exhaustive, making the non-exhaustiveness explicit.

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:33:39 +00:00
55b63ded69 lib, cmds: Add exhaustive match cases
Add 'case _: pass' to match statements that are intentionally
non-exhaustive, satisfying the new exhaustive-match mypy rule.

Also replaced 'case '_':' (a string literal) with 'case _: pass' in
pkg_relations.py since it was an unreachable case (syntax is a
VersionSyntax enum, not a str).

Added 'case VersionSyntax.names_only:' to the match in pkg_relations.py
to handle the missing enum value.

Files modified:
- util.py: Two match statements for askpass env vars
- Distro.py: Three match statements for backend/os detection
- pkg_relations.py: Match on VersionSyntax enum
- CmdListRepos.py: Match on URL scheme

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:32:51 +00:00
a3e46121da pyproject.toml: Enable mypy.truthy-iterable
Add the truthy-iterable error code to the mypy configuration. This
detects Iterable parameters that are used in boolean contexts (if not
names, etc.) since Iterable values are always truthy.

The fix is to change Iterable[str] parameters to Collection[str] when
they are tested for emptiness, since Collection guarantees __len__.

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:32:03 +00:00
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