py-juxlib 0.3.1__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 (49) hide show
  1. py_juxlib-0.3.1/.gitignore +177 -0
  2. py_juxlib-0.3.1/LICENSE +190 -0
  3. py_juxlib-0.3.1/PKG-INFO +177 -0
  4. py_juxlib-0.3.1/README.md +133 -0
  5. py_juxlib-0.3.1/pyproject.toml +166 -0
  6. py_juxlib-0.3.1/src/juxlib/__init__.py +43 -0
  7. py_juxlib-0.3.1/src/juxlib/api/__init__.py +39 -0
  8. py_juxlib-0.3.1/src/juxlib/api/client.py +178 -0
  9. py_juxlib-0.3.1/src/juxlib/api/models.py +92 -0
  10. py_juxlib-0.3.1/src/juxlib/config/__init__.py +53 -0
  11. py_juxlib-0.3.1/src/juxlib/config/manager.py +481 -0
  12. py_juxlib-0.3.1/src/juxlib/config/schema.py +172 -0
  13. py_juxlib-0.3.1/src/juxlib/errors/__init__.py +104 -0
  14. py_juxlib-0.3.1/src/juxlib/errors/codes.py +76 -0
  15. py_juxlib-0.3.1/src/juxlib/errors/exceptions.py +721 -0
  16. py_juxlib-0.3.1/src/juxlib/metadata/__init__.py +52 -0
  17. py_juxlib-0.3.1/src/juxlib/metadata/ci.py +239 -0
  18. py_juxlib-0.3.1/src/juxlib/metadata/detection.py +113 -0
  19. py_juxlib-0.3.1/src/juxlib/metadata/git.py +163 -0
  20. py_juxlib-0.3.1/src/juxlib/metadata/models.py +157 -0
  21. py_juxlib-0.3.1/src/juxlib/metadata/project.py +133 -0
  22. py_juxlib-0.3.1/src/juxlib/py.typed +0 -0
  23. py_juxlib-0.3.1/src/juxlib/signing/__init__.py +68 -0
  24. py_juxlib-0.3.1/src/juxlib/signing/keys.py +165 -0
  25. py_juxlib-0.3.1/src/juxlib/signing/signer.py +121 -0
  26. py_juxlib-0.3.1/src/juxlib/signing/verifier.py +181 -0
  27. py_juxlib-0.3.1/src/juxlib/signing/xml.py +154 -0
  28. py_juxlib-0.3.1/src/juxlib/storage/__init__.py +46 -0
  29. py_juxlib-0.3.1/src/juxlib/storage/filesystem.py +405 -0
  30. py_juxlib-0.3.1/tests/__init__.py +4 -0
  31. py_juxlib-0.3.1/tests/conftest.py +125 -0
  32. py_juxlib-0.3.1/tests/fixtures/__init__.py +4 -0
  33. py_juxlib-0.3.1/tests/fixtures/generate-test-certs.sh +59 -0
  34. py_juxlib-0.3.1/tests/fixtures/sample-report.xml +8 -0
  35. py_juxlib-0.3.1/tests/fixtures/test-cert.pem +21 -0
  36. py_juxlib-0.3.1/tests/fixtures/test-ec-cert.pem +13 -0
  37. py_juxlib-0.3.1/tests/fixtures/test-ec-private.pem +5 -0
  38. py_juxlib-0.3.1/tests/fixtures/test-private.pem +27 -0
  39. py_juxlib-0.3.1/tests/integration/__init__.py +0 -0
  40. py_juxlib-0.3.1/tests/integration/test_config_storage.py +299 -0
  41. py_juxlib-0.3.1/tests/integration/test_e2e_workflow.py +289 -0
  42. py_juxlib-0.3.1/tests/test_version.py +27 -0
  43. py_juxlib-0.3.1/tests/unit/__init__.py +4 -0
  44. py_juxlib-0.3.1/tests/unit/test_api_client.py +476 -0
  45. py_juxlib-0.3.1/tests/unit/test_config.py +517 -0
  46. py_juxlib-0.3.1/tests/unit/test_errors.py +440 -0
  47. py_juxlib-0.3.1/tests/unit/test_metadata.py +552 -0
  48. py_juxlib-0.3.1/tests/unit/test_signing.py +450 -0
  49. py_juxlib-0.3.1/tests/unit/test_storage.py +624 -0
