Skip to main content

Quick start

This tutorial walks through a complete obox-builder setup: scaffold a project, mount the admin, create the database and log in. It takes a few minutes.

Requirements

  • Python 3.11 or later
  • uv
  • Git

1. Install obox-builder

!!! note "Pre-release" obox-builder 0.1 is not published on PyPI yet, so install it from the repository. Once released, uv add obox-builder will be enough.

Clone the repository and install its dependencies:

git clone https://github.com/vinhgiga/obox-builder
cd obox-builder
uv sync --all-extras

2. Create a project

From the repository root, run the startproject command:

uv run obox startproject demo ../demo
cd ../demo

The command generates a Django-style project skeleton:

demo/
├── manage.py           # CLI entry point
├── pyproject.toml      # project metadata and dependencies
├── .env.example        # OBOX_-prefixed environment overrides
├── config/
│   ├── settings.py     # your Settings class
│   ├── urls.py         # ROOT_URLCONF (a list of routers)
│   └── asgi.py         # ASGI application
├── apps/               # your apps live here
├── migrations/         # Alembic migrations
├── static/
└── templates/

3. Point the project at obox-builder

Open pyproject.toml and uncomment the [tool.uv.sources] block at the bottom, so uv resolves obox-builder from your local checkout:

[tool.uv.sources]
obox-builder = { path = "../obox-builder", editable = true }

Then create the project environment:

uv sync

4. Mount the admin

config/urls.py ships with a routers list. Add the admin router to it:

from fastapi import APIRouter

from obox_builder.contrib.admin.site import site as admin_site

router = APIRouter()


@router.get("/")
def index() -> dict[str, str]:
    return {"message": "Hello from demo"}


routers = [router, (admin_site.get_router(), "/admin")]

config/settings.py already installs obox_builder.contrib.auth and obox_builder.contrib.admin, and points DATABASE_URL at a local SQLite file, so the admin works out of the box.

5. Create the database

uv run manage.py makemigrations
uv run manage.py migrate

makemigrations generates a migration for the built-in auth models (users, roles, permissions, sessions). migrate applies it and syncs the default permissions.

6. Create a superuser

uv run manage.py createsuperuser

You will be prompted for a username, an email address and a password.

7. Run the development server

uv run manage.py runserver --reload

Now open:

!!! tip "Configuration" Settings are pydantic-settings models: every field can be overridden with an OBOX_-prefixed environment variable or through a .env file (OBOX_DATABASE_URL, OBOX_SECRET_KEY, OBOX_DEBUG, ...). See .env.example in the scaffold. To use PostgreSQL, install the obox-builder[postgres] extra and set a postgresql+psycopg_async:// (or postgresql+asyncpg://) DATABASE_URL.

Next steps

Your first app. Scaffold an app, register it in INSTALLED_APPS and define models with the SQLAlchemy helpers:

uv run manage.py startapp blog apps/blog
# apps/blog/models.py
import sqlalchemy as sa
from obox_builder.db import Model, TimestampMixin
from sqlalchemy.orm import Mapped, mapped_column


class Post(Model, TimestampMixin):
    id: Mapped[int] = mapped_column(primary_key=True)
    title: Mapped[str] = mapped_column(sa.String(200))
    body: Mapped[str] = mapped_column(sa.Text, default="")

Add "apps.blog" to INSTALLED_APPS, then run makemigrations and migrate again. The app's CRUD permissions (blog.view_post, ...) are synced automatically after the migration.

Explore the CLI. uv run manage.py --help lists every command, including check, shell, showurls and collectstatic.

Write tests. The testing guide covers the pytest plugin, db/client/login fixtures and the user/role factories.

Metadata

Release files for obox-builder 0.3.0

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

Source distribution (sdist)

Source distribution for obox-builder 0.3.0
File Size Uploaded Provenance
obox_builder-0.3.0.tar.gz 1.8 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for obox-builder 0.3.0
File Interpreter ABI Platform
obox_builder-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.7 MB

Release files / obox_builder-0.3.0.tar.gz

Download URL obox_builder-0.3.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
6d7b60f71b8166cfd60b23db7866aa4a1dd371ca8c9d77378acc06e252dd641e
BLAKE2b-256 checksum
How to use checksums
24173a7a421cd96fcd2e58a0c0b3538495c67f7ffa4ee089ac244a9445978e48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Release files / obox_builder-0.3.0-py3-none-any.whl

Download URL obox_builder-0.3.0-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ffd8d59b5379d3e26e38f13964a18e44e70686910016d48b7187032dd65c48c1
BLAKE2b-256 checksum
How to use checksums
f29797f57de3a78990e4cd2338614a720f3dc15cf35489198cc2837ec86b0501
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}

Security for obox-builder 0.3.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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