systemd-client 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. systemd_client-0.1.0/.github/workflows/publish.yml +32 -0
  2. systemd_client-0.1.0/.github/workflows/tests.yml +34 -0
  3. systemd_client-0.1.0/.gitignore +18 -0
  4. systemd_client-0.1.0/LICENSE +11 -0
  5. systemd_client-0.1.0/PKG-INFO +140 -0
  6. systemd_client-0.1.0/README.en.md +656 -0
  7. systemd_client-0.1.0/README.es.md +656 -0
  8. systemd_client-0.1.0/README.md +102 -0
  9. systemd_client-0.1.0/examples/01_list_services.py +21 -0
  10. systemd_client-0.1.0/examples/02_service_status.py +40 -0
  11. systemd_client-0.1.0/examples/03_start_stop_restart.py +40 -0
  12. systemd_client-0.1.0/examples/04_enable_disable.py +41 -0
  13. systemd_client-0.1.0/examples/05_journal_query.py +45 -0
  14. systemd_client-0.1.0/examples/06_journal_follow.py +28 -0
  15. systemd_client-0.1.0/examples/07_async_client.py +34 -0
  16. systemd_client-0.1.0/examples/08_async_follow.py +33 -0
  17. systemd_client-0.1.0/examples/09_health_check.py +45 -0
  18. systemd_client-0.1.0/examples/10_failed_units_report.py +38 -0
  19. systemd_client-0.1.0/examples/11_journal_grep.py +38 -0
  20. systemd_client-0.1.0/examples/12_journal_reader_lowlevel.py +49 -0
  21. systemd_client-0.1.0/examples/13_deploy_and_manage.py +69 -0
  22. systemd_client-0.1.0/examples/14_batch_operations.py +44 -0
  23. systemd_client-0.1.0/examples/15_async_monitor_dashboard.py +60 -0
  24. systemd_client-0.1.0/pyproject.toml +69 -0
  25. systemd_client-0.1.0/src/systemd_client/__init__.py +59 -0
  26. systemd_client-0.1.0/src/systemd_client/_pydantic_models.py +90 -0
  27. systemd_client-0.1.0/src/systemd_client/_sync.py +82 -0
  28. systemd_client-0.1.0/src/systemd_client/_unit_escape.py +51 -0
  29. systemd_client-0.1.0/src/systemd_client/_version.py +3 -0
  30. systemd_client-0.1.0/src/systemd_client/backends/__init__.py +38 -0
  31. systemd_client-0.1.0/src/systemd_client/backends/_base.py +78 -0
  32. systemd_client-0.1.0/src/systemd_client/backends/_dbus.py +216 -0
  33. systemd_client-0.1.0/src/systemd_client/backends/_subprocess.py +223 -0
  34. systemd_client-0.1.0/src/systemd_client/cli/__init__.py +1 -0
  35. systemd_client-0.1.0/src/systemd_client/cli/_app.py +152 -0
  36. systemd_client-0.1.0/src/systemd_client/cli/_formatters.py +129 -0
  37. systemd_client-0.1.0/src/systemd_client/client.py +201 -0
  38. systemd_client-0.1.0/src/systemd_client/enums.py +112 -0
  39. systemd_client-0.1.0/src/systemd_client/exceptions.py +63 -0
  40. systemd_client-0.1.0/src/systemd_client/journal/__init__.py +10 -0
  41. systemd_client-0.1.0/src/systemd_client/journal/_parser.py +83 -0
  42. systemd_client-0.1.0/src/systemd_client/journal/_query.py +50 -0
  43. systemd_client-0.1.0/src/systemd_client/journal/_reader.py +96 -0
  44. systemd_client-0.1.0/src/systemd_client/models.py +75 -0
  45. systemd_client-0.1.0/src/systemd_client/py.typed +0 -0
  46. systemd_client-0.1.0/tests/__init__.py +0 -0
  47. systemd_client-0.1.0/tests/backends/__init__.py +0 -0
  48. systemd_client-0.1.0/tests/backends/test_subprocess.py +114 -0
  49. systemd_client-0.1.0/tests/cli/__init__.py +0 -0
  50. systemd_client-0.1.0/tests/cli/test_app.py +95 -0
  51. systemd_client-0.1.0/tests/conftest.py +109 -0
  52. systemd_client-0.1.0/tests/journal/__init__.py +0 -0
  53. systemd_client-0.1.0/tests/journal/test_parser.py +65 -0
  54. systemd_client-0.1.0/tests/journal/test_query.py +72 -0
  55. systemd_client-0.1.0/tests/journal/test_reader.py +44 -0
  56. systemd_client-0.1.0/tests/test_client.py +104 -0
  57. systemd_client-0.1.0/tests/test_enums.py +69 -0
  58. systemd_client-0.1.0/tests/test_exceptions.py +65 -0
  59. systemd_client-0.1.0/tests/test_models.py +90 -0
  60. systemd_client-0.1.0/tests/test_unit_escape.py +47 -0
@@ -0,0 +1,32 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.13"
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v4
24
+
25
+ - name: Install build tools
26
+ run: uv pip install --system build
27
+
28
+ - name: Build package
29
+ run: python -m build
30
+
31
+ - name: Publish to PyPI
32
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,34 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v4
26
+
27
+ - name: Install dependencies
28
+ run: uv pip install --system -e ".[dev]"
29
+
30
+ - name: Lint
31
+ run: ruff check src/ tests/
32
+
33
+ - name: Tests
34
+ run: pytest tests/ -v --tb=short
@@ -0,0 +1,18 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ venv/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .pyright/
14
+ htmlcov/
15
+ .coverage
16
+ *.so
17
+ .claude/
18
+ .agents/
@@ -0,0 +1,11 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 2.1, February 1999
3
+
4
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ This is the GNU Lesser General Public License version 2.1.
11
+ For the full license text, see: https://www.gnu.org/licenses/lgpl-2.1.html
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: systemd-client
3
+ Version: 0.1.0
4
+ Summary: High-level Python client for systemd user services: unit management, journal reading, sync + async
5
+ Project-URL: Homepage, https://github.com/kalexnolasco/systemd-client
6
+ Project-URL: Repository, https://github.com/kalexnolasco/systemd-client
7
+ Project-URL: Issues, https://github.com/kalexnolasco/systemd-client/issues
8
+ Author: kalexnolasco
9
+ License-Expression: LGPL-2.1-or-later
10
+ License-File: LICENSE
11
+ Keywords: dbus,journalctl,linux,service,systemctl,systemd
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: System :: Systems Administration
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Provides-Extra: all
25
+ Requires-Dist: dasbus>=1.7; extra == 'all'
26
+ Requires-Dist: pydantic>=2.0; extra == 'all'
27
+ Provides-Extra: dbus
28
+ Requires-Dist: dasbus>=1.7; extra == 'dbus'
29
+ Provides-Extra: dev
30
+ Requires-Dist: coverage>=7.0; extra == 'dev'
31
+ Requires-Dist: pyright>=1.1; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
33
+ Requires-Dist: pytest>=8.0; extra == 'dev'
34
+ Requires-Dist: ruff>=0.8; extra == 'dev'
35
+ Provides-Extra: pydantic
36
+ Requires-Dist: pydantic>=2.0; extra == 'pydantic'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # systemd-client โ€” High-Level Python Client for systemd User Services
40
+
41
+ <div align="center">
42
+
43
+ ![Module](https://img.shields.io/badge/Module-systemd--client-blue?style=for-the-badge)
44
+ ![Version](https://img.shields.io/badge/Version-0.1.0-green?style=for-the-badge)
45
+ ![Python](https://img.shields.io/badge/Python-3.11%20|%203.12%20|%203.13%20|%203.14-yellow?style=for-the-badge&logo=python)
46
+ ![License](https://img.shields.io/badge/License-LGPL--2.1-orange?style=for-the-badge)
47
+ ![systemd](https://img.shields.io/badge/systemd-user%20space-grey?style=for-the-badge&logo=linux&logoColor=white)
48
+
49
+ **Unified async + sync Python API for systemd unit management and journal reading**
50
+
51
+ **API unificada async + sync en Python para gestion de unidades systemd y lectura del journal**
52
+
53
+ ---
54
+
55
+ ### Choose Your Language / Elige tu idioma
56
+
57
+ <p align="center">
58
+ <a href="README.en.md">
59
+ <img src="https://img.shields.io/badge/English-Documentation-blue?style=for-the-badge&logo=markdown" alt="English Documentation" height="50">
60
+ </a>
61
+ &nbsp;&nbsp;&nbsp;
62
+ <a href="README.es.md">
63
+ <img src="https://img.shields.io/badge/Espa%C3%B1ol-Documentaci%C3%B3n-red?style=for-the-badge&logo=markdown" alt="Spanish Documentation" height="50">
64
+ </a>
65
+ </p>
66
+
67
+ ---
68
+
69
+ ### Architecture Overview
70
+
71
+ ```mermaid
72
+ graph TD
73
+ subgraph APP["๐Ÿ Your Application"]
74
+ SYNC["SystemdClient<br/>Synchronous API"]
75
+ ASYNC["AsyncSystemdClient<br/>Async API"]
76
+ end
77
+
78
+ subgraph BACKENDS["โš™๏ธ Backends"]
79
+ SUB["๐Ÿ–ฅ๏ธ SubprocessBackend<br/>systemctl --user"]
80
+ DBUS["๐Ÿ”Œ DBusBackend<br/>dasbus (optional)"]
81
+ end
82
+
83
+ subgraph JOURNAL["๐Ÿ“‹ Journal Reader"]
84
+ JR["AsyncJournalReader<br/>journalctl --user --output=json"]
85
+ end
86
+
87
+ subgraph SYSTEMD["๐Ÿง systemd (user session)"]
88
+ UNITS[("๐Ÿ”ง User Units<br/>services, timers, sockets")]
89
+ JRNL[("๐Ÿ“œ Journal<br/>log entries")]
90
+ end
91
+
92
+ SYNC --> ASYNC
93
+ ASYNC --> SUB
94
+ ASYNC --> DBUS
95
+ ASYNC --> JR
96
+ SUB --> UNITS
97
+ DBUS --> UNITS
98
+ JR --> JRNL
99
+
100
+ style APP fill:#d0ebff,stroke:#1971c2,stroke-width:2px
101
+ style BACKENDS fill:#b2f2bb,stroke:#2f9e44,stroke-width:2px
102
+ style JOURNAL fill:#f3d9fa,stroke:#9c36b5,stroke-width:2px
103
+ style SYSTEMD fill:#fff3bf,stroke:#f08c00,stroke-width:2px
104
+ style SYNC fill:#d0ebff,stroke:#1971c2,stroke-width:2px
105
+ style ASYNC fill:#d0ebff,stroke:#1971c2,stroke-width:2px
106
+ style SUB fill:#b2f2bb,stroke:#2f9e44,stroke-width:2px
107
+ style DBUS fill:#b2f2bb,stroke:#2f9e44,stroke-width:2px
108
+ style JR fill:#f3d9fa,stroke:#9c36b5,stroke-width:2px
109
+ style UNITS fill:#fff3bf,stroke:#f08c00
110
+ style JRNL fill:#fff3bf,stroke:#f08c00
111
+ ```
112
+
113
+ ### Quick Start
114
+
115
+ ```bash
116
+ # Install
117
+ pip install systemd-client
118
+
119
+ # Install with DBus backend support
120
+ pip install systemd-client[dbus]
121
+
122
+ # Install with Pydantic models
123
+ pip install systemd-client[all]
124
+ ```
125
+
126
+ ```python
127
+ from systemd_client import SystemdClient
128
+
129
+ client = SystemdClient()
130
+ for unit in client.list_units(unit_type="service"):
131
+ print(f"{unit.name}: {unit.active_state}")
132
+ ```
133
+
134
+ ---
135
+
136
+ **systemd-client** ยท [github.com/kalexnolasco/systemd-client](https://github.com/kalexnolasco/systemd-client)
137
+
138
+ &copy; 2026 kalexnolasco
139
+
140
+ </div>