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

Metadata

Release files for jx 0.16.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 jx 0.16.0
File Size Uploaded
jx-0.16.0.tar.gz 72.2 kB Details

Built distribution (wheel)

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

Total release size: 115.8 kB

Release files / jx-0.16.0.tar.gz

Download URL jx-0.16.0.tar.gz
Size 72.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7dcf987e9af2e6db6f88b82113f5a89857b2e6195fdd474e2ee6d1cb3481f3d7
BLAKE2b-256 checksum
How to use checksums
4f8aa2e8b691ee0642d2ad6686ee791eb04b83efe62cf58e3c0722872af3becb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}

Release files / jx-0.16.0-py3-none-any.whl

Download URL jx-0.16.0-py3-none-any.whl
Size 43.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfea3966602878fd4af68a336b09d2b85b64f5b1183312ca35630679b77be059
BLAKE2b-256 checksum
How to use checksums
ea2fb7124df2db1b07c8e67a46d4832fd11744f25d4c7c17a97160eeec81e094
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 release files

0.15.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release 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