Skip to main content

django-cotton-gallery

Tests Coverage PyPI Python License: MIT

Drop-in playground for your django-cotton components — annotate them once with @prop comments and get a live, themable, copy-and-paste gallery with auto-generated controls, a lint report, and an insights dashboard.

📚 Docs: https://velezanthony.github.io/django-cotton-gallery/

Gallery index

Install (≈60 seconds)

The gallery is a development-only tool, so the recommended install is as a dev dependency with uv — that way it never ships to production (uv sync --no-dev leaves it out):

uv add --dev django-cotton-gallery

Prefer pip? That works just as well:

pip install django-cotton-gallery
# settings.py
INSTALLED_APPS = [
    # ...
    "django_cotton",            # already there if cotton is set up
    "django_cotton_gallery",
]
# urls.py
from django.conf import settings
from django.urls import include, path

urlpatterns = [...]

# Gate it — the gallery exposes component source code. Do NOT ship to prod.
if settings.DEBUG:
    urlpatterns += [path("", include("django_cotton_gallery.urls"))]

Run your server and open http://localhost:8000/django-cotton-gallery/. That's it — the gallery indexes whatever cotton already finds. The empty state walks you through your first component if the catalog is empty.

Need production access patterns (staff-only, feature flags), asset injection, or per-setting reference? → Getting started · Configuration

What you get

Live playground — every component renders with auto-generated controls from your @prop annotations. Tweak any prop in real time, copy the tag, done.

Component detail with live controls

Lint report — three severity tiers (errors, warnings, hints) for @prop/<c-vars> mismatches, missing descriptions, and undeclared variables. The same engine runs in CI as python manage.py cotton_lint.

Lint report

Insights dashboard — config health, annotation coverage, zombie components, most-referenced ranking. Spot rot before it ships.

Insights dashboard

Ctrl+K switcher with structured filters (prop:size, slot:actions, accepts-attrs, has-named-slots, deprecated) — find any component without leaving the keyboard.

Command palette switcher

Plus: a refactor planner (transitive dependency tree), an annotation builder (form-based @prop editor), a side-by-side compare view, and i18n chrome (English, Spanish, Basque, French). → Full feature tour

Compatibility

Versions
Python 3.10 · 3.11 · 3.12 · 3.13
Django 4.2 LTS · 5.0 · 5.1 · 5.2 LTS · 6.0
i18n English (default) · Spanish · Basque · French

CI verifies every valid Python × Django combination on every push (plus Windows + macOS smoke tests).

Contributing & local development

Clone, then make dev && make serve to run the bundled demo at http://localhost:8000/django-cotton-gallery/. Everything else — repo layout, tests, the Python × Django matrix, i18n, releases — lives in docs/contributors/. See also CONTRIBUTING.md and the CHANGELOG.

Support

Sponsor

If this project saves you time, consider sponsoring its development. It helps keep it maintained.

License

MIT — see LICENSE.

Download files

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

Source Distribution

django_cotton_gallery-1.0.0.tar.gz (437.6 kB view details)

Uploaded Source

Built Distribution

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

django_cotton_gallery-1.0.0-py3-none-any.whl (492.4 kB view details)

Uploaded Python 3

Release history Release notifications | RSS feed

This release

1.0.0 This release

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