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()

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.

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.2.tar.gz (10.8 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.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: astris-0.1.2.tar.gz
  • Upload date:
  • Size: 10.8 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.2.tar.gz
Algorithm Hash digest
SHA256 ecb3853c4a786c4f37bca3ca69d2d9e3428523b5d631ce08cd2668c2c5d01c07
MD5 dfc95a1589d9e3d5751ad10423ebbf30
BLAKE2b-256 5148865ce14be3ca3e568aa1051845517aeb090c7be2873ed5e58874ac4a7e7a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: astris-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 272d5543f3cd9ae6c60fbb3b2b8fa54ea9b5c7c799354df017962b319a42ef53
MD5 c3b9dfadbdd7677d0519e11327579ea5
BLAKE2b-256 704d7006a9c4026142a3f1e0a289f968da6fffca44e25e301b8f73d486a7220d

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