Skip to main content

Minimal Python framework for building static websites with component-style APIs.

Project description

Astris

Tests

Astris is a minimal Python framework for building static websites using component-style APIs.

Documentation

  • User documentation (for building websites): docs/user
  • Internal framework-maintainer documentation: docs/internal

Installation

pip install astris

Quick start with CLI

Create a new project scaffold:

uvx astris new my-project
cd my-project
uv run python main.py

Build static files:

uv run astris build

Basic usage

from astris import AstrisApp
from astris.lib import Body, H1, Html

app = AstrisApp()


@app.page("/")
def home():
	return Html(children=[
		Body(children=[
			H1(children=["Hello from Astris"]),
		])
	])


if __name__ == "__main__":
	app.run_dev()

HTML tags API

astris.lib now provides wrappers for the modern standard HTML tag set (A to Z). Each wrapper class includes an English docstring describing the underlying HTML element.

Void elements (for example Img, Br, Input, Meta) render without closing tags.

Layout helpers (Container, Column, Row) live in astris.layout.

from astris.layout import Container, Column, Row

JSON content collections (read-only)

You can register a folder of .json files as a read-only collection and generate detail pages from a Python template.

from astris import AstrisApp, Text, register_json_collection
from astris.lib import Body, Div, Html

app = AstrisApp()


def post_template(entry: dict):
	return Html(children=[
		Body(children=[
			Div(children=[Text(entry["title"])]),
		])
	])


posts = register_json_collection(
	app,
	name="posts",
	directory="content/posts",
	template=post_template,
	api_prefix="/api/content",
)

print(posts.page_links())

Generated output:

  • Static detail pages: /posts/<slug> (built as dist/posts/<slug>.html)
  • Dev JSON API (read-only):
    • GET /api/content/posts
    • GET /api/content/posts/<slug>

Head assets (CDN)

You can register external CSS and JavaScript files that Astris injects into the page <head>. This works in both run_dev() and build() outputs.

from astris import AstrisApp

app = AstrisApp()

app.add_head_link(
	"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
)
app.add_head_script(
	"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
)

Development

uv sync --group dev
uv pip install -e .
uv run --group dev pytest

Documentation (local)

Build user documentation in strict mode:

make docs

Serve user documentation with live reload:

make docs-serve

Continuous Integration

GitHub Actions runs tests on push and pull request events targeting main using Python 3.11, 3.12, and 3.13. The workflow is defined in .github/workflows/tests.yml.

Release checklist

make release-check

Equivalent manual commands:

uv sync --group dev
uv run --group dev pytest
uv run --group dev python -m build
uv run --group dev twine check dist/*.whl dist/*.tar.gz

example.py in this repository is an internal framework demo and not the standard end-user workflow.

Agent skill: release-prep-astris

This repository includes a workspace skill at .agent/skills/release-prep-astris.

Use this skill when preparing a new Astris version and you want a repeatable release-prep workflow that covers:

  • Version alignment across project metadata.
  • Changelog and internal release notes updates.
  • Local validation checks (pytest, pyright, release-check).

By default, this skill prepares the repository for release but does not publish artifacts to TestPyPI or PyPI unless explicitly requested.

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

astris-0.1.3.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

astris-0.1.3-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file astris-0.1.3.tar.gz.

File metadata

  • Download URL: astris-0.1.3.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for astris-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ea7263a4335ad6ee37b6a2307913540a8920937cee72b332e7c364a6e982710e
MD5 a1a1e4038f89ceedfd265d882c1aff3a
BLAKE2b-256 8045a163f401c1f2f9868db2aef4495727d11fa51ccf197d2c596a86bc6a0288

See more details on using hashes here.

File details

Details for the file astris-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: astris-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for astris-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4d9c52c8c04a55bef6d41093085c2423a55796d4e4e10ca6a8bc525c2570bd3b
MD5 4f2bfa3906e8848af92c02ab27411cb9
BLAKE2b-256 f32060939b78a308649a34c3be0a1a1d2e9dccfe8354bd18a64a4fc9a83347d0

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