Skip to main content

A lightning-fast, Spring Boot-inspired framework for Python.

Project description

flashboot-core

A lightweight, Spring Boot-inspired framework for Python. Build structured, maintainable applications with dependency injection, event-driven architecture, environment profiles, and more.

Installation

pip install flashboot-core

Requires Python >= 3.10.

Quick Start

from flashboot_core.beans.decorators import component
from flashboot_core.context.flash_app import FlashApplication

@component(name="greeter")
class Greeter:
    def hello(self, name: str) -> str:
        return f"Hello, {name}!"

app = FlashApplication(Greeter)
context = app.run()

Features

Component & Dependency Injection

Mark classes as components for auto-discovery and registration:

from flashboot_core.beans.decorators import component
from flashboot_core.beans.lifecycle import post_construct, pre_destroy

@component(name="user_service")
class UserService:
    @post_construct
    def init(self):
        print("UserService initialized")

    @pre_destroy
    def cleanup(self):
        print("UserService destroyed")

Application Context

Register and retrieve beans programmatically:

from flashboot_core.context.app_context import ApplicationContext

context = ApplicationContext()
context.register_bean("user_service", UserService())

service = context.get_bean("user_service")

Environment & Profiles

Manage configuration across dev, test, and prod environments:

from flashboot_core.env import Environment

profiles = Environment.get_active_profiles(default_profile="dev")
# Set via env var: profiles.active=dev
# Or CLI arg:      --profiles.active=dev

Bind YAML configuration directly to classes:

from flashboot_core.env import property_bind

@property_bind("database", config_dir="./resources/configs")
class DatabaseConfig:
    host: str
    port: int
    username: str

# Fields auto-populated from YAML:
# database:
#   host: localhost
#   port: 5432
#   username: admin

Event Bus

Publish and subscribe to events with priority support:

from flashboot_core.event_bus import sync_event_bus

@sync_event_bus.on("user_created", priority=10)
def send_welcome_email(user_id):
    print(f"Sending welcome email to user {user_id}")

@sync_event_bus.on("user_created", priority=1)
def log_user_creation(user_id):
    print(f"User {user_id} created")

# Higher priority executes first
sync_event_bus.emit("user_created", user_id=42)

Project Root Detection

Smart project root discovery with monorepo support:

from flashboot_core.utils.project_utils import (
    get_project_root,
    get_workspace_root,
    setup_import_path,
)

# Find the nearest project root (sub-project level)
project = get_project_root()

# Find the outermost workspace root (monorepo level)
workspace = get_workspace_root()

# Add project root to sys.path
setup_import_path()

Supports multiple search strategies: .root marker files, VCS (git/svn/hg), marker files (pyproject.toml, setup.py, etc.), and directory structure heuristics.

Place a .root file in any directory to explicitly mark it as a project root.

File I/O

from flashboot_core.io.file import File

f = File("/path/to/config.yaml")
content = f.read_text()

Architecture

flashboot_core/
├── beans/          # Component registration & lifecycle
├── context/        # Application context & component scanning
├── env/            # Environment profiles & property binding
├── event_bus/      # Sync & async event pub/sub
├── aop/            # Aspect-oriented programming
├── resilience/     # Circuit breaker, retry, rate limiter, timeout
├── scheduling/     # Scheduled task execution
├── serialization/  # JSON/YAML serialization
├── data/           # Caching, transactions, repository pattern
├── io/             # File & resource abstractions
├── concurrent/     # Concurrency utilities
├── utils/          # Project root detection & helpers
├── logging/        # Logging configuration
├── testing/        # Test utilities
└── exceptions/     # Exception hierarchy

Roadmap

  • Async Event Bus
  • AOP decorators
  • Resilience patterns (retry, circuit breaker, rate limiter, timeout)
  • Scheduled tasks
  • Data access layer (repository pattern, transactions, caching)
  • Serialization framework

License

MIT

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

flashboot_core-0.1.28.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flashboot_core-0.1.28-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file flashboot_core-0.1.28.tar.gz.

File metadata

  • Download URL: flashboot_core-0.1.28.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for flashboot_core-0.1.28.tar.gz
Algorithm Hash digest
SHA256 abea69d1eaa262e455ae0e4c2be39ce844109022f0621feed86833a8972e9187
MD5 d2fb0541b268824bb5b237733a21323f
BLAKE2b-256 5c148b0d9a9dd3581f1c227f1ef3249d23711aff2426821d259ab76c94fb5cad

See more details on using hashes here.

File details

Details for the file flashboot_core-0.1.28-py3-none-any.whl.

File metadata

  • Download URL: flashboot_core-0.1.28-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for flashboot_core-0.1.28-py3-none-any.whl
Algorithm Hash digest
SHA256 2919c86a0e1bbf2c85406da838b3f06f0ac2461559ca61691babd4e7efc710c3
MD5 e4c5966fcaae8c5e10a51da2a1d8536d
BLAKE2b-256 a4114dc69f2fc35aa056b474209a5fe50e72fcef5a1e5efed15dcd496f814344

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page