This release is a pre-release and may not be stable for production use.
Bivouac Framework
A modular Flask framework for building scalable web applications with built-in authentication, permissions, and multi-tenant support.
Features
- Modular Architecture: Dynamic module loading and management
- Authentication System: Flask-User based authentication with session management
- Role-Based Access Control: Comprehensive permission system with caching
- Multi-Tenant Support: Organization-based data isolation
- CLI Tools: Command-line interface for application management
- Extensible: Easy to extend with custom modules and functionality
Quick Start
Installation
pip install bivouac-framework
Basic Usage
from bivouac_framework import create_app
from bivouac_framework.core.config import Config
# Create configuration
config = Config()
config.SECRET_KEY = 'your-secret-key'
config.SQLALCHEMY_DATABASE_URI = 'sqlite:///app.db'
# Create application
app = create_app(config)
if __name__ == '__main__':
app.run(debug=True)
CLI Commands
# Create a new application
bivouac create-app myapp
# List available modules
bivouac list-modules
# Check version
bivouac --version
Core Components
Module System
The framework provides a dynamic module loading system:
from bivouac_framework.core.module_registry import ModuleRegistry
from bivouac_framework.core.module_base import ModuleBase
class MyModule(ModuleBase):
name = "My Module"
version = "1.0.0"
def initialize(self):
# Module initialization code
pass
def cleanup(self):
# Module cleanup code
pass
# Register module
ModuleRegistry.register_module(MyModule())
Authentication
Built-in authentication with Flask-User:
from bivouac_framework.auth.auth_service import AuthService
# Check if user is authenticated
if AuthService.is_authenticated():
user = AuthService.get_current_user()
print(f"Welcome, {user.username}!")
Permissions
Role-based access control system:
from bivouac_framework.permissions.permission_service import PermissionService
# Create permission
PermissionService.create_permission('user.edit', 'Edit users', 'user')
# Check permission
if PermissionService.has_permission('user.edit'):
# User can edit
pass
Organizations
Multi-tenant organization support:
from bivouac_framework.organizations.organization_service import OrganizationService
# Get user's organization
org = OrganizationService.get_user_organization(user_id)
# Create organization
new_org = OrganizationService.create_organization('My Company')
Module Development
Creating a Module
- Structure your module:
my_module/
├── __init__.py
├── routes.py
├── models.py
├── services/
├── templates/
└── static/
- Define your module class:
# my_module/__init__.py
from bivouac_framework.core.module_base import ModuleBase
from flask import Blueprint
class MyModule(ModuleBase):
name = "My Module"
version = "1.0.0"
def __init__(self):
self.blueprint = Blueprint('my_module', __name__)
self.register_routes()
def register_routes(self):
from . import routes
# Register routes here
- Register your module:
from bivouac_framework.core.module_registry import ModuleRegistry
from my_module import MyModule
ModuleRegistry.register_module(MyModule())
Module Lifecycle
Modules follow a specific lifecycle:
- Registration: Module is registered with the system
- Initialization:
initialize()method is called - Activation: Module becomes active and available
- Runtime: Module is used during application execution
- Cleanup:
cleanup()method is called on shutdown
Configuration
The framework uses a configuration system that supports multiple environments:
from bivouac_framework.core.config import Config
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///dev.db'
class ProductionConfig(Config):
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'postgresql://user:pass@localhost/prod'
API Reference
Core Classes
ModuleRegistry: Manages module registration and lifecycleModuleBase: Base class for all modulesConfig: Configuration managementAuthService: Authentication and user managementPermissionService: Permission and role managementOrganizationService: Multi-tenant organization management
CLI Commands
bivouac create-app <name>: Create a new applicationbivouac list-modules: List available modulesbivouac --version: Show version information
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support and questions:
- Create an issue on GitHub
- Check the documentation
- Join our community discussions
Changelog
See CHANGELOG.md for a list of changes and version history.
Metadata
Release files for bivouac-framework 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bivouac_framework-0.1.0a0.tar.gz | 18.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bivouac_framework-0.1.0a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.0 kB
Release files / bivouac_framework-0.1.0a0.tar.gz
| Download URL | bivouac_framework-0.1.0a0.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16ca6f696de52738cb37317716a6b806b03145d5b816b20aa1659d48b31c8814
|
|
BLAKE2b-256 checksum How to use checksums |
5d0d3136de1874d80c53ce908093777c08b9cc47cd024b8e7466a8769a679f94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / bivouac_framework-0.1.0a0-py3-none-any.whl
| Download URL | bivouac_framework-0.1.0a0-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
102a8f43eb8b6fdf6bd706da14f92d569d0280e321f7718072f379d99a1e0e09
|
|
BLAKE2b-256 checksum How to use checksums |
47fd770ecb6c4109ee07598e773738897f9c5506583477154709b5ae6f681de5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|