based.
based is a Build System for Design.
Build scripts are written in Starlark:
palette = struct(primary=color.Oklch(0.5, 0.134, 242.749))
tokens = [Token("primary", light=palette.primary)]
target(
id="acme",
tokens=tokens,
artifacts=[Artifact("css", "dist/acme/css")]
)
Installation
pip install basedbuild
Usage
Create a build.based in your project root and run:
based build
WCAG Contrast Validation
based supports accessibility testing by letting you declare contrast
requirements using the wcag annotations.
load("wcag", "wcag")
surface = Token("surface", Color("#FFFFFF"))
primary = Token("primary", Color("#0284C7"))
text = Token(
"text",
Color("#1E293B"),
# Will raise a validation error if text fails to meet the AA contrast
# ratio against surface.
annotations=wcag.against(surface, role=wcag.Role.Text, level=wcag.Level.AA)
)
target(
id="acme",
tokens=[surface, primary, text],
artifacts=[Artifact("android", "acme/res")],
)
Extending based
Plugin interface is exposed via Python entry points. For a reference plugin
implementation, see the built-in wcag module.
# DSL extension
[project.entry-points."based.dsl"]
myplugin = "myplugin.dsl:myplugin_module"
# Type adapter
[project.entry-points."based.adapter"]
mynode = "myplugin.models:mynode_adapter"
# Compiler pass
[project.entry-points."based.pass"]
myplugin = "myplugin.passes:MyValidation"
# Platform backend
[project.entry-points."based.backend"]
myplatform = "myplugin.backend:MyPlatformBackend"
The following plugins are maintained alongside based and can be installed
directly:
basedbuild-tailwind: Tailwind CSS v4 color palette
Advanced Example
colors = [
Token(
"primary",
light=color.Oklch(0.5, 0.134, 242.749),
dark=color.Oklch(0.828, 0.111, 230.318),
),
Token(
"surface",
light=color.Oklch(0.97, 0, 0),
dark=color.Oklch(0.205, 0, 0),
),
]
space = [
Token("space.s", dimen.Spacing(0.5)),
Token("space.m", dimen.Spacing(1)),
Token("space.l", dimen.Spacing(2)),
Token("space.xl", dimen.Spacing(4)),
]
target(
id="acme",
tokens=colors + space,
artifacts=[
Artifact("android", "dist/acme/android"),
Artifact("apple", "dist/acme/apple"),
Artifact("compose", "dist/acme/compose", package="com.acme.android.design"),
Artifact("css", "dist/acme/css"),
],
)
:root {
--dimen-space-s: 0.5rem;
--dimen-space-m: 1rem;
--dimen-space-l: 2rem;
--dimen-space-xl: 4rem;
}
:root {
--color-primary: rgb(0 105 168);
--color-surface: rgb(245 245 245);
}
@media (prefers-color-scheme: dark) {
:root {
--color-primary: rgb(116 212 255);
--color-surface: rgb(23 23 23);
}
}
:root[data-theme="light"] {
--color-primary: rgb(0 105 168);
--color-surface: rgb(245 245 245);
}
:root[data-theme="dark"] {
--color-primary: rgb(116 212 255);
--color-surface: rgb(23 23 23);
}
@supports (color: oklch(0% 0 0)) {
:root {
--color-primary: oklch(0.5 0.134 242.749);
--color-surface: oklch(0.97 0 none);
}
@media (prefers-color-scheme: dark) {
:root {
--color-primary: oklch(0.828 0.111 230.318);
--color-surface: oklch(0.205 0 none);
}
}
:root[data-theme="light"] {
--color-primary: oklch(0.5 0.134 242.749);
--color-surface: oklch(0.97 0 none);
}
:root[data-theme="dark"] {
--color-primary: oklch(0.828 0.111 230.318);
--color-surface: oklch(0.205 0 none);
}
}
Metadata
Release files for basedbuild 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| basedbuild-0.3.0.tar.gz | 31.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| basedbuild-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.8 kB
Release files / basedbuild-0.3.0.tar.gz
| Download URL | basedbuild-0.3.0.tar.gz |
|---|---|
| Size | 31.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3aea96d73683ef854048a9e982986afdc835a7ae4f0827f8f751552029673661
|
|
BLAKE2b-256 checksum How to use checksums |
836f22c06132a2a170299ef5b14d011d26c356a731fb1e558ce49344c15520d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / basedbuild-0.3.0-py3-none-any.whl
| Download URL | basedbuild-0.3.0-py3-none-any.whl |
|---|---|
| Size | 47.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
057d90a6aed4fc7a1e1d6905db14d037a676d17e35001ff3568ab6413e1e25a3
|
|
BLAKE2b-256 checksum How to use checksums |
6c727b8e341fac7bc66b6a37854562161c315493b81944db9e579df8e5a8a545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency log