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.14.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.14.0
File Size Uploaded
jx-0.14.0.tar.gz 47.4 kB Details

Built distribution (wheel)

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

Total release size: 76.5 kB

Release files / jx-0.14.0.tar.gz

Download URL jx-0.14.0.tar.gz
Size 47.4 kB
Tags Source
SHA-256 checksum
How to use checksums
980b1dfbe4036ef52c36a6bebab84e2a19e1359e8128d8b0c00e2d0fcb37db2c
BLAKE2b-256 checksum
How to use checksums
670c14d1e53fbe742bc2096c8a9c54412362fd6700903f0bbcfd5365f8cc249c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.11 {"installer":{"name":"uv","version":"0.12.11","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.14.0-py3-none-any.whl

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

0.16.0

2 release files

0.15.0

2 release files

This release

0.14.0 This release

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