A polyglot message bus library
Project description
PolyBus Python
A Python implementation of the PolyBus messaging library, providing a unified interface for message transport across different messaging systems.
Prerequisites
- Python 3.8+ (supports Python 3.8-3.12)
- pip (Python package installer)
- Any IDE that supports Python development (VS Code, PyCharm, etc.)
Quick Start
Setting Up Development Environment
# Navigate to the python directory
cd src/python
# The project uses a virtual environment at the repo root
# It should already be configured by VS Code
# If needed, activate it:
source ../../.venv/bin/activate # On Windows: ..\..\\.venv\Scripts\activate
# Install the package in development mode with dev dependencies
pip install -e ".[dev]"
# Or use the dev script with PYTHON env var:
# PYTHON=../../.venv/bin/python ./dev.sh install
Building the Project
# Install dependencies and package
./dev.sh install
# Build the package
./dev.sh build
Running Tests
# Activate virtual environment first
source ../../.venv/bin/activate # On Windows: .venv\Scripts\activate
# Run all tests
python -m pytest
# Or: ./dev.sh test (if PYTHON env var is set)
# Run tests with coverage
python -m pytest --cov=src --cov-report=html --cov-report=term
# Or: ./dev.sh test-cov
# Run specific test files
python -m pytest tests/test_poly_bus.py
# Run tests with verbose output
python -m pytest -v
# Run tests matching a pattern
python -m pytest -k "test_pattern"
Development Workflow
Code Quality and Linting
This project includes comprehensive code analysis and formatting tools:
# Run the complete development check suite
./dev.sh check
# Format code automatically
./dev.sh format
# Run linters only
./dev.sh lint
# Individual tools:
python -m black src tests # Code formatting
python -m isort src tests # Import sorting
python -m flake8 src tests # Style checking
python -m mypy src # Type checking
IDE Integration
Visual Studio Code
- Install the Python extension
- Install Python development extensions (Black, isort, Flake8, mypy)
- Open the
src/pythonfolder in VS Code - The project includes configuration for auto-formatting and linting
PyCharm
- Open the
src/pythonfolder as a project - Configure the virtual environment as the project interpreter
- Enable code inspections and formatting tools
Configuration
Project Configuration
The project uses pyproject.toml for modern Python packaging:
- Python Version: 3.8+ (supports 3.8-3.12)
- Build System: setuptools
- Testing: pytest with coverage
- Code Quality: black, isort, flake8, mypy
- Package Structure: src layout
Code Style
Code style is enforced through:
- Black (88 character line length)
- isort (import sorting with black profile)
- flake8 (PEP 8 compliance)
- mypy (type checking with strict settings)
Testing Configuration
Pytest configuration includes:
- Coverage reporting (HTML, XML, terminal)
- Strict marker and config validation
- Support for async tests (pytest-asyncio)
- Test discovery patterns
Dependencies
Runtime Dependencies
- No runtime dependencies (pure Python implementation)
Development Dependencies
pytest>=7.0.0- Testing frameworkpytest-cov>=4.0.0- Coverage reportingpytest-asyncio>=0.21.0- Async test supportblack>=23.0.0- Code formattingisort>=5.12.0- Import sortingflake8>=6.0.0- Style checkingmypy>=1.0.0- Type checking
Common Commands
# Development script commands
./dev.sh install # Install in development mode
./dev.sh test # Run tests
./dev.sh test-cov # Run tests with coverage
./dev.sh lint # Run all linters
./dev.sh format # Format code
./dev.sh check # Run all checks (format + lint + test)
./dev.sh clean # Clean build artifacts
./dev.sh build # Build package
./dev.sh help # Show all available commands
# Direct pytest commands
python -m pytest # Run all tests
python -m pytest --cov-report=html # Generate HTML coverage report
python -m pytest tests/example.py # Run specific test file
python -m pytest -x # Stop on first failure
python -m pytest --lf # Run last failed tests only
# Package management
pip install -e ".[dev]" # Install in development mode
pip install -r requirements-dev.txt # Install dev dependencies only
python -m build # Build wheel and source distribution
Troubleshooting
Environment Issues
-
Python Version: Ensure Python 3.8+ is installed
python3 --version -
Virtual Environment: Always use a virtual environment
python3 -m venv venv source venv/bin/activate
-
Package Installation Issues: Upgrade pip and setuptools
pip install --upgrade pip setuptools wheel
Test Issues
-
Import Errors: Ensure package is installed in development mode
pip install -e ".[dev]"
-
Coverage Issues: Check that source paths are correct in
pyproject.toml -
Type Checking Issues: mypy configuration is strict; add type annotations as needed
Code Quality Issues
- Formatting: Run
./dev.sh formatto auto-fix most formatting issues - Import Order: isort will automatically fix import ordering
- Type Errors: Add proper type annotations for mypy compliance
Contributing
- Follow the established code style (enforced by formatters and linters)
- Run
./dev.sh checkbefore committing - Ensure all tests pass and maintain high coverage
- Add tests for new functionality
- Add type annotations for all new code
- Update documentation as needed
Coverage Reports
After running tests with coverage (./dev.sh test-cov):
- Terminal: Coverage summary displayed in terminal
- HTML: Detailed report available in
htmlcov/index.html - XML: Machine-readable report in
coverage.xml
Additional Resources
License
See the main project LICENSE file for licensing information.
Project details
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 poly_bus-0.3.11.tar.gz.
File metadata
- Download URL: poly_bus-0.3.11.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd4fa62b7bbc6473fcce8c41b122b3817408212f763a015a296fda79d7d4f1af
|
|
| MD5 |
320f343fb8d4bc65e9b6170e8efe293c
|
|
| BLAKE2b-256 |
3c47936216cdb1c4ce5b190c59ea7a768d5dbf4a24a7dc36897ba2a93cab47a8
|
Provenance
The following attestation bundles were made for poly_bus-0.3.11.tar.gz:
Publisher:
release-and-publish.yml on CyAScott/poly-bus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
poly_bus-0.3.11.tar.gz -
Subject digest:
fd4fa62b7bbc6473fcce8c41b122b3817408212f763a015a296fda79d7d4f1af - Sigstore transparency entry: 1240064216
- Sigstore integration time:
-
Permalink:
CyAScott/poly-bus@3e13d7a7717e2dd1bc94c3e7dc36bff549933eae -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CyAScott
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-and-publish.yml@3e13d7a7717e2dd1bc94c3e7dc36bff549933eae -
Trigger Event:
push
-
Statement type:
File details
Details for the file poly_bus-0.3.11-py3-none-any.whl.
File metadata
- Download URL: poly_bus-0.3.11-py3-none-any.whl
- Upload date:
- Size: 23.9 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 |
a80b0c94297a0f13659d6e9c9b3f381ec620547ef6c9308bc5644f08d17ddcd9
|
|
| MD5 |
d1ca6bac27a24dbce6d1f38680445f9d
|
|
| BLAKE2b-256 |
9acd91c8fc60434506ae399eb6a010054d22ef5e2fd69f6d48eff58abc150ffc
|
Provenance
The following attestation bundles were made for poly_bus-0.3.11-py3-none-any.whl:
Publisher:
release-and-publish.yml on CyAScott/poly-bus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
poly_bus-0.3.11-py3-none-any.whl -
Subject digest:
a80b0c94297a0f13659d6e9c9b3f381ec620547ef6c9308bc5644f08d17ddcd9 - Sigstore transparency entry: 1240064265
- Sigstore integration time:
-
Permalink:
CyAScott/poly-bus@3e13d7a7717e2dd1bc94c3e7dc36bff549933eae -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CyAScott
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-and-publish.yml@3e13d7a7717e2dd1bc94c3e7dc36bff549933eae -
Trigger Event:
push
-
Statement type: