A Domain-Driven Design (DDD) programming package for Python, similar to zope.interface
Project description
FivcGlue
A Domain-Driven Design (DDD) programming package for Python, similar to zope.interface.
๐ฏ Overview
FivcGlue provides a clean and intuitive way to implement Domain-Driven Design patterns in Python applications. It offers interfaces and implementations for common DDD building blocks, helping you structure your code following DDD principles.
๐ Quick Start
Prerequisites
- Python 3.10 or higher
- UV package manager (recommended) or pip
Installation
With UV (recommended):
# Install with development dependencies
make install
# Or minimal installation
make install-min
# With YAML support
uv sync --extra yaml
With pip:
# Basic installation
pip install -e .
# With YAML support
pip install -e ".[yaml]"
# With development dependencies
pip install -e ".[dev,yaml]"
๐ฆ Features
FivcGlue provides core DDD building blocks:
- Interfaces: Define contracts for your domain components
- Configurations: Flexible configuration management (JSON, YAML)
- Caching: In-memory and Redis-based caching implementations
- Logging: Built-in logging utilities
- Mutexes: Distributed locking with Redis support
๐ป Usage
Basic Example
from fivcglue.interfaces import IConfig
from fivcglue.implements import YAMLFileConfig
# Load configuration from YAML file
config = YAMLFileConfig("config.yml")
value = config.get("key", default="default_value")
Configuration Management
from fivcglue.implements import JSONFileConfig, YAMLFileConfig
# JSON configuration
json_config = JSONFileConfig("settings.json")
# YAML configuration (requires PyYAML)
yaml_config = YAMLFileConfig("settings.yml")
Caching
from datetime import timedelta
from fivcglue.implements.caches_mem import CacheImpl as MemoryCacheImpl
from fivcglue.implements.caches_redis import CacheImpl as RedisCacheImpl
# In-memory cache
cache = MemoryCacheImpl(_component_site=None, max_size=10000)
cache.set_value("key", b"value", expire=timedelta(hours=1))
value = cache.get_value("key")
# Redis cache (requires redis package)
redis_cache = RedisCacheImpl(_component_site=None, host="localhost", port=6379)
redis_cache.set_value("key", b"value", expire=timedelta(hours=1))
๐ Project Structure
src/fivcglue/
โโโ interfaces/ # Interface definitions
โ โโโ configs.py # Configuration interfaces
โ โโโ caches.py # Cache interfaces
โ โโโ loggers.py # Logger interfaces
โ โโโ mutexes.py # Mutex interfaces
โโโ implements/ # Concrete implementations
โ โโโ configs_jsonfile.py
โ โโโ configs_yamlfile.py
โ โโโ caches_mem.py
โ โโโ caches_redis.py
โ โโโ loggers_builtin.py
โ โโโ mutexes_redis.py
โโโ fixtures/ # Test fixtures
๐ ๏ธ Development
Available Make Commands
make help # Show all available commands
make install # Install with dev dependencies
make install-min # Install minimal dependencies
make dev # Install development dependencies
make lint # Run code linting
make format # Format code
make test # Run tests
make test-cov # Run tests with coverage
make clean # Clean temporary files
make build # Build distribution packages
Running Tests
# Run all tests
make test
# Run with coverage
make test-cov
# Run specific test file
uv run pytest tests/test_configs.py -v
Code Quality
# Lint code
make lint
# Format code
make format
๐ Documentation
For more detailed documentation, see the docs/ directory:
- Architecture - System architecture and design
- Dependencies - Dependency management guide
๐ค Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Development Setup
- Clone the repository
- Install dependencies:
make install - Run tests:
make test - Format code:
make format - Run linting:
make lint
๐ License
MIT License - see LICENSE file for details
๐ Links
- Documentation: GitHub README
- Issues: GitHub Issues
- Source: GitHub Repository
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 fivcglue-0.1.1.tar.gz.
File metadata
- Download URL: fivcglue-0.1.1.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e790b22756a99aa46f395660980aeb419feff6921e0ae1db7b9bbd403cb3c37
|
|
| MD5 |
74595382fced1e314149e53c30f5ad4d
|
|
| BLAKE2b-256 |
60a1ef494c4d2cb074254420b9d8290810a0c7f555fe818db6abd0d62a7bd31a
|
File details
Details for the file fivcglue-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fivcglue-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ef975e72d99e79ca3b1b0a9948eb83a76d839becbdbac6f1b4af766103aa9a8
|
|
| MD5 |
ae9c359c30dff9032c51deee44eb8c15
|
|
| BLAKE2b-256 |
33da90310e52c0fb6ce52281440d2337621a83887a5a41b382269af48362d60f
|