Getting started
Install, write one file, build, open the result.
Install
ARKlight needs Python 3.10 or newer.
pip install arklight
arklight --versionThe first
arklightcommand asks you to accept the license terms once. In scripts and CI there is nobody to ask, so set
ARKLIGHT_ACCEPT_LICENSE=1in the environment. Read the
license summaryfirst.
Debian and Ubuntu
There is also an APT package that installs
arklightand registers its package source, so later updates are a plain
sudo apt update.
curl -fsSL https://arklight-ecosystem.github.io/ARKlight/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/arklight.gpg
sudo rm -f /etc/apt/sources.list.d/arklight.list
echo "deb [signed-by=/usr/share/keyrings/arklight.gpg] https://arklight-ecosystem.github.io/ARKlight/ stable main" | sudo tee /etc/apt/sources.list.d/arklight.list
sudo apt update
sudo apt install arklight-installerYour first site
Create
site.py. Three things are mandatory: the
# include <stdlib.ARKlight>line first, a
Site(), and one
@site.page(...)function per route that returns a
Page(...).
# include <stdlib.ARKlight>
site = Site()
@site.page("/")
def home():
return Page(
Heading("ARKlight"),
Text("Build websites with Python."),
Button("Get Started"),
)Build it
arklight build site.pyThat writes plain, dependency-free HTML into
ARK/. Pass
-oto choose another folder and
--no-opento stop it opening your browser.
Add some state
State belongs to the page. Put
State(...)inside
Page(...)as a child, show it with
Bind(...), and change it with an
Action.
return Page(
Heading("Counter"),
State("count", 0),
Text(Bind("count")),
Button("Increment", on_click=Action.increment("count", 1)),
)Where next
- The tutorial walks through pages, components, state and styling.
- The reference lists every component, action and CLI command.
- arklight search <Name> prints the compiler's own schema for any component or action.
