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  (only needed in Pydroid)
import nativelayout as nl

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

nl.run(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.

One import is enough: import nativelayout as nl gives the verbs of the core (nl.state, nl.view, nl.click, nl.go, ...) and nl.run(screen), which opens the window and reads the .nl files from the folder of your script (pass folder to change it). from nativelayout import state, view, ... also works. The Kivy host is loaded only when you use one of its names (run, run_app, file_loader, NativeView), so the core works without Kivy. The sub-packages nativelayout.core and nativelayout.host can still be imported directly.

In Pydroid, the file you open must contain import kivy itself; otherwise Pydroid does not start the Kivy window.

Guide

The verbs, several screens, dialogs, storage, images and the status of the host are in the Python guide.

License

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

Metadata

Release files for nativelayout 1.2.4

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.4
File Size Uploaded Provenance
nativelayout-1.2.4.tar.gz 66.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 138.3 kB

Release files / nativelayout-1.2.4.tar.gz

Download URL nativelayout-1.2.4.tar.gz
Size 66.7 kB
Tags Source
SHA-256 checksum
How to use checksums
41847db901106245c19521d38653b64009e4f896b6c59e4394495c339beabd64
BLAKE2b-256 checksum
How to use checksums
0ea612260fbc34ea9fc7f48bfc1bc2c1792d99b652062138f0c3b1d09c3ab84e
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.4-py3-none-any.whl

Download URL nativelayout-1.2.4-py3-none-any.whl
Size 71.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fa0f3e302008f8d26658af27b290ca42682a4ba35d02b06db126fd7c42f6aff
BLAKE2b-256 checksum
How to use checksums
00eeb8bf69caffda819ab13466e483f0637992d4fa02bf7b7ffcbde0bef404be
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.4

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.4.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