skillfed

libsass

Sass for Python: A straightforward binding of libsass for Python.

libsass v0.23.0 2.6M downloads/30d#2,988 on PyPI
Permissive license MIT DORMANT released

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 libsass

uv

uv add libsass

poetry

poetry add libsass

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: CProgramming Language :: C++Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Python :: Implementation :: StacklessTopic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Compilers

Tags

sass scss compiler pythoncss preprocessing pythonlibsass bindingsass to css pythonstylesheet compilation
stylesheet-compilationsass-scssbuild-tool

More WWW/HTTP packages