Skip to main content

Jx

python: 3.12, 3.13, 3.14 license: MIT

Python server-side components

From chaos to clarity: The power of components in your server-side-rendered Python web app.

How It Works

Jx is a Python library for creating reusable template components with Jinja2. It works by pre-parsing the template source and replacing TitleCased HTML tags with Jinja calls that render the component.

Component Definition

Components are defined as regular Jinja2 templates (.jx files) with special metadata comments:

  • {# def parameter1 parameter2=default_value #} - Defines required and optional parameters
  • {# import "path/to/component.jx" as ComponentName #} - Imports other components
  • {# css "/path/to/style.css" #} - Includes CSS files
  • {# js "/path/to/script.js" #} - Includes JavaScript files

Example component:

{# def message #}
{# import "button.jx" as Button #}

<div class="greeting">{{ message }}</div>
<Button text="OK" />

Usage Example

from jx import Catalog

# Create a catalog and add a components folder
catalog = Catalog("templates/components")

# Render a component with parameters
html = catalog.render("card.jx", title="Hello", content="This is a card")

VisualStudio Code extension

If you are using VisualStudio Code, install the Jinja-Jx extension.

Jinja-Jx extension

This extension offers:

  • Syntax highlighting of Jx-specific constructs like import, def, css, js, etc. and PascalCase component tags (e.g., <MyComponent>)
  • Add go-to-definition from import paths and component tags to jump to the component file
  • Check for syntax errors and validate import paths on save

Download files

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

Source Distribution

jx-0.12.0.tar.gz (45.0 kB view details)

Uploaded Source

Built Distribution

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

jx-0.12.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file jx-0.12.0.tar.gz.

File metadata

  • Download URL: jx-0.12.0.tar.gz
  • Upload date:
  • Size: 45.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for jx-0.12.0.tar.gz
Algorithm Hash digest
SHA256 b34e24e02e2b17faa7cf6298e8dd9b1ea0da619f430b2fa9ebd6c959e7152fe8
MD5 13fcde5e23dfddd809c7f181a72948ec
BLAKE2b-256 f856ed3510cbde70975f8d0b55718e68edc58231f7d93c26dada212a4847d768

See more details on using hashes here.

File details

Details for the file jx-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: jx-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for jx-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 035b521f87df5424da7e7470d9a83da6637f79340418fc86066285661c8b3d1a
MD5 bd3e1ad86dd283fede30ed267f69caa8
BLAKE2b-256 22101ebfc95579fd91a1ca1a6df889758b2ef23a8490ac3f29f862875ad95a92

See more details on using hashes here.

Release history Release notifications | RSS feed

0.13.0

2 files

This release

0.12.0 This release

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page