Skip to main content

Shared Django utilities for LightWave Media projects

Project description

lightwave-core

Shared Django utilities for LightWave Media projects.

Installation

# Local development (from workspace root)
uv pip install -e packages/lightwave-core

# With billing support (Stripe)
uv pip install -e "packages/lightwave-core[billing]"

# In a project's requirements.txt
-e file:../../packages/lightwave-core

Modules

Storage (lightwave.storage)

CDN and S3 storage backends for static files and media.

from lightwave.storage import StaticStorage, PublicMediaStorage, PrivateMediaStorage

# In settings.py
STORAGES = {
    "staticfiles": {"BACKEND": "lightwave.storage.StaticStorage"},
    "default": {"BACKEND": "lightwave.storage.PublicMediaStorage"},
}

# Configure static file prefix per project
LIGHTWAVE_STATIC_PREFIX = "static/my-project"

Utils (lightwave.utils)

Common utilities including BaseModel, timezone helpers, slug generation.

from lightwave.utils import BaseModel, get_common_timezones, get_next_unique_slug

class MyModel(BaseModel):
    # Automatically has created_at and updated_at fields
    name = models.CharField(max_length=100)

Auth (lightwave.auth)

Base user model and authentication helpers.

from lightwave.auth import BaseCustomUser, validate_profile_picture

class CustomUser(BaseCustomUser):
    # Inherits avatar, language, timezone, gravatar support
    # Add project-specific fields
    stripe_customer = models.ForeignKey(...)

Chat (lightwave.chat)

Base models for AI chat sessions.

from lightwave.chat import BaseChatSession, BaseChatMessage, ChatTypes, MessageTypes

class Chat(BaseChatSession):
    agent_type = models.CharField(...)

class ChatMessage(BaseChatMessage):
    chat = models.ForeignKey(Chat, on_delete=models.CASCADE, related_name="messages")

Islands (lightwave.islands)

Context processors and utilities for React island components.

# In settings.py TEMPLATES context_processors
"lightwave.islands.context_processors.lightwave_navigation",

# Processors are split into focused modules:
from lightwave.islands.processors import (
    get_brand_theme,      # Brand/theme utilities
    get_auth_state,       # User auth state
    get_cart_state,       # E-commerce cart
    get_team_state,       # Multi-tenant teams
    get_subscription_state,  # SaaS subscriptions
)

Context (lightwave.context)

Session context models for Claude Code integration.

from lightwave.context import SessionContext, build_session_context

# Build context for current working directory
context = build_session_context()

# Export to markdown for Claude consumption
markdown = context.to_markdown()

Schema (lightwave.schema)

Single Source of Truth (SST) for the LightWave ecosystem.

from lightwave.schema import get_field_values, LayoutSchema

# Get valid field values from YAML definitions
page_statuses = get_field_values("page_statuses")  # ['draft', 'published', 'archived']

# Load typed schemas
layouts = LayoutSchema.get_all_from_sst()

See lightwave/schema/CLAUDE.md for full SST documentation.

Development

Setup

  1. Install dependencies:

    uv pip install -e ".[dev]"
    
  2. Install pre-commit hooks:

    pre-commit install
    

    This ensures code is automatically formatted and checked before each commit.

Running Tests

uv run pytest

Optional Dependencies

  • billing: Stripe utilities via dj-stripe (uv pip install lightwave-core[billing])
  • dev: Testing utilities (uv pip install lightwave-core[dev])

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

lightwave_core-0.3.3.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

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

lightwave_core-0.3.3-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file lightwave_core-0.3.3.tar.gz.

File metadata

  • Download URL: lightwave_core-0.3.3.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lightwave_core-0.3.3.tar.gz
Algorithm Hash digest
SHA256 d21dd9e37255d75b39602a3e2b26c24a16fbf306e8afef7c09ce977f9f1a919a
MD5 79bd22364385692067ed1e37b30ca5ff
BLAKE2b-256 9682d6072e67be356a2dc0d427c4cc626ee5de5215278fccf0cd78255664e7bf

See more details on using hashes here.

File details

Details for the file lightwave_core-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: lightwave_core-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lightwave_core-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 648652615bb8b602b0bd03f52adc03ae93b2c734b2d7689e2275d7768f38b34a
MD5 838998d485e47d2593699aab6396eea2
BLAKE2b-256 fdcffc2e79f89f3b411eaa80d73bbbbc0b21ccce868df741eb1d431ce9ace083

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