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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

compone-0.5.0-cp310-abi3-manylinux_2_34_x86_64.whl (417.5 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

File details

Details for the file compone-0.5.0-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: compone-0.5.0-cp310-abi3-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 417.5 kB
  • Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
  • Uploaded using 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}

File hashes

Hashes for compone-0.5.0-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f482ce06f2e57635ccc13ccca5a0c27f2f3279236e68725428af4ef3760f115b
MD5 6f704caf78d8d8856c8470c06c22b9a7
BLAKE2b-256 e9b1fdcce4675a67e7a9c8835aa7e34c4311343c0e494817581662989479924d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

1 file

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

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