Skip to content

Split pystemd.utils into a package - #127

Merged
aleivag merged 2 commits into
systemd:mainfrom
aleivag:utils-package
Nov 18, 2026
Merged

aleivag merged 2 commits into
systemd:mainfrom
aleivag:utils-package

Conversation

@aleivag

@aleivag aleivag commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

pystemd/utils.py becomes pystemd/utils/, one module per kind of helper:

  • utils/x2.py: x2char_star, str2cmd, strlist2cmd, x2cmdlist (the old file, moved, so its history follows)
  • utils/unit.py: random_unit_name
  • utils/typing.py: T, unwrap

utils/init.py re-exports all of them, so existing imports such as from pystemd.utils import x2char_star and pystemd.utils.unwrap(...) keep working unchanged (including mock.patch("pystemd.utils.random_unit_name") in the tests). setup.py lists packages explicitly, so pystemd.utils is added there.

No behaviour change; this makes room for new helper modules (e.g. namespaces) without growing a single catch-all file.

pystemd/utils.py becomes pystemd/utils/, one module per kind of helper:

- utils/x2.py: x2char_star, str2cmd, strlist2cmd, x2cmdlist (the old
  file, moved, so its history follows)
- utils/unit.py: random_unit_name
- utils/typing.py: T, unwrap

utils/__init__.py re-exports all of them, so existing imports such as
`from pystemd.utils import x2char_star` and `pystemd.utils.unwrap(...)`
keep working unchanged (including mock.patch("pystemd.utils.random_unit_name")
in the tests). setup.py lists packages explicitly, so pystemd.utils is
added there.

No behaviour change; this makes room for new helper modules (e.g.
namespaces) without growing a single catch-all file.
@aleivag
aleivag merged commit 19ad5f0 into systemd:main Nov 18, 2026
49 checks passed
@aleivag
aleivag deleted the utils-package branch November 18, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant