Skip to main content

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:

🤝 Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

Development Setup

  1. Clone the repository
  2. Install dependencies: make install
  3. Run tests: make test
  4. Format code: make format
  5. Run linting: make lint

📄 License

MIT License - see LICENSE file for details

Metadata

Release files for fivcglue 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fivcglue 0.1.8
File Size Uploaded Provenance
fivcglue-0.1.8.tar.gz 40.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fivcglue 0.1.8
File Interpreter ABI Platform
fivcglue-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 75.6 kB

Release files / fivcglue-0.1.8.tar.gz

Download URL fivcglue-0.1.8.tar.gz
Size 40.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f8d6f750e758c819cb04c952ec5748a59db125a78132f4a6fa655793288d71bd
BLAKE2b-256 checksum
How to use checksums
6610e9de477ed995faca72bef95c8d071e3907c34f0aedf6fbc46647327614a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.10

Release files / fivcglue-0.1.8-py3-none-any.whl

Download URL fivcglue-0.1.8-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
577a0fb1425db4cdb71b0c19c52c7e2ea70fff53ee8224f337625635a470edaf
BLAKE2b-256 checksum
How to use checksums
9b4d8508bf3a71726e32d817dfad691bd278ff26bb2973b4bd077d6b351c680b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.10

Security for fivcglue 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page