pyScss (SCSS compiler for Python)

raw JSON →
1.4.0 verified Sat May 09 auth: no python maintenance

A Scss (Sassy CSS) compiler for Python. Version 1.4.0, with irregular releases. Implements the SCSS syntax (a CSS preprocessor) and outputs CSS.

pip install pyScss
error ModuleNotFoundError: No module named 'scss'
cause Package installed but imported incorrectly as 'pyScss'.
fix
Install 'pyScss' but import as 'scss': 'pip install pyScss' then 'from scss import Scss'.
error SyntaxError: invalid syntax (file.py line X) ... pyScss uses six
cause Using Python 3.9+ with older pyScss that relies on deprecated 'collections' imports from 'six'.
fix
Upgrade pyScss to 1.4.0 (fixes Python 3 compatibility).
gotcha Import from 'scss' not 'pyScss'.
fix Use 'from scss import Scss'.
deprecated Python 2 support ending; Python 3.6+ required in future.
fix Upgrade to 1.4.0 (Python 3 compatible) and ensure Python 3.6+.
gotcha pyScss uses its own non-standard SCSS syntax; not fully compatible with Ruby Sass or LibSass.
fix Test your SCSS; prefer libsass (pysass) for compatibility.

Compile SCSS to CSS using the Scss class.

from scss import Scss

scss = Scss()
css = scss.compile('''
$color: #ff0000;
body { color: $color; }
''')
print(css)