Commit graph

476 commits

Author SHA1 Message Date
913a6f32a7
Release 1.0.0-61@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m42s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 7m6s
CI / Packaging test (push) Successful in 0s
v1.0.0-61@kali-rolling/amd64 v1.0.0-61@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 16:49:11 +00:00
4916c2d486
Release 1.0.0-61@kali-rolling/amd64
Some checks failed
CI / Packaging test (push) Has been cancelled
CI / Packaging - Kali Linux (push) Has been cancelled
CI / Packaging - OpenSUSE Tumbleweed (push) Has been cancelled
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 16:47:42 +00:00
e64ec9aee1
Start version: 1.0.0-61
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 16:46:49 +00:00
39bceb17f8
project.conf: Fix pkg.requires.os.run += python3-yaml
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m31s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 6m5s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m10s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m46s
CI / Packaging test (push) Successful in 0s
Commit 9b817c7a has another typo, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-10-19 17:59:55 +02:00
5b5b3145ce
Release 1.0.0-60@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m9s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m52s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 15:11:33 +00:00
bcc3c72bb4
Release 1.0.0-60@kali-rolling/amd64
Some checks failed
CI / Packaging test (push) Has been cancelled
CI / Packaging - Kali Linux (push) Has been cancelled
CI / Packaging - OpenSUSE Tumbleweed (push) Has been cancelled
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 15:10:10 +00:00
ed310ba08d
Start version: 1.0.0-60
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 15:09:15 +00:00
9b817c7a56
project.conf: Fix pkg.requires.os.run += python3-yaml
Some checks failed
CI / Packaging - Kali Linux (pull_request) Successful in 5m8s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m55s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging test (push) Has been cancelled
CI / Packaging - Kali Linux (push) Has been cancelled
CI / Packaging - OpenSUSE Tumbleweed (push) Has been cancelled
Commit 1130c3c has a typo, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-10-19 16:50:56 +02:00
a45af290fb
Release 1.0.0-59@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m5s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m42s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 14:34:59 +00:00
120f0e57dc
Release 1.0.0-59@kali-rolling/amd64
Some checks failed
CI / Packaging test (push) Has been cancelled
CI / Packaging - Kali Linux (push) Has been cancelled
CI / Packaging - OpenSUSE Tumbleweed (push) Has been cancelled
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 14:32:17 +00:00
ef39aab8f9
Start version: 1.0.0-59
Signed-off-by: janware DevOps <devops@janware.com>
2026-10-19 14:31:10 +00:00
1130c3c92d
project.conf: pkg.requires.os.run += python3-yaml
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m33s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 6m2s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m2s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 7m16s
CI / Packaging test (push) Successful in 0s
load_yaml imports yaml, so add python3-PyYAML to suse's os dependencies,
and python3-yaml to debian's.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-10-19 15:32:25 +02:00
5c937bbc83
Release 1.0.0-58@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 6m14s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 6m7s
CI / Packaging test (push) Successful in 0s
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-25 00:02:15 +00:00
4eebeff7c6
Release 1.0.0-58@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-24 23:14:22 +00:00
83230fece5
Start version: 1.0.0-58
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-24 23:13:27 +00:00
8cb0ef5216
Release 1.0.0-57@suse-tumbleweed/x86_64
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 6m40s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m16s
CI / Packaging test (push) Successful in 0s
2026-09-19 06:19:10 +00:00
4fbd79a764
Release 1.0.0-57@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-18 23:13:28 +00:00
95d7adc756
Start version: 1.0.0-57
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-18 23:12:27 +00:00
ad3fa9a53b
.gitignore: Follow jw-pkg
Run "make gitignore" to follow jw-pkg's template, and commit the diff.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-18 10:24:53 +02:00
e076d5778b
test/parse_opts: Replace with Options unit test
The parse_opts test is a plain script that constructs an Options from
sys.argv and crashed on the first get() call, because the by_index
condition in Options.get() is inverted and raises KeyError for an integer
index. It has several shortcomings, though:

- "make test" doesn't execute it, only make -C test/parse_opts run, so CI
  doesn't run it
- It doesn't adhere to standard janware directory layout
- It's very basic

Replace the script with a pytest module under
test/unit/python/jw/util/Options, following the layout of the sibling
unit test directories: a Makefile including py-test.mk and a test.py
discovered by pytest. The module covers parsing of option strings, repeated
keys, JSON values, flags, get() with defaults and the by_index parameter,
__contains__, __iter__, keys(), str() and update().

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
2026-09-18 09:47:35 +02:00
b192207bbd
Options.get(): Fix inverted by_index check
The by_index branch of Options.get() raises KeyError for every integer
index, because the first isinstance guard is inverted: it fires for exactly
the keys the branch is supposed to handle, so the range check and the
lookup in the list of parsed keys below it are dead code. A non-integer key
with by_index set slips past the guard and falls through to the regular key
lookup instead. A previous make-check fallout commit flipped the original
type(key) != int test into a positive isinstance test, and a later mypy fix
then added redundant isinstance guards to the unreachable branches,
cementing the broken flow.

Invert the guard back to not isinstance(key, int), so that a non-integer
key raises KeyError, an in-range integer index returns the key stored at
that position in the option string, and an out-of-range index returns the
default or raises KeyError. Drop the redundant isinstance guards from the
now-reachable branches.

TODO: The bug actually made "make -C test/parse_opts run" fail, but since
jw-python's nightly CI doesn't run that, this has gone unnoticed. The test
now passes, but should be replaced with a better test (executed by "make
test", and pytest-based).

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-18 09:44:26 +02:00
43a0d0beab
Release 1.0.0-56@suse-tumbleweed/x86_64 2026-09-17 05:33:20 +00:00
0af0a3ff98
Release 1.0.0-56@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-16 23:13:51 +00:00
0d7e48373f
Start version: 1.0.0-56
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-16 23:12:58 +00:00
70425783b7
Release 1.0.0-55@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-09-15 23:12:08 +00:00
b2e34b27e6
Release 1.0.0-55@suse-tumbleweed/x86_64 2026-09-13 23:33:44 +00:00
32599e1589
Start version: 1.0.0-55 2026-09-13 23:32:54 +00:00
7885f69b44
test: Fix mypy strict errors in test tree
The test tree needs to be aligned with type checking, too, because jw-pkg
is going to required it for test, too. The load_yaml and StringTree tests
receive their fixtures as bare Callable and Generator without type
arguments, and the StringTree tests pass the st fixture without an
annotation. The cast script suppresses errors with un-coded type ignore
comments, and the parse_opts script declares its loop variable as
"str | int", so indexing the Options object with it is rejected.

Introduce _YamlFile, _TempDir, and _St aliases for the fixture types and
give the st parameters an annotation. Code the type ignore comments with
the argument mismatch they suppress, and split the parse_opts loop variable
into i for the index loops and k for the key loops.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-13 13:50:15 +02:00
63c0ed3951
jwutils.Cmd.add_subcommands(): Collect only Cmd
This commit fixes tightening type check fallout.

add_subcommands() with a string pattern collects every class of the calling
module whose name matches the pattern. inspect.getmembers() yields plain
objects, so the unannotated collection list is inferred as list[object],
which is not compatible with the declared list[type[Cmd]] parameter type,
and make check fails on it.

Annotate the collection list as list[type[Cmd]] and narrow it to subclasses
of Cmd via issubclass(). This makes the implementation match the declared
signature and stops classes lacking the Cmd interface from being registered
as subcommands, where they would break later when instantiated and treated
as Cmd in __add_cmd_to_parser().

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
2026-09-13 13:47:22 +02:00
a89d3dcd06
misc.store_dict(): Add function
Add a store_dict() function to write the contents of a mapping to
a file as JSON, using the same formatting as dump_dict().

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-13 13:47:11 +02:00
ed70e7a2f9
.gitignore: Update 2: Run "make gitignore"
For a reviewable diff, .gitignore is updated in two commits. The first sorts,
the second is the result of "make gitignore".

This commit is step 2.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-13 13:47:08 +02:00
c744318bce
.gitignore: Update 1: Sort
For a reviewable diff, .gitignore is updated in two commits. The first sorts,
the second is the result of "make gitignore".

This commit is step 1.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-13 13:46:53 +02:00
d7fcb4da84
__init__.py: Protect from py-ns-dir.mk
For in-tree tests, the jw package is split across several projects, and
each directory containing a py-ns-dir.mk contributes its subtree. So far,
it was up to that directory how the contribution is handled. With current
changes in jw-pkg, py-ns-dir.mk handles the contribution method centrally
by default, and the __init__.py currently under version control should be
removed. jw-python contains a custom __init__.py there, so protect it from
whatever py-ns-dir.mk is up to.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-13 13:46:16 +02:00
d675737e7e
Release 1.0.0-54@suse-tumbleweed/x86_64 2026-08-29 09:03:02 +00:00
f678b8b4b1
Release 1.0.0-54@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-29 07:23:31 +00:00
2716929c9b
Start version: 1.0.0-54
Signed-off-by: janware DevOps <devops@janware.com>
2026-08-29 07:22:35 +00:00
14a0ba4174
load_yaml: Document block-list form of optional marker
The optional marker is a leading dash in the include spec, but in
a YAML block list the leading dash is the list syntax and is
consumed by the YAML parser before load_yaml() sees the spec.  An
include written as a plain list item "- file" is therefore
required, not optional, and a missing file raises, even though the
dash reads like the optional marker.

Note in the module docstring that in a block list the item itself
must carry the marker, as in "- -file.yaml" or the quoted form
"- "-file.yaml"".

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-27 19:03:12 +02:00
90ab62f062
load_yaml: _load_yaml(): Skip empty included documents
An optional include with a target path that points to a missing
file leaves a trace in the output: _load_yaml() still calls
_merge_at_path() with the empty document, which creates the target
key as an empty mapping.  A root-level optional include of the same
file contributes nothing, so the outcome depends on whether the
spec names a target path.

Skip included documents that are empty: an empty document
contributes nothing, at the root as well as at a target path, and
creates no key.  Update the module docstring accordingly and add
tests covering a missing optional include with a target path.

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-27 19:03:09 +02:00
d5da1599ad
load_yaml: Add globbing to jw.include specs
The jw.include file spec is resolved as a single literal file name,
so a set of files under one directory has to be listed one by one.

Let the file part of a spec use glob characters (*, ?, [...]).
_normalize_include_specs() expands every match into its own
IncludeSpec entry, so matches are loaded and deep-merged in lexical
order: at the root, later files win; at a target path, the existing
content wins as with a single include.  A non-optional glob that
matches no files raises ValueError; the leading - prefix keeps a
glob optional.  Document the globbing in the module docstring,
including the YAML quoting requirement for specs that start with a
glob character, and add tests covering the glob syntax, lexical
order, the no-match and optional cases, target-path merging,
absolute paths, and self-inclusion.

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-25 19:35:03 +02:00
20c08f0957
load_yaml: Improve module and function docs
The module has no docstring, so the include/link/inplace-link
extensions and their path rules are only discoverable by reading the
code.  _parse_link() claims a named link 'uses a single pipe' even
though pipes may appear in the target path after the first one, and
_expand_links() does not say that a jw.link node with sibling keys is
not a link at all (the key is kept as-is), which is the behavior a
typo in a link node silently produces.

Add a module docstring describing the three extensions, the relative
path rules, and the known limitations (dotted keys cannot be
addressed, path navigation cannot traverse link nodes).  Correct the
_parse_link() pipe rule, note the sibling-key behavior and the error
types in _expand_links(), and fix the 'stays at the current level'
wording, since a single dot resolves within the dict that contains
the link.

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-25 19:35:03 +02:00
092af336e3
load_yaml: __main__: Harden debug entry point
The __main__ debug printer crashes with a bare IndexError when no
file argument is given, and json.dumps() crashes on YAML values that
have no JSON representation, such as dates.

Check the argument count and print a usage message, and pass
default = str to json.dumps() so that non-JSON values are rendered
as strings instead of aborting the dump.

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-25 19:35:03 +02:00
568c92b009
load_yaml: Deepcopy cached link expansions
The memoisation cache in _expand_links_recursive() stores the expanded
value of a link node.  A link node that is first reached via another
link, and later visited by the normal tree walk, is expanded only
once; the cached result object is then returned as-is for the second
location.  Both places in the output tree end up holding the same
dict, so mutating one of them silently mutates the other.

Deepcopy the value on every cache read so that each place in the
output tree holds an independent object.  Add a regression test that
mutates one cached location and checks the others stay untouched.

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-25 19:35:03 +02:00
717b69f5d8
load_yaml: _load_yaml(): Specify UTF-8 encoding
open() without an encoding argument decodes the file with the
platform's locale-dependent default, so the same YAML file can be
decoded differently (or fail) on hosts with different locale
settings.  YAML files are expected to be UTF-8, so say so
explicitly.

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-25 19:35:03 +02:00
f737c15a0d
load_yaml: Simplify redundant Any annotation
The annotation 'dict[str, Any] | Any' on the cached base value
collapses to plain Any, since Any absorbs any union member.  Write
the simplified form.

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-25 19:35:03 +02:00
391fcc7ef2
load_yaml: Remove unnecessary noqa comment
The 'noqa: E402' on the re import suppresses 'module level import not
at top of file', but the import is at the top of the file, so the
suppression is dead.  Drop 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-25 19:35:02 +02:00
e6f3833716
load_yaml: Fix include spec parsing of pipes
_INCLUDE_PATH_RE allows the pipe character in the target-path part of
a jw.include spec such as 'target.path|file.yaml'.  The greedy match
then consumes further pipes, so a file name that itself contains a
pipe is misparsed: the target swallows part of the file name and the
remainder becomes the (nonexistent) file to open.  Dots are needed in
the target part for nested paths, but a pipe can never be part of a
target path.

Drop the pipe from the character class so that the first pipe always
separates the target path from the file name.  Add a regression test
with a pipe in the file name.

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-25 19:35:02 +02:00
1fd3c75c08
load_yaml: Reject non-string link values
A link value that is not a string (for example a number parsed from
YAML) is passed to the regular expression in _parse_link(), which
crashes with a bare TypeError from the regex engine that does not
mention the offending value or the link kind.

Make _resolve_link() validate the spec type up front and raise
TypeError naming the link kind and the value.  Add tests for both
jw.link and jw.inplace-link.

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-25 19:35:02 +02:00
503c620341
load_yaml: _resolve_link(): Add context to errors
When a link's target path cannot be resolved, the raw KeyError from
_resolve_path() propagates to the caller (or a raw TypeError when a
path segment hits a list), without saying which link or which
document location caused the failure.  The parse-and-resolve
sequence is also duplicated in the jw.link and jw.inplace-link
branches of _expand_links_recursive().

Extract the sequence into _resolve_link() and wrap navigation
failures in ValueError naming the link kind, the spec, and the
location in the document.  Document that path navigation operates on
the unexpanded tree, so intermediate segments must not be link nodes
themselves.  Update the tests that pinned KeyError and add coverage
for the list-navigation case and the error message content.

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-25 19:35:02 +02:00
b3a3fc0507
load_yaml: Fix dropped inplace-link siblings
A jw.inplace-link node deep-merges its sibling keys into the resolved
target.  When the target resolves to a non-dict value, the merge is
skipped and the sibling keys are silently discarded, losing document
data without any warning.

Raise ValueError when the resolved target is not a mapping and the
node carries sibling keys, and add regression tests for scalar and
list targets.

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-25 19:35:02 +02:00
2bd1db5d90
load_yaml: Reject non-dict include targets
When jw.include specifies a target path, _merge_at_path() walks the
existing document to that path.  If an intermediate key holds a
non-dict value, that value is silently replaced by an empty dict; if
the leaf key holds a non-dict value, it is silently replaced by the
included mapping.  Both cases discard local document data without
warning, and the leaf case even inverts the documented precedence in
which local content wins over included content (which holds for the
dict-versus-dict case).

Make _merge_at_path() raise ValueError when an existing value on or
at the target path is not a mapping, and add regression tests for
both the intermediate and the leaf case.

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-25 19:35:02 +02:00