Skip to main content

nativelayout (Python)

Python port of the nativelayout core. It follows the Kotlin core feature for feature (currently v1.2.0: <include>, identity inside for, <footer> and dock, position: absolute, background-image, object-fit).

  • core/ pure Python, no Kivy: parser, expander, layout engine, differ, program side
  • android/ Kivy host for Android (nativelayout/host)
  • desktop/ Kivy host for the desktop (nativelayout/host)
  • examples/ examples (contador/)

The Kivy hosts draw on a canvas; they do not build platform-native views.

Install

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

Requires Python 3.10 or newer. On Android, package with buildozer (requirements = python3,kivy,nativelayout).

nativelayout is a namespace package (no __init__.py at its root): the core is nativelayout.core and the Kivy host is nativelayout.host. The package published on PyPI carries the Android host (android/), which includes the stencil mask that rounds background-image corners. To work from the repository instead, put core and the folder of the host on sys.path.

Usage

import kivy  # noqa: F401  (Pydroid starts the Kivy window only if the opened file imports kivy)
from nativelayout.core.program import state, view, click
from nativelayout.host import run_app, file_loader

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

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

The host needs Kivy 2.x.

Tests

cd python/core
python -m unittest discover -s tests -t .

cd python/android
python -m unittest discover -s tests -t .

The core tests mirror the Kotlin ones (IncludeTest, FooterTest, AbsoluteTest). The host tests cover flex.py, which does not need Kivy.

Status of the host (v1.2.0)

Done: columns and rows, flex, gap, justify, align, wrap, header, footer and dock, dialogs, position: absolute (with z-index), background-image (background-size, background-position), object-fit, icons, gradients, shadows, rounded corners.

Not done yet:

  • virtual lists draw all items (no recycling)
  • animations: only the fade-in of the screen (slide-up and slide-left are missing)
  • letter-spacing and overflow: hidden (clipping) are not applied
  • the Android keyboard can cover fields (adjust softinput_mode)
  • the Kivy drawing of background-image and object-fit has not been tried on a device yet

Metadata

Release files for nativelayout 1.2.0

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.0
File Size Uploaded Provenance
nativelayout-1.2.0.tar.gz 64.2 kB With provenance Details

Built distribution (wheel)

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

Total release size: 133.4 kB

Release files / nativelayout-1.2.0.tar.gz

Download URL nativelayout-1.2.0.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d1230331f1f935db163ef1bbcbdc7b420fc1188e8206e2c6e43e1066a8a810a2
BLAKE2b-256 checksum
How to use checksums
47ecb5344b606452c18fae4b1cf044c9832edeec056e29c4d1b4b4eaaa359105
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 23, 2026.

Transparency log

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

Download URL nativelayout-1.2.0-py3-none-any.whl
Size 69.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24c2fcb4ea744d07f6a3f95e2ecf2b5d5d38cba4405265665c21c209d5917529
BLAKE2b-256 checksum
How to use checksums
245087288d2d88f7a55e37f002d0a762ab1a3f2e47c018f023d0d8184c572f59
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 23, 2026.

Transparency log

Security for nativelayout 1.2.0

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.0.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 23, 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