A zen-like, modern async Python library for Odoo RPC with type safety, transactions, caching, and superior DX
Project description
Zenoo RPC
A zen-like, modern async Python library for Odoo RPC with type safety and superior Developer Experience (DX)
๐ Documentation โข ๐ Quick Start โข ๐ฆ PyPI โข ๐ Issues โข ๐ฌ Discussions
๐ Why Zenoo RPC?
Zenoo RPC is a next-generation Python library designed to replace odoorpc with modern Python practices and superior performance. Built from the ground up with async/await, type safety, and developer experience in mind.
"Zen" - Simple, elegant, and intuitive API design
"oo" - Object-oriented with Odoo integration
"RPC" - Remote Procedure Call excellence
โจ Key Features
- ๐ Async-First: Built with
asyncioandhttpxfor high-performance concurrent operations - ๐ก๏ธ Type Safety: Full Pydantic integration with IDE support and runtime validation
- ๐ฏ Fluent API: Intuitive, chainable query builder that feels natural
- โก Performance: Intelligent caching, batch operations, and optimized RPC calls
- ๐ง Modern Python: Leverages Python 3.8+ features with proper type hints
- ๐ฆ Clean Architecture: Well-structured, testable, and maintainable codebase
- ๐ Transaction Support: ACID-compliant transactions with rollback capabilities
- ๐ Batch Operations: Efficient bulk operations for high-performance scenarios
- ๐ Retry Mechanisms: Intelligent retry with exponential backoff and circuit breaker
- ๐พ Intelligent Caching: TTL/LRU caching with Redis support
๐ค Problems with odoorpc
- Synchronous only: No async support for modern Python applications
- No type safety: Raw dictionaries and lists without validation
- Chatty API: Multiple RPC calls for simple operations (search + browse)
- Complex relationship handling: Requires knowledge of Odoo's tuple commands
- Poor error handling: Generic exceptions without context
- No caching: Repeated calls for the same data
๐ฏ Zenoo RPC Solutions
# odoorpc (old way)
Partner = odoo.env['res.partner']
partner_ids = Partner.search([('is_company', '=', True)], limit=10)
partners = Partner.browse(partner_ids) # Second RPC call!
# Zenoo RPC (modern way)
async with ZenooClient("localhost", port=8069) as client:
await client.login("demo", "admin", "admin")
partners = await client.model(ResPartner).filter(
is_company=True
).limit(10).all() # Single RPC call with type safety!
๐ฆ Installation
From PyPI (Recommended)
pip install zenoo-rpc
With Optional Dependencies
# For Redis caching support
pip install zenoo-rpc[redis]
# For development
pip install zenoo-rpc[dev]
# All optional dependencies
pip install zenoo-rpc[dev,redis]
From Source
git clone https://github.com/tuanle96/zenoo-rpc.git
cd zenoo-rpc
pip install -e .
๐๏ธ Architecture
Zenoo RPC follows modern Python best practices with a clean, modular architecture:
src/zenoo_rpc/
โโโ client.py # Main async client
โโโ transport/ # HTTP transport layer
โโโ models/ # Pydantic models
โโโ query/ # Fluent query builder
โโโ cache/ # Async caching layer
โโโ exceptions/ # Structured exception hierarchy
โโโ transaction/ # Transaction management
โโโ batch/ # Batch operations
โโโ retry/ # Retry mechanisms
โโโ utils/ # Utilities and helpers
๐ Quick Start
import asyncio
from zenoo_rpc import ZenooClient
from zenoo_rpc.models.common import ResPartner
async def main():
async with ZenooClient("localhost", port=8069) as client:
# Authenticate
await client.login("my_database", "admin", "admin")
# Type-safe queries with IDE support
partners = await client.model(ResPartner).filter(
is_company=True,
name__ilike="company%"
).limit(10).all()
# Access fields with full type safety
for partner in partners:
print(f"Company: {partner.name} - Email: {partner.email}")
# Transaction management
async with client.transaction() as tx:
partner = await client.model(ResPartner).get(1)
partner.name = "New Name"
partner.email = "new@email.com"
# Committed automatically on context exit
if __name__ == "__main__":
asyncio.run(main())
๐ฏ Advanced Features
Lazy Loading with Type Safety
# Relationship fields are lazy-loaded automatically
partner = await client.model(ResPartner).get(1)
company = await partner.company_id # Loaded on demand
children = await partner.child_ids.all() # Lazy collection
Intelligent Caching
async with ZenooClient("localhost", port=8069) as client:
await client.login("demo", "admin", "admin")
# Setup cache manager
await client.setup_cache_manager(backend="redis", url="redis://localhost:6379/0")
# Cached queries
partners = await client.model(ResPartner).filter(
is_company=True
).cache(ttl=300).all() # Cached for 5 minutes
Batch Operations
async with ZenooClient("localhost", port=8069) as client:
await client.login("demo", "admin", "admin")
# Setup batch manager
await client.setup_batch_manager(max_chunk_size=100)
# Efficient bulk operations
async with client.batch() as batch:
partners_data = [
{"name": "Company 1", "email": "c1@example.com"},
{"name": "Company 2", "email": "c2@example.com"},
]
partners = await batch.create_many(ResPartner, partners_data)
Transaction Management
async with ZenooClient("localhost", port=8069) as client:
await client.login("demo", "admin", "admin")
# Setup transaction manager
await client.setup_transaction_manager()
# ACID transactions with rollback
async with client.transaction() as tx:
partner = await client.model(ResPartner).create({
"name": "Test Company",
"email": "test@example.com"
})
# If any error occurs, transaction is automatically rolled back
await partner.update({"phone": "+1234567890"})
# Committed automatically on successful exit
๐งช Development Status
Zenoo RPC is currently in Alpha stage with active development. The core architecture is stable and functional, but we're continuously improving based on community feedback.
Current Status
- โ Core Features: Fully implemented and tested
- โ Type Safety: Complete Pydantic integration
- โ Async Operations: Full async/await support
- โ Advanced Features: Caching, transactions, batch operations
- โ Documentation: Comprehensive guides and examples
- ๐ Community: Growing user base and contributors
- ๐ Performance: Ongoing optimization efforts
Roadmap
- Phase 1: Core transport layer and async client
- Phase 2: Pydantic models and query builder foundation
- Phase 3: Advanced features (caching, transactions, batch ops)
- Phase 4: Documentation and community adoption
- Phase 5: Performance optimization and production hardening
- Phase 6: Plugin system and extensibility
- Phase 7: GraphQL support and modern APIs
Production Readiness
Zenoo RPC is being used in production environments, but we recommend:
- Testing: Thoroughly test in your specific environment
- Monitoring: Implement proper logging and monitoring
- Gradual Migration: Migrate from odoorpc incrementally
- Community Support: Join our discussions for help and feedback
Compatibility
- Python: 3.8, 3.9, 3.10, 3.11, 3.12
- Odoo: 18.0 (tested) - other versions compatibility not yet verified
- Operating Systems: Linux, macOS, Windows
๐ค Contributing
We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or sharing feedback, your contributions help make Zenoo RPC better for everyone.
Ways to Contribute
- ๐ Report Bugs: Use our issue templates
- โจ Request Features: Share your ideas in GitHub Discussions
- ๐ Improve Documentation: Help us make the docs clearer and more comprehensive
- ๐งช Write Tests: Increase test coverage and add edge cases
- ๐ง Fix Issues: Pick up issues labeled
good first issueorhelp wanted - ๐ก Share Examples: Contribute real-world usage examples
Quick Development Setup
# Clone the repository
git clone https://github.com/tuanle96/zenoo-rpc.git
cd zenoo-rpc
# Install development dependencies
pip install -e ".[dev,redis]"
# Install pre-commit hooks (recommended)
pre-commit install
# Run tests
pytest
# Run quality checks
ruff check .
black .
mypy src/zenoo_rpc
# Build documentation locally
mkdocs serve
Contribution Guidelines
Please read our Contributing Guide for detailed information about:
- Code style and conventions
- Testing requirements
- Pull request process
- Issue reporting guidelines
- Community standards
Development Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with tests
- Run quality checks (
pre-commit run --all-files) - Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
Getting Help
- ๐ฌ GitHub Discussions: Ask questions and get help
- ๐ Documentation: Comprehensive guides and examples
- ๐ Issues: Report bugs or request features
๐ ๏ธ Development
Want to contribute? Here's how to set up your development environment:
# Clone the repository
git clone https://github.com/tuanle96/zenoo-rpc.git
cd zenoo-rpc
# Install development dependencies
pip install -e ".[dev,redis]"
# Install pre-commit hooks (recommended)
pre-commit install
# Run tests
pytest
# Run quality checks
ruff check .
black .
mypy src/zenoo_rpc
๐ Documentation
- Getting Started: Installation and basic usage
- User Guide: Comprehensive feature documentation
- API Reference: Complete API documentation
- Migration Guide: Migrating from odoorpc
- Examples: Real-world usage examples
๐ Support
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: Questions and community discussion
- Documentation: Comprehensive guides and API reference
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Inspired by the need to modernize the Odoo Python ecosystem
- Built on the shoulders of giants:
httpx,pydantic, andasyncio - Thanks to the OCA team for maintaining
odoorpcand showing us what to improve - Special thanks to all contributors and early adopters
Zenoo RPC: Because your Odoo integrations deserve modern Python! ๐โจ
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 zenoo_rpc-0.1.1.tar.gz.
File metadata
- Download URL: zenoo_rpc-0.1.1.tar.gz
- Upload date:
- Size: 107.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbb47c9c3562aad4f07d7665742ca29c85b3d06a5fe4596d64412cdf02782002
|
|
| MD5 |
a86f5ddda05b6bb91bcf7a31c37f5e42
|
|
| BLAKE2b-256 |
7fee8ec185e6a321fde4b1b87bd5c6b072663e247c93e27b97bdd04064deedcb
|
File details
Details for the file zenoo_rpc-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: zenoo_rpc-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 123.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
079ac22b2cacb339154228b5299a45b25bf207ae25f1eed5e582649266d1bb7a
|
|
| MD5 |
3951eb6461e05616b4872401c0571270
|
|
| BLAKE2b-256 |
d82a1b6fc2d04a15ef34df9fa84f220cbafa0429cd123a525f7932eaa95f259d
|