Skip to main content

Compone for Python

Compone is a Python component framework which makes it possible to generate HTML, XML, RSS and other markup formats using type-safe Python objects with a very simple API.

compone.Components are fully-reusable Python classes in ANY Python web framework or project out-of-the-box without extra code needed.

It's a modern alternative to template engines like Jinja2 or Django templates for generating strings.

Hello World

from compone import Component, html

@Component
def Hello(name: str, children):
    return html.Div[
        html.H1[f"Hello {name}!"],
        children,
    ]

print(Hello("World")["My Child"])
# <div><h1>Hello World!</h1>My Child</div>

This is a silly example, but for more examples and features, check out the Tutorial in the Documentation.

Installation

You can simply install the compone package from PyPI:

$ pip install compone

The only dependency is markupsafe for escaping HTML.

Documentation

The documentation is available at https://compone.kissgyorgy.me.

Metadata

Release files for compone 0.5.0

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

Built distribution (wheel)

Table of built distributions (wheels) for compone 0.5.0
File Interpreter ABI Platform
compone-0.5.0-cp310-abi3-manylinux_2_34_x86_64.whl CPython 3.10 abi3 Linux glibc 2.34+ x86-64 Details

Release files / compone-0.5.0-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL compone-0.5.0-cp310-abi3-manylinux_2_34_x86_64.whl
Size 417.5 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
f482ce06f2e57635ccc13ccca5a0c27f2f3279236e68725428af4ef3760f115b
BLAKE2b-256 checksum
How to use checksums
e9b1fdcce4675a67e7a9c8835aa7e34c4311343c0e494817581662989479924d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for compone 0.5.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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