Skip to main content

nativelayout

Describe a screen in HTML-like text and get a native interface.

nativelayout is a declarative language for user interfaces.

You write a screen once, in a plain text file (.nl) that looks like HTML, and each programming language shows it with its own host. There is no WebView.

A .nl file has:

  • HTML tags you already know (div, p, button, input, img, ...);
  • {values} that your code fills in;
  • if and for lines, for conditions and repetition;
  • a <style> with simple CSS selectors.

The file only describes the screen. The logic (state and taps) stays in your own code, in a screen function.

nativelayout is a specification with implementations: Kotlin for Android, Python (this package) and JavaScript (used by the online editor). The same .nl file works unchanged in all of them.

This package is the Python implementation: a pure Python core (parser, expander, layout engine and differ) and a Kivy host that draws the screen.

Install

pip install nativelayout            # core only, pure Python, no dependencies
pip install "nativelayout[kivy]"    # core + Kivy host

Python 3.10 or newer. The host needs Kivy 2.x. On Android, package the app with buildozer (requirements = python3,kivy,nativelayout).

Example

screen.nl:

<nativelayout>
<style>
body { padding: 16px; gap: 12px; }
.mais { background-color: #2F81F7; color: white; border-radius: 20px; }
</style>
<body>
<h1>Hello, {name}</h1>
<p>Total: {n}</p>
<button class="mais">+ add</button>
</body>
</nativelayout>

main.py:

import kivy  # noqa: F401
from nativelayout.core import state, view, click
from nativelayout.host import run_app, file_loader

def screen():
    s = state({"n": 0, "name": "world"})
    if click(".mais"):
        s["n"] += 1
    return view("screen.nl", s)

run_app(file_loader("."), app=screen)

The file describes the screen. The logic (state and taps) stays in your Python code, in a screen function.

What is in the package

  • nativelayout.core: parser, expander, layout engine, differ and the program side (state, view, click, go, value, save, ...). Pure Python.
  • nativelayout.host: the Kivy host. It draws on a canvas; it does not build platform-native views.

nativelayout is a namespace package, so import from the two sub-packages: from nativelayout.core import state, view, click and from nativelayout.host import run_app, file_loader. The Kivy host is loaded only when you import nativelayout.host.

License

Mozilla Public License 2.0. Copyright (c) 2026 Adilson C. Rafael.

Metadata

Release files for nativelayout 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nativelayout 1.2.2
File Size Uploaded Provenance
nativelayout-1.2.2.tar.gz 64.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nativelayout 1.2.2
File Interpreter ABI Platform
nativelayout-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 133.7 kB

Release files / nativelayout-1.2.2.tar.gz

Download URL nativelayout-1.2.2.tar.gz
Size 64.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d29c72a11ea798b0b826c39769241682626b350aaf8fed77969f4b234056df7c
BLAKE2b-256 checksum
How to use checksums
7c47ca7d658ce245842b4398cf157fb0d0367877bb45e86e4c213ad3b2c0788a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Release files / nativelayout-1.2.2-py3-none-any.whl

Download URL nativelayout-1.2.2-py3-none-any.whl
Size 69.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38de9db54c488609bba7db3e7b4100f95fb5478e134d1c897ab2c67ff333d97e
BLAKE2b-256 checksum
How to use checksums
026e5e6eeafdfeb461b4cf10b54d6da73f44bcf64602790844c2cc04c8024367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 24, 2026.

Transparency log

Security for nativelayout 1.2.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nativelayout-1.2.2.tar.gz

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 Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page