@@ -0,0 +1,177 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ .pybuilder/
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # IPython
80
+ profile_default/
81
+ ipython_config.py
82
+
83
+ # pyenv
84
+ .python-version
85
+
86
+ # pipenv
87
+ Pipfile.lock
88
+
89
+ # UV
90
+ uv.lock
91
+
92
+ # PEP 582
93
+ __pypackages__/
94
+
95
+ # Celery stuff
96
+ celerybeat-schedule
97
+ celerybeat.pid
98
+
99
+ # SageMath parsed files
100
+ *.sage.py
101
+
102
+ # Environments
103
+ .env
104
+ .env.*
105
+ !.env.example
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # pytype static type analyzer
132
+ .pytype/
133
+
134
+ # Cython debug symbols
135
+ cython_debug/
136
+
137
+ # ruff
138
+ .ruff_cache/
139
+
140
+ # Secrets and credentials
141
+ *.pem
142
+ *.key
143
+ credentials.json
144
+ secrets.yaml
145
+ secrets.yml
146
+ *.p12
147
+ *.pfx
148
+ # Allow test fixture keys (self-signed test certs only)
149
+ !tests/fixtures/*.pem
150
+
151
+ # Claude Code local files
152
+ CLAUDE.local.md
153
+ .claude/*.local.*
154
+
155
+ # IDE and editors
156
+ .idea/
157
+ .vscode/
158
+ *.swp
159
+ *.swo
160
+ *~
161
+ .project
162
+ .pydevproject
163
+ .settings/
164
+
165
+ # OS files
166
+ .DS_Store
167
+ .DS_Store?
168
+ ._*
169
+ .Spotlight-V100
170
+ .Trashes
171
+ ehthumbs.db
172
+ Thumbs.db
173
+
174
+ # Test output
175
+ *.xml
176
+ !tests/fixtures/*.xml
177
+ reports/
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Georges Martin
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,177 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-juxlib
3
+ Version: 0.3.1
4
+ Summary: Shared Python library for Jux tools ecosystem
5
+ Project-URL: Homepage, https://github.com/jux-tools/py-juxlib
6
+ Project-URL: Documentation, https://github.com/jux-tools/py-juxlib#readme
7
+ Project-URL: Repository, https://github.com/jux-tools/py-juxlib.git
8
+ Project-URL: Issues, https://github.com/jux-tools/py-juxlib/issues
9
+ Project-URL: Changelog, https://github.com/jux-tools/py-juxlib/blob/main/CHANGELOG.md
10
+ Author-email: Georges Martin <jrjsmrtn@gmail.com>
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: ci-cd,junit,metadata,signing,testing,xml
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: cryptography>=42.0
27
+ Requires-Dist: lxml>=5.0
28
+ Requires-Dist: pydantic>=2.0
29
+ Requires-Dist: requests>=2.31
30
+ Requires-Dist: rich>=13.0
31
+ Requires-Dist: signxml>=4.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: hypothesis>=6.0; extra == 'dev'
34
+ Requires-Dist: lxml-stubs>=0.5; extra == 'dev'
35
+ Requires-Dist: mypy>=1.10; extra == 'dev'
36
+ Requires-Dist: pre-commit>=3.0; extra == 'dev'
37
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
38
+ Requires-Dist: pytest-xdist>=3.0; extra == 'dev'
39
+ Requires-Dist: pytest>=8.0; extra == 'dev'
40
+ Requires-Dist: responses>=0.25; extra == 'dev'
41
+ Requires-Dist: ruff>=0.4; extra == 'dev'
42
+ Requires-Dist: types-requests>=2.31; extra == 'dev'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # py-juxlib
46
+
47
+ Shared Python library for the Jux tools ecosystem.
48
+
49
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
50
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
51
+
52
+ ## Overview
53
+
54
+ py-juxlib provides common functionality for Jux client tools:
55
+
56
+ - **Environment metadata detection** - Capture Git, CI/CD, and runtime environment information
57
+ - **XML digital signatures** - Sign and verify JUnit XML reports using XMLDSig
58
+ - **API client** - Publish signed reports to Jux OpenAPI servers
59
+ - **Configuration management** - Multi-source configuration with precedence handling
60
+ - **Local storage** - Filesystem storage with offline queue support
61
+ - **Error handling** - User-friendly errors with actionable suggestions
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install py-juxlib
67
+ ```
68
+
69
+ Or with [uv](https://docs.astral.sh/uv/):
70
+
71
+ ```bash
72
+ uv pip install py-juxlib
73
+ ```
74
+
75
+ ## Quick Start
76
+
77
+ ### Capture Environment Metadata
78
+
79
+ ```python
80
+ from juxlib.metadata import capture_metadata
81
+
82
+ metadata = capture_metadata()
83
+ print(f"Project: {metadata.project_name}")
84
+ print(f"Git commit: {metadata.git_commit}")
85
+ print(f"CI provider: {metadata.ci_provider}")
86
+ ```
87
+
88
+ ### Sign a JUnit XML Report
89
+
90
+ ```python
91
+ from juxlib.signing import sign_xml, load_private_key
92
+ from lxml import etree
93
+
94
+ # Load your private key
95
+ key = load_private_key("~/.ssh/jux/dev-key.pem")
96
+
97
+ # Parse and sign XML
98
+ tree = etree.parse("junit-report.xml")
99
+ signed_tree = sign_xml(tree.getroot(), key)
100
+
101
+ # Write signed XML
102
+ with open("junit-report-signed.xml", "wb") as f:
103
+ f.write(etree.tostring(signed_tree, xml_declaration=True, encoding="UTF-8"))
104
+ ```
105
+
106
+ ### Publish to Jux Server
107
+
108
+ ```python
109
+ from juxlib.api import JuxAPIClient
110
+
111
+ client = JuxAPIClient(
112
+ api_url="https://jux.example.com",
113
+ bearer_token="your-token"
114
+ )
115
+
116
+ with open("junit-report-signed.xml") as f:
117
+ response = client.publish_report(f.read())
118
+
119
+ print(f"Test run ID: {response.test_run_id}")
120
+ print(f"Success rate: {response.success_rate}%")
121
+ ```
122
+
123
+ ## Documentation
124
+
125
+ - [Tutorials](docs/tutorials/) - Getting started guides
126
+ - [How-To Guides](docs/howto/) - Task-specific solutions
127
+ - [Reference](docs/reference/) - API documentation
128
+ - [Explanation](docs/explanation/) - Architecture and design
129
+
130
+ ## Development
131
+
132
+ ```bash
133
+ # Clone the repository
134
+ git clone https://github.com/jux-tools/py-juxlib.git
135
+ cd py-juxlib
136
+
137
+ # Setup development environment
138
+ uv venv && uv pip install -e ".[dev]"
139
+
140
+ # Run tests
141
+ uv run pytest
142
+
143
+ # Run with coverage
144
+ uv run pytest --cov=juxlib --cov-report=term-missing
145
+
146
+ # Format and lint
147
+ uv run ruff format .
148
+ uv run ruff check .
149
+
150
+ # Type check
151
+ uv run mypy src/juxlib
152
+ ```
153
+
154
+ ## API Specification
155
+
156
+ > **Source of Truth**: The canonical API specifications live in **[jux-openapi](https://github.com/jux-tools/jux-openapi)**.
157
+ > - OpenAPI specs: `jux-openapi/specs/v1/`
158
+ > - API changelog: `jux-openapi/docs/CHANGELOG.md`
159
+
160
+ py-juxlib v0.2.0+ is compliant with jux-openapi API v1.0.0.
161
+
162
+ ## Related Projects
163
+
164
+ | Project | Description |
165
+ |---------|-------------|
166
+ | [pytest-jux](https://github.com/jux-tools/pytest-jux) | pytest plugin for signing and publishing JUnit XML |
167
+ | [behave-jux](https://github.com/jux-tools/behave-jux) | Enhanced JUnit reporter for behave BDD |
168
+ | [jux](https://github.com/jux-tools/jux) | Server for receiving and analyzing test reports |
169
+ | [jux-openapi](https://github.com/jux-tools/jux-openapi) | API contract specification (source of truth) |
170
+
171
+ ## License
172
+
173
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
174
+
175
+ ## Contributing
176
+
177
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
@@ -0,0 +1,133 @@
1
+ # py-juxlib
2
+
3
+ Shared Python library for the Jux tools ecosystem.
4
+
5
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
+
8
+ ## Overview
9
+
10
+ py-juxlib provides common functionality for Jux client tools:
11
+
12
+ - **Environment metadata detection** - Capture Git, CI/CD, and runtime environment information
13
+ - **XML digital signatures** - Sign and verify JUnit XML reports using XMLDSig
14
+ - **API client** - Publish signed reports to Jux OpenAPI servers
15
+ - **Configuration management** - Multi-source configuration with precedence handling
16
+ - **Local storage** - Filesystem storage with offline queue support
17
+ - **Error handling** - User-friendly errors with actionable suggestions
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install py-juxlib
23
+ ```
24
+
25
+ Or with [uv](https://docs.astral.sh/uv/):
26
+
27
+ ```bash
28
+ uv pip install py-juxlib
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ### Capture Environment Metadata
34
+
35
+ ```python
36
+ from juxlib.metadata import capture_metadata
37
+
38
+ metadata = capture_metadata()
39
+ print(f"Project: {metadata.project_name}")
40
+ print(f"Git commit: {metadata.git_commit}")
41
+ print(f"CI provider: {metadata.ci_provider}")
42
+ ```
43
+
44
+ ### Sign a JUnit XML Report
45
+
46
+ ```python
47
+ from juxlib.signing import sign_xml, load_private_key
48
+ from lxml import etree
49
+
50
+ # Load your private key
51
+ key = load_private_key("~/.ssh/jux/dev-key.pem")
52
+
53
+ # Parse and sign XML
54
+ tree = etree.parse("junit-report.xml")
55
+ signed_tree = sign_xml(tree.getroot(), key)
56
+
57
+ # Write signed XML
58
+ with open("junit-report-signed.xml", "wb") as f:
59
+ f.write(etree.tostring(signed_tree, xml_declaration=True, encoding="UTF-8"))
60
+ ```
61
+
62
+ ### Publish to Jux Server
63
+
64
+ ```python
65
+ from juxlib.api import JuxAPIClient
66
+
67
+ client = JuxAPIClient(
68
+ api_url="https://jux.example.com",
69
+ bearer_token="your-token"
70
+ )
71
+
72
+ with open("junit-report-signed.xml") as f:
73
+ response = client.publish_report(f.read())
74
+
75
+ print(f"Test run ID: {response.test_run_id}")
76
+ print(f"Success rate: {response.success_rate}%")
77
+ ```
78
+
79
+ ## Documentation
80
+
81
+ - [Tutorials](docs/tutorials/) - Getting started guides
82
+ - [How-To Guides](docs/howto/) - Task-specific solutions
83
+ - [Reference](docs/reference/) - API documentation
84
+ - [Explanation](docs/explanation/) - Architecture and design
85
+
86
+ ## Development
87
+
88
+ ```bash
89
+ # Clone the repository
90
+ git clone https://github.com/jux-tools/py-juxlib.git
91
+ cd py-juxlib
92
+
93
+ # Setup development environment
94
+ uv venv && uv pip install -e ".[dev]"
95
+
96
+ # Run tests
97
+ uv run pytest
98
+
99
+ # Run with coverage
100
+ uv run pytest --cov=juxlib --cov-report=term-missing
101
+
102
+ # Format and lint
103
+ uv run ruff format .
104
+ uv run ruff check .
105
+
106
+ # Type check
107
+ uv run mypy src/juxlib
108
+ ```
109
+
110
+ ## API Specification
111
+
112
+ > **Source of Truth**: The canonical API specifications live in **[jux-openapi](https://github.com/jux-tools/jux-openapi)**.
113
+ > - OpenAPI specs: `jux-openapi/specs/v1/`
114
+ > - API changelog: `jux-openapi/docs/CHANGELOG.md`
115
+
116
+ py-juxlib v0.2.0+ is compliant with jux-openapi API v1.0.0.
117
+
118
+ ## Related Projects
119
+
120
+ | Project | Description |
121
+ |---------|-------------|
122
+ | [pytest-jux](https://github.com/jux-tools/pytest-jux) | pytest plugin for signing and publishing JUnit XML |
123
+ | [behave-jux](https://github.com/jux-tools/behave-jux) | Enhanced JUnit reporter for behave BDD |
124
+ | [jux](https://github.com/jux-tools/jux) | Server for receiving and analyzing test reports |
125
+ | [jux-openapi](https://github.com/jux-tools/jux-openapi) | API contract specification (source of truth) |
126
+
127
+ ## License
128
+
129
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
130
+
131
+ ## Contributing
132
+
133
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.