Skip to main content

VA7 Framework — Foundation layer for Django SaaS applications

Project description

VA7 Core

Foundation layer for Django SaaS applications.

Installation

pip install va7-core

Quick Start

# settings.py
INSTALLED_APPS = [
    ...
    "va7.core",
]

MIDDLEWARE = [
    "va7.core.middleware.SecurityHeadersMiddleware",
    "va7.core.middleware.HealthCheckMiddleware",
    # "va7.core.middleware.TrueClientIPMiddleware",  # Optional
]

REST_FRAMEWORK = {
    "EXCEPTION_HANDLER": "va7.core.exceptions.custom_exception_handler",
}

What's Included

  • BaseModel — UUID PKs, timestamps, soft-delete
  • Event Busemit(), listen() for cross-package decoupling
  • Exception Handler — Standardized DRF error responses
  • Middleware — Security headers, health check, client IP
  • Config — Django-style lazy settings with deep merge
  • Mixins — Change tracking, soft-delete admin

Project Structure

va7-core/
├── pyproject.toml
├── va7/
│   ├── core/
│   │   ├── __init__.py       # Public API (lazy imports)
│   │   ├── models.py         # BaseModel, SoftDeleteManager
│   │   ├── events.py         # Event bus (emit, listen, unlisten)
│   │   ├── exceptions.py     # custom_exception_handler
│   │   ├── middleware.py      # SecurityHeaders, HealthCheck, ClientIP
│   │   ├── mixins.py         # ChangeTrackingMixin, SoftDeleteAdminMixin
│   │   ├── utils.py          # is_truthy, get_env_variable, run_in_background
│   │   └── config.py         # LazySettings, VA7_DEFAULTS
│   └── conf/
│       ├── __init__.py       # settings = LazySettings()
│       └── global_settings.py # Documented defaults
└── tests/
    ├── test_config.py
    ├── test_events.py
    ├── test_exceptions.py
    ├── test_middleware.py
    ├── test_mixins.py
    └── test_models.py

Configuration

All configuration is optional with sensible defaults. Override in settings.py:

VA7 = {
    "PROJECT_NAME": "My SaaS",
    "IDENTITY": {
        "ROLES": {
            "ADMIN": {"label": "Admin", "is_admin": True},
            "MEMBER": {"label": "Member", "is_admin": False},
        },
    },
}

Access configuration:

from va7.conf import settings

# Attribute access
page_size = settings.API["PAGE_SIZE"]

# Dot notation
page_size = settings.get("API.PAGE_SIZE", 20)

Testing

pip install -e "packages/va7-core[dev]"
pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

va7_core-0.1.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file va7_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: va7_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for va7_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29f7c6569574a602da4f07120a79efa45b6449c9ed8f3b86a2574f8469116bfa
MD5 9846101f9aa98f81c305c4ddc3bda6b6
BLAKE2b-256 9b105b105c267dd2173b62bd688ff01dc1c73d499525c4e98a96a36f378a26b3

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