Commit graph

483 commits

Author SHA1 Message Date
3d4e49f047
Release 1.0.0-63
All checks were successful
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 6m2s
CI / Packaging - Kali Linux (push) Successful in 4m57s
CI / Packaging test (push) Successful in 0s
v1.0.0-63@kali-rolling/amd64 v1.0.0-63@suse-tumbleweed/x86_64
2026-11-19 01:16:50 +01:00
c983a77ef0
[PR jw/#5] enum_helper.py: Import the name conversion helpers from jw-pkg
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m3s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m28s
CI / Packaging test (push) Successful in 0s
Merge pull request "enum_helper.py: Import the name conversion helpers from jw-pkg"

Upstream-repo: ssh://git@code.janware.com/janware/jw-python
Source-branch: jan/fix/20261118-enum-helper-py-import-the-name-conversion-helpers-from-jw-pkg
Target-branch: master
Reviewed-on: #5
2026-11-18 19:47:04 +01:00
d5c64af683
enum_helper.py: Import the name conversion helpers from jw-pkg
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m53s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m33s
CI / Packaging test (pull_request) Successful in 0s
kebab_to_pascal() and pascal_to_kebab() are needed in jw-pkg, for the
resolution of filter names and, later, the dynamic loading of file
contexts. jw-python depends on jw-pkg, so jw-pkg's util.py is their
canonical home.

This commit imports them from jw.pkg.lib.util and re-exports them, so the
existing importers keep working.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-18 19:25:41 +01:00
f965705479
Release 1.0.0-62
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m17s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m32s
CI / Packaging test (push) Successful in 0s
v1.0.0-62@kali-rolling/amd64 v1.0.0-62@suse-tumbleweed/x86_64
2026-11-14 00:12:52 +00:00
629a47861a
[PR jw/#4] Sync the tree with current mypy and isort
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m25s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m10s
CI / Packaging test (push) Successful in 0s
Merge pull request "Sync the tree with current mypy and isort"

Upstream-repo: ssh://git@code.janware.com/janware/jw-python
Source-branch: jan/fix/20261113-sync-the-tree-with-current-mypy-and-isort
Target-branch: master
Reviewed-on: #4
2026-11-13 15:20:33 +01:00
71037e631a
style: Sync import formatting with current isort
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m26s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m27s
CI / Packaging test (pull_request) Successful in 0s
The current isort formats parenthesized import lists with a trailing comma
and wraps long imports differently than when the files were last formatted,
so make format rewrites them on every run even though nothing is wrong with
the code.

Apply make format to the two drifted import statements so the tree matches
the formatter's output and make format becomes a no-op:

- src/python/jw/util/log.py: trailing comma in the jw.pkg.lib.log import
  list
- src/python/jwutils/db/schema/CompositeForeignKey.py: wrap the
  CompositeForeignKey import in parentheses

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-13 15:09:33 +01:00
c679505053
Options.__init__(): Annotate __allowed_keys as Any
mypy 2.4.0 infers the attribute from the None assignment in __init__() and
then flags the right operand of the and check in __parse__() as unreachable
code, failing make check.

The attribute is only ever assigned None, so annotate it as Any and keep
the runtime behaviour unchanged.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-13 15:09:33 +01:00
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