Shared Python library for Jux tools ecosystem
Project description
py-juxlib
Shared Python library for the Jux tools ecosystem.
Overview
py-juxlib provides common functionality for Jux client tools:
- Environment metadata detection - Capture Git, CI/CD, and runtime environment information
- XML digital signatures - Sign and verify JUnit XML reports using XMLDSig
- API client - Publish signed reports to Jux OpenAPI servers
- Configuration management - Multi-source configuration with precedence handling
- Local storage - Filesystem storage with offline queue support
- Error handling - User-friendly errors with actionable suggestions
Installation
pip install py-juxlib
Or with uv:
uv pip install py-juxlib
Quick Start
Capture Environment Metadata
from juxlib.metadata import capture_metadata
metadata = capture_metadata()
print(f"Project: {metadata.project_name}")
print(f"Git commit: {metadata.git_commit}")
print(f"CI provider: {metadata.ci_provider}")
Sign a JUnit XML Report
from juxlib.signing import sign_xml, load_private_key
from lxml import etree
# Load your private key
key = load_private_key("~/.ssh/jux/dev-key.pem")
# Parse and sign XML
tree = etree.parse("junit-report.xml")
signed_tree = sign_xml(tree.getroot(), key)
# Write signed XML
with open("junit-report-signed.xml", "wb") as f:
f.write(etree.tostring(signed_tree, xml_declaration=True, encoding="UTF-8"))
Publish to Jux Server
from juxlib.api import JuxAPIClient
client = JuxAPIClient(
api_url="https://jux.example.com",
bearer_token="your-token"
)
with open("junit-report-signed.xml") as f:
response = client.publish_report(f.read())
print(f"Test run ID: {response.test_run_id}")
print(f"Success rate: {response.success_rate}%")
Documentation
- Tutorials - Getting started guides
- How-To Guides - Task-specific solutions
- Reference - API documentation
- Explanation - Architecture and design
Development
# Clone the repository
git clone https://github.com/jux-tools/py-juxlib.git
cd py-juxlib
# Setup development environment
uv venv && uv pip install -e ".[dev]"
# Run tests
uv run pytest
# Run with coverage
uv run pytest --cov=juxlib --cov-report=term-missing
# Format and lint
uv run ruff format .
uv run ruff check .
# Type check
uv run mypy src/juxlib
API Specification
Source of Truth: The canonical API specifications live in jux-openapi.
- OpenAPI specs:
jux-openapi/specs/v1/- API changelog:
jux-openapi/docs/CHANGELOG.md
py-juxlib v0.2.0+ is compliant with jux-openapi API v1.0.0.
Related Projects
| Project | Description |
|---|---|
| pytest-jux | pytest plugin for signing and publishing JUnit XML |
| behave-jux | Enhanced JUnit reporter for behave BDD |
| jux | Server for receiving and analyzing test reports |
| jux-openapi | API contract specification (source of truth) |
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributing
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_juxlib-0.3.1.tar.gz.
File metadata
- Download URL: py_juxlib-0.3.1.tar.gz
- Upload date:
- Size: 60.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e0cc5794420031a61c076ebb39d6c547828cfbe99fcc4085fa26b3fb275151b
|
|
| MD5 |
bd37e922a46175caa36336aedc7209c1
|
|
| BLAKE2b-256 |
a1ecbf0fdd21952ad3a5c15445fe8db62a5910118559dc3a799435fda9afe485
|
Provenance
The following attestation bundles were made for py_juxlib-0.3.1.tar.gz:
Publisher:
build-release.yml on jux-tools/py-juxlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_juxlib-0.3.1.tar.gz -
Subject digest:
8e0cc5794420031a61c076ebb39d6c547828cfbe99fcc4085fa26b3fb275151b - Sigstore transparency entry: 947072472
- Sigstore integration time:
-
Permalink:
jux-tools/py-juxlib@440ef9d6183d22cf8e5f7834b76424bd805ebefb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jux-tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@440ef9d6183d22cf8e5f7834b76424bd805ebefb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file py_juxlib-0.3.1-py3-none-any.whl.
File metadata
- Download URL: py_juxlib-0.3.1-py3-none-any.whl
- Upload date:
- Size: 46.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c42ca51e4d15448642a2356d69005cf685bdc7da7ef39067189fe97d5030a28
|
|
| MD5 |
d0a0c51328412dd27960a7afe36d715e
|
|
| BLAKE2b-256 |
0933cdf183764cda30519750694ff78938e347130382106a6031262adc992c2a
|
Provenance
The following attestation bundles were made for py_juxlib-0.3.1-py3-none-any.whl:
Publisher:
build-release.yml on jux-tools/py-juxlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_juxlib-0.3.1-py3-none-any.whl -
Subject digest:
2c42ca51e4d15448642a2356d69005cf685bdc7da7ef39067189fe97d5030a28 - Sigstore transparency entry: 947072478
- Sigstore integration time:
-
Permalink:
jux-tools/py-juxlib@440ef9d6183d22cf8e5f7834b76424bd805ebefb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jux-tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@440ef9d6183d22cf8e5f7834b76424bd805ebefb -
Trigger Event:
workflow_dispatch
-
Statement type: