Skip to main content

Renderer-agnostic UI core (IR, reconciler, state, style, widgets) shared by tempestroid and tempestweb.

Project description

tempest-core

📚 Documentation: Português (Brasil) · English (US) — bilingual, on GitHub Pages.

Renderer-agnostic UI core shared across the tempest stack — the engine behind both tempestroid (native renderers: Qt / Compose / Android) and tempestweb (DOM, WASM + server modes).

It is the one tree, many renderers core: the IR, the reconciler (build / diff), the state model (App), the typed style model (Style, Color, Edge), the widget and component trees, plus the cross-cutting helpers (animation, i18n, navigation, theme, validators). It carries no platform-coupled code — no Qt, no JNI, no Android, no DOM — so it imports cleanly under CPython, Pyodide and a headless server. Renderers live in the consumers; this package only produces and diffs the tree.

from tempest_core import App, Column, Text, Button, Style, build, diff

old = build(Column(children=[Text(content="Count: 0", key="label")]))
new = build(Column(children=[Text(content="Count: 1", key="label")]))
patches = diff(old, new)          # -> [Update(set_props={"content": "Count: 1"})]

Design system (Chakra-style variants → Material 3)

Components take Chakra-ergonomics props (variant/size/color_scheme) and a theme, and resolve a concrete Material 3 Style via pure resolvers in variants.pyresolve_variant (buttons), resolve_field_variant (text inputs / select / masked / autocomplete / pin), resolve_selection_variant (checkbox / switch), resolve_slider_variant (sliders), resolve_surface_variant (cards / surfaces — H3), resolve_badge_variant (badges / tags / chips — H4) and resolve_alert_variant (alerts / banners — H4). The interactive resolvers each ship a *_states sibling returning the per-state table (default/hover/pressed/ disabled/focus) the renderers apply on real events; surfaces and alerts are non-interactive, so there is no state table. The touch target is held ≥ 48dp and WCAG-AA contrast is preserved. An explicit style= is always merged on top.

from tempest_core import Alert, Badge, CardVariant, IconButton, Stat, Theme
from tempest_core.components import Card, HStack, Surface, VStack
from tempest_core.widgets import Input, Spacer, Text
from tempest_core.style import AlertVariant, BadgeVariant, FieldVariant

field = Input(value="", field_variant=FieldVariant.FILLED, color_scheme="primary")
button = IconButton(icon="settings", color_scheme="primary", label="Open settings")

# H3 styled surface & layout kit: cards/surfaces (elevated/filled/outlined) +
# SwiftUI-style stacks with token-step gaps + a flex Spacer.
card = Card(variant=CardVariant.OUTLINED, color_scheme="primary", children=[
    HStack(gap="md", children=[Text(content="Title"), Spacer(), Text(content="42")]),
])

# H4 styled data-display & feedback kit: status families (success/warning/info) +
# badge/tag/chip + alert/banner + stat.
ok = Badge(label="LIVE", variant=BadgeVariant.SUBTLE, color_scheme="success")
note = Alert(title="Saved", body="Your changes are live.",
             variant=AlertVariant.LEFT_ACCENT, color_scheme="success")
metric = Stat(label="Active users", value="1.2k", delta="+12%", delta_up=True)

The H3 surface kit (CardVariant, resolve_surface_variant, Surface, StyledContainer, HStack/VStack, Spacer) realizes Material 3 elevation as a Shadow mapped from the M3 level (elevation=0..5) — no new Style field. Card/Divider/ListTile/Accordion/Grid are themed off the tokens, and the old call sites stay backward-compatible.

The H4 data-display & feedback kit adds three Material 3 status color families — success / warning / info (new ColorRole members + ColorScheme fields, generated from fixed semantic seeds, fully back-compatible) — and two new variant resolvers/enums (BadgeVariant/resolve_badge_variant, AlertVariant/resolve_alert_variant). New components Alert, Stat, ProgressStepper and the Tag (a static Chip preset) join the re-themed Badge/Banner/Avatar/EmptyState/SegmentedControl/Rating/Chip. Because a saturated status role on white can fail WCAG-AA (e.g. success solid = 3.02), the subtle status surfaces use the tonal *_container / on_*_container pairing (AA- safe). Still no new Style field — status flows through color_scheme.

Install

pip install tempest-core

Requires Python >=3.11. Only hard dependency: pydantic>=2.

Status

Extracted from tempestroid's vendored core. tempestweb consumes it directly (no vendored copy). tempestroid's own migration to depend on this package — with its full Qt↔Compose conformance suite green — is the next phase.

Develop

uv sync --extra dev
ruff check . && ruff format --check .
mypy tempest_core
pytest -q

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

tempest_core-0.6.0.tar.gz (238.6 kB view details)

Uploaded Source

Built Distribution

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

tempest_core-0.6.0-py3-none-any.whl (174.0 kB view details)

Uploaded Python 3

File details

Details for the file tempest_core-0.6.0.tar.gz.

File metadata

  • Download URL: tempest_core-0.6.0.tar.gz
  • Upload date:
  • Size: 238.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tempest_core-0.6.0.tar.gz
Algorithm Hash digest
SHA256 58751c54a985136703a003e4f84f783b6849035877d6e6732887d806574fba4f
MD5 cfbefe9236e8e9d0b9c66636a52e95db
BLAKE2b-256 89853e9095ed685cdea17fb240e875af9f7d3d1cb238228d6ef65624603750ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for tempest_core-0.6.0.tar.gz:

Publisher: publish.yml on mauriciobenjamin700/tempest-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tempest_core-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: tempest_core-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 174.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tempest_core-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecc36656387c1720a01ea15ef493e37003cadac87edc9c619f9f7801a19dc9ed
MD5 fc3db9c5876461f86f5bd976f9f70912
BLAKE2b-256 2cfe89dbeb7932df82f64794ddf4ee6d7f17fba9be7c6981ab5c0c844782ef43

See more details on using hashes here.

Provenance

The following attestation bundles were made for tempest_core-0.6.0-py3-none-any.whl:

Publisher: publish.yml on mauriciobenjamin700/tempest-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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