libsass
Sass for Python: A straightforward binding of libsass for Python.
What it is and what it does
libsass is a straightforward Python binding to LibSass, a C/C++ implementation of the Sass stylesheet language. It lets you compile Sass and SCSS files to CSS directly from Python without needing Ruby, Node.js, or any external toolchain. The package provides a simple API for string compilation, file-based compilation, and integration with web frameworks via WSGI middleware, plus setuptools integration for build-time stylesheet compilation.
The binding ships with prebuilt wheels for major platforms (Linux, Windows, macOS on both x86_64 and ARM64), reducing installation friction compared to building from source. It supports CPython 3.8+ and PyPy, with no runtime dependencies beyond the compiled extension itself. The package has been stable since its initial release in 2012, though maintenance appears dormant.
Use it for:
- Compile Sass/SCSS stylesheets during Python web application builds without external build tools.
- Integrate stylesheet preprocessing into setuptools-based projects using the build_sass command.
- Serve dynamically compiled CSS during development via WSGI middleware that auto-compiles on each request.
- Define custom Sass functions and import callbacks from Python code.
- Embed stylesheet compilation in deployment pipelines where only Python is available.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Compiles Sass and SCSS stylesheets to CSS through a Python binding of the C/C++ LibSass library, with no Ruby or Node.js dependency.
Yes, if you need Sass compilation in a Python-only environment and can accept the dormant maintenance status. The package is stable and widely used (2581130 monthly downloads), with no known vulnerabilities and permissive MIT licensing. Install friction is moderate due to the C++ extension, but prebuilt wheels mitigate this for common platforms. Not recommended if you expect active maintenance or frequent updates.
Install
libsass on PyPI
pip
pip install libsassuv
uv add libsasspoetry
poetry add libsassInstalling libsass
Before you install
Medium install friction due to compiled C++ extension requiring a compatible compiler, but prebuilt wheels are provided for Linux, Windows, and macOS. Package is dormant (951 days since last release) but marked Production/Stable.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install libsass
import libsass
libsass.compile(string='a { b { color: blue; } }')
Requires a C++ compiler supporting recent C++ standards if building from source; prebuilt wheels available for common platforms.
Verify before relying
- Current maintenance status and likelihood of future updates given 951-day gap since last release.
- Whether prebuilt wheels cover all target deployment platforms and Python versions in use.
- Specific C++ standard version requirements for compilation from source.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 951 days since the last release |
| First released | |
| Downloads | 2,581,130/month — #2,988 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: libsass-0.23.0-cp38-abi3-macosx_11_0_x86_64.whl; libsass-0.23.0-cp38-abi3-macosx_14_0_arm64.whl; libsass-0.23.0-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl; libsass-0.23.0-cp38-abi3-win32.whl; libsass-0.23.0-cp38-abi3-win_amd64.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
django-libsassIntegrates Sass compilation into Django…
permissive · top 5,000 on PyPI
pyScssCompiles Sass/SCSS stylesheets to CSS,…
permissive · top 15,000 on PyPI
django-sass-processorCompiles SASS/SCSS files to CSS on the fly…
permissive · top 15,000 on PyPI
vbuildCompiles Vue single-file components (*.vue) to…
permissive · top 15,000 on PyPI
lesscpyCompiles LESS stylesheets to CSS using Python,…
permissive · top 15,000 on PyPI
pynlinerConverts CSS stylesheets to inline styles in…
permissive · top 15,000 on PyPI
css-inlineInlines CSS from style and link tags directly…
permissive · top 5,000 on PyPI
pytailwindcssInstalls and wraps the standalone Tailwind CSS…
permissive · top 15,000 on PyPI
cssutilscssutils parses and builds CSS stylesheets as a…
copyleft · top 5,000 on PyPI
p4pythonp4python wraps the Perforce C++ API to provide…
unclear · top 15,000 on PyPI