Lightweight reusable template components for Django. An exploratory fork of django-components.
Project description
django-components-lite
An exploratory, lightweight fork of django-components.
This package strips django-components down to its core: simple, reusable template components for Django, just templates with some optional python logic. The goal is to see how a minimal django-components feels in practice.
Attribution
This project is built on the excellent work of the django-components project by Emil Stenström, Juro Oravec, and all contributors. Their years of work made this possible.
If you're looking for a mature, full-featured, and battle-tested component library for Django, use django-components. It has an active community, extensive documentation, and a rich feature set.
Features
What django-components-lite keeps from django-components:
- Component classes with Python logic and Django templates
{% comp %}/{% endcomp %}template tags- Slots and fills (
{% slot %},{% fill %}) - Component autodiscovery
- Component registry
- Static file handling (JS/CSS)
- Isolated component context
- HTML attribute rendering utilities
What's removed?
Compared to django-components, the following have been stripped out:
- Extension system
- Built-in components (DynamicComponent, ErrorFallback)
- Component caching
- Provide/Inject system
- Template expressions
- Management commands
- JS/CSS data methods and dependency management
- Type validation (Args/Kwargs/Slots/TemplateData)
on_render()generator system and deferred renderingcontext_behaviorsetting (always isolated, like Django'sinclusion_tag)- Tag formatters
- Component views and URLs
librariessetting andimport_libraries()reload_on_file_changesetting- All deprecated setting aliases
Installation
pip install django-components-lite
Add to your Django settings:
INSTALLED_APPS = [
# ...
"django_components_lite",
]
Quick example
# myapp/components/greeting/greeting.py
from django_components_lite import Component, register
@register("greeting")
class Greeting(Component):
template_file = "greeting.html"
def get_context_data(self, name):
return {"name": name}
<!-- myapp/components/greeting/greeting.html -->
<div class="greeting">
Hello, {{ name }}!
{% slot "extra" %}{% endslot %}
</div>
<!-- In any template -->
{% load component_tags %}
{% comp "greeting" name="World" %}
{% fill "extra" %}
<p>Welcome!</p>
{% endfill %}
{% endcomp %}
Links
- django-components (original) - the full-featured upstream project
- Documentation
- Issues
License
MIT - see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_components_lite-0.4.1.tar.gz.
File metadata
- Download URL: django_components_lite-0.4.1.tar.gz
- Upload date:
- Size: 71.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2d744f7653f65ec3f5e28732976331724ada0a6fd2b530b0216e1498062ecac
|
|
| MD5 |
dcce77b66c9794708885244956b23394
|
|
| BLAKE2b-256 |
1d479dca88d90c437a2a2daeb0b8d0464d1662cb27e164d1f5c642b5e1d1aa5c
|
Provenance
The following attestation bundles were made for django_components_lite-0.4.1.tar.gz:
Publisher:
publish.yml on oliverhaas/django-components-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_components_lite-0.4.1.tar.gz -
Subject digest:
a2d744f7653f65ec3f5e28732976331724ada0a6fd2b530b0216e1498062ecac - Sigstore transparency entry: 1357010250
- Sigstore integration time:
-
Permalink:
oliverhaas/django-components-lite@b0dd0072e4a4683dd9e0b817a0a2a192620d69f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/oliverhaas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b0dd0072e4a4683dd9e0b817a0a2a192620d69f8 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file django_components_lite-0.4.1-py3-none-any.whl.
File metadata
- Download URL: django_components_lite-0.4.1-py3-none-any.whl
- Upload date:
- Size: 83.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31bd81adce268526ef914e120aa927e2890f99cada7d706b4d405c186f657a80
|
|
| MD5 |
93ea5c943f7751e4cdc370a225943123
|
|
| BLAKE2b-256 |
a6b0853db794900e4aa9f675d939200da69d1df8c24501885258f817aee91a0f
|
Provenance
The following attestation bundles were made for django_components_lite-0.4.1-py3-none-any.whl:
Publisher:
publish.yml on oliverhaas/django-components-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_components_lite-0.4.1-py3-none-any.whl -
Subject digest:
31bd81adce268526ef914e120aa927e2890f99cada7d706b4d405c186f657a80 - Sigstore transparency entry: 1357010258
- Sigstore integration time:
-
Permalink:
oliverhaas/django-components-lite@b0dd0072e4a4683dd9e0b817a0a2a192620d69f8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/oliverhaas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b0dd0072e4a4683dd9e0b817a0a2a192620d69f8 -
Trigger Event:
workflow_dispatch
-
Statement type: