citry-django-compressor
Routes Citry components' CSS and JS through django-compressor, so they are preprocessed, minified and served as compressed files.
Which package do I want?
It depends on who owns the page.
Citry owns the page. A view renders one component tree and Citry holds the whole page's deduplicated asset list, placing it through <c-css /> and <c-js />. This package takes that list and hands it to django-compressor. Use this package.
Django owns the page. Your <head> lives in a Django template and Citry renders <c-*> regions inside it, each collecting its own assets. citry-django's page is what brings those together, and this package bundles what it collected into one file per response. Say where with <c-css /> and <c-js /> in your base template. Use this package.
Setup
pip install citry-django-compressor
# myproject/citry_app.py
from citry import Citry
from citry_django import CitryDjangoExtension
from citry_django_compressor import CitryCompressorExtension
app = Citry(extensions=[CitryDjangoExtension(), CitryCompressorExtension()])
Components keep declaring assets the way Citry documents. Nothing else is added to a component.
What it does
At serialize time the extension takes the render's final, deduplicated asset lists, feeds them to django-compressor as one CSS group and one JS group, and replaces them with the compressed results. Citry's own runtime scripts are left alone: they are not yours to bundle.
Results come from django-compressor's cache where that is allowed, keyed the way the {% compress %} tag keys it, on a digest of the content plus the mtimes of its sources. Without that every render recompiles its SCSS from scratch.
Citry's dependency strategy
This package rewrites what Citry resolves, so CITRY_DEPS_STRATEGY, citry-django's setting for what gets serialized, decides what it can reach. Leave it at its default: on "ignore" Citry resolves nothing, there is nothing to compress, and a page loads without its component styles.
Settings
Everything is django-compressor's own configuration. There is no separate setting for whether to compress: COMPRESS_ENABLED decides, exactly as it does for the template tag.
# settings.py
COMPRESS_ENABLED = True
COMPRESS_PRECOMPILERS = (("text/x-scss", "django_libsass.SassCompiler"),)
STATICFILES_FINDERS = [..., "compressor.finders.CompressorFinder"]
A compressor class named in COMPRESSORS is used here too, the same one a {% compress %} block uses, so a project that names its output files its own way gets that for component assets as well.
There is no setting here at all. What compiles an asset is the asset's own type, written the way you would write it in a template:
class Dependencies:
css = [Style(url=static("theme.scss"), attrs={"type": "text/x-scss"})]
django-compressor picks its precompiler on that attribute and nothing else, so a .scss that declares no type arrives as source and leaves as source, exactly as a <link href="x.scss"> without one would inside a {% compress %} block. The mimetype is an arbitrary string that has to match your COMPRESS_PRECOMPILERS entry exactly.
Options
| Option | Default | What it does |
|---|---|---|
force |
None |
A callable answering whether this render must bypass the cache. |
force exists for output that depends on something the cache key cannot see. Wagtail's preview of unsaved theme settings is the case it was written for: the compiled CSS differs, the content and mtimes do not, so a cached entry would show the wrong thing.
CitryCompressorExtension(force=lambda: getattr(get_current_request(), "is_preview", False))
Limitations
Bundling a whole response needs somewhere to put the result, so a base template that writes no <c-css /> or <c-js /> gets one compressed file per <c-*> region instead: the assets stay where Citry put them, and putting a bundle somewhere you did not ask for it would be worse than not making one. Repeats are still dropped first, so a stylesheet two regions both asked for is compiled once either way.
License
MIT
Metadata
Release files for citry-django-compressor 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| citry_django_compressor-0.3.3.tar.gz | 9.5 kB | With provenance | Details for citry_django_compressor-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| citry_django_compressor-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for citry_django_compressor-0.3.3-py3-none-any.whl |
Total release size: 20.2 kB
Release files / citry_django_compressor-0.3.3.tar.gz
| Download URL | citry_django_compressor-0.3.3.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bba3f070bba3e7c7044855e2eb1fbc5fa1de27bc2de42f3409a9905ccaf1b98
|
|
BLAKE2b-256 checksum How to use checksums |
53595c57a99d6e1a9235475bdb1ab1360909a8741709fb724529c6a8b5e7acd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / citry_django_compressor-0.3.3-py3-none-any.whl
| Download URL | citry_django_compressor-0.3.3-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94d9a6463ef6b08d4c7d171366a15c6d782d085be72e8108ebe2c29f1def87f9
|
|
BLAKE2b-256 checksum How to use checksums |
1c2139dab23ff64a1127ab4adf603bc2a3d97292770e88b8fb101eb62ee2abca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for citry-django-compressor 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for citry_django_compressor-0.3.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.