sasso
Python bindings for sasso — a fast,
pure-Rust SCSS/Sass → CSS compiler — over its libsasso C ABI.
sasso runs in-process (no Node, no subprocess, no system sass binary)
via a small ctypes layer over a prebuilt native library. Each wheel bundles
the compiled libsasso for its platform, so pip install sasso is all you
need.
pip install sasso
Usage
import sasso
css = sasso.compile(
"""
$brand: #336699;
.card {
color: $brand;
.title { font-weight: bold; }
}
"""
)
print(css)
# Compressed output, .sass (indented) syntax, filesystem load paths:
sasso.compile(src, style="compressed")
sasso.compile(indented_src, syntax="sass")
sasso.compile(src, load_paths=["styles", "vendor"])
Errors
A compile failure raises sasso.SassoError, carrying the diagnostic message
plus the 1-based source location:
try:
sasso.compile(".broken { color: ; }")
except sasso.SassoError as e:
print(e.message, e.line, e.column)
Custom importers
Resolve @use / @forward / @import yourself (from a database, a bundler's
virtual filesystem, HTTP, …) by subclassing sasso.Importer. It mirrors
dart-sass's two-phase model:
class DictImporter(sasso.Importer):
def __init__(self, files):
self.files = files
def canonicalize(self, url, *, from_import, containing_url):
# Map a (possibly relative) URL to a stable canonical key, or None.
return url if url in self.files else None
def load(self, canonical):
# Fetch the source for a canonical key, or None.
return sasso.LoadResult(contents=self.files[canonical], syntax="scss")
css = sasso.compile('@use "theme";', importer=DictImporter({"theme": "$c: red;"}))
An exception raised inside an importer aborts the compile and surfaces as a
SassoError with the original exception chained as __cause__.
API
| Symbol | Description |
|---|---|
compile(source, *, style="expanded", syntax="scss", load_paths=None, url=None, importer=None) -> str |
Compile a stylesheet string to CSS. |
SassoError |
Raised on failure; has .message: str, .line: int | None, .column: int | None. |
Importer |
ABC for custom resolution: canonicalize(url, *, from_import, containing_url) + load(canonical) -> LoadResult | None. |
LoadResult(contents, syntax="scss", source_map_url=None) |
Return value of Importer.load. |
compiler_version() -> str |
Version of the bundled native sasso compiler. |
__version__ |
Version of this Python package (independent of the compiler version). |
style is "expanded" or "compressed"; syntax is "scss", "sass", or
"css".
Performance
sasso compiles in-process, so it avoids the per-call process-spawn overhead of
shelling out to the sass CLI. Compiling a non-trivial stylesheet 200× on an
Apple-silicon Mac (benchmark.py, vs. spawning the dart-sass binary per
compile):
output parity (sasso vs dart-sass): IDENTICAL
sasso (in-process) : 0.0068 s total (0.034 ms/compile)
dart-sass (subprocess/ea) : 4.7381 s total (23.691 ms/compile)
speedup: sasso is 701.0x faster for 200 compiles in this workload
Most of that gap is process-startup cost that an in-process binding removes
entirely; the comparison reflects the realistic "shell out to sass" path a
Python app would otherwise take.
Versioning — which compiler is bundled?
The package version (sasso.__version__) floats independently of the
compiler version it bundles (sasso.compiler_version()):
| sasso (PyPI) | bundles core sasso crate |
|---|---|
| 0.1.0 | 0.6.0 |
Each release notes its bundled core version in the CHANGELOG.
How it works
The package is a ctypes binding — not a CPython C-extension — over the
libsasso C ABI. Because
it has no Python-ABI linkage, a single native library per (OS, arch) serves
every CPython 3.x (and PyPy), so each release ships one platform wheel per
target rather than one per Python version.
The native crate is vendored from momiji-rs/sasso ffi/ and builds against
the published sasso crate from crates.io.
License
MIT OR Apache-2.0, at your option. See LICENSE-MIT and LICENSE-APACHE.
Metadata
Release files for sasso 0.1.2
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 |
|---|---|---|---|---|
| sasso-0.1.2.tar.gz | 30.2 kB | With provenance | Details for sasso-0.1.2.tar.gz |
Built distributions (wheels)
Total release size: 7.8 MB
Release files / sasso-0.1.2.tar.gz
| Download URL | sasso-0.1.2.tar.gz |
|---|---|
| Size | 30.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4503974d230dabcd6d464a1b5df6b523d64229b3f606484c27683f27d0721eda
|
|
BLAKE2b-256 checksum How to use checksums |
437e60c9de36840525a2e9938744b70a0529b202e750008e9c121619545e0f3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logRelease files / sasso-0.1.2-py3-none-win_amd64.whl
| Download URL | sasso-0.1.2-py3-none-win_amd64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e253fef4b5b57a11c0349283c82892b64de98da0742b454e22b4e50240cca343
|
|
BLAKE2b-256 checksum How to use checksums |
f8020f8023313ae3279baccde43d1584a34f25cc01a7d32ba8ff6df298c227d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logRelease files / sasso-0.1.2-py3-none-musllinux_1_2_x86_64.whl
| Download URL | sasso-0.1.2-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
0cf5d53f3f641f775c35eec738133d4b12dd7c42ecf28b67a232c3d567df9ab7
|
|
BLAKE2b-256 checksum How to use checksums |
d48771cb764314ff6f7a32c9d294c0cd40d7fc14c0c3160218b5e3b5337fbbce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logRelease files / sasso-0.1.2-py3-none-musllinux_1_2_aarch64.whl
| Download URL | sasso-0.1.2-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
f0ddfe08c82cd4586635ebd6bd7bf4e6f82e41f23ec118109be5a1a828c276e8
|
|
BLAKE2b-256 checksum How to use checksums |
d634565195dceb791cac7b887c6a9554d4e197b717eca1bafe278458c7d7d0be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logRelease files / sasso-0.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | sasso-0.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
3e79f72758d6f5c0efb3b3b66cf2f3e60563d0c871770b511d2766944b6c1e08
|
|
BLAKE2b-256 checksum How to use checksums |
27ab762d0e5affe949452a3f593c2dfe29914bee3a99f39d9fb220db4662b946
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logRelease files / sasso-0.1.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | sasso-0.1.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
d8989815b9b206e80b813ce15f29be5edf06895df83795c0af7b471c353181cb
|
|
BLAKE2b-256 checksum How to use checksums |
18f0aaec27ba91d73afc53e565a2227fed273fc6c6b5e583d1ec7371a9ab165b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logRelease files / sasso-0.1.2-py3-none-macosx_11_0_arm64.whl
| Download URL | sasso-0.1.2-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
63965980644ebe6f1639c918577594fc1c519d220d17f1f276d66fc13cfd894a
|
|
BLAKE2b-256 checksum How to use checksums |
87e51daff5e55063765ecedacf2c2c2dc3185537523f213a6d2d91e796e83610
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logRelease files / sasso-0.1.2-py3-none-macosx_10_12_x86_64.whl
| Download URL | sasso-0.1.2-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
8a490398c93b22c684097d97ddfde6d7ccdb6a6b6a642bfe19f776666ef03cc8
|
|
BLAKE2b-256 checksum How to use checksums |
4894a459e38618ddd144c86e8886108baeebf8e9cd812a1ad9f0ec067c31c080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 25, 2026.
Transparency logSecurity for sasso 0.1.2
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 8 files in this release have been uploaded with provenance metadata.
Attestation for sasso-0.1.2.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 Jun 25, 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.