lesscpy
Python LESS compiler
Decision gist · record as of 2026-08-14
Yes, if you need LESS compilation in a Python-only environment and can accept slower performance than Node.js. The low install friction, active maintenance, MIT license, and lack of vulnerabilities make it a straightforward choice. No, if you already have Node.js available or require JavaScript evaluation within LESS files—use the reference compiler instead.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later
- Low friction: pure Python wheel with a single runtime dependency (ply).
- Active maintenance with a release 15 days ago and last commit on 2026-07-30.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions, making it safe to integrate into most projects without licensing concerns.
last release 2026-07-30 (15 days) · last repo commit 2026-07-30 · 144 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 179,946 downloads/mo, #10,158 on PyPI
Alternatives
Verify before relying
from io import StringIO
import lesscpy
result = lesscpy.compile(StringIO("a { border-width: 2px * 3; }"), minify=True)
print(result)- Whether the package's performance characteristics (described as 'considerably slower than the Node.js compiler') are acceptable for your build pipeline
- Completeness of LESS feature coverage beyond the listed supported features for your specific stylesheets
What it is and what it does
Lesscpy is a Python implementation of a LESS-to-CSS compiler that lets you use LESS stylesheets in environments where Node.js is unavailable or undesirable. It tokenizes and parses LESS syntax using PLY (Python Lex-Yacc) and outputs valid CSS. The package supports a substantial subset of LESS features including variables, mixins with nesting and recursion, guard expressions, color manipulation functions, and string interpolation.
You can use it either as a command-line tool (with options for minification, includes, and output control) or programmatically by calling `lesscpy.compile()` on a file-like object or string. The main trade-off is speed: it runs slower than the Node.js reference implementation because it's written in Python, and it does not support JavaScript evaluation within LESS files. All colors are normalized to six-digit hex format, and CSS comments are not preserved.
Use it for
- Compile LESS stylesheets in Python web frameworks (Django, Flask) without a Node.js dependency
- Integrate LESS compilation into Python-based build pipelines or static site generators
- Process LESS files in containerized or restricted environments where Node.js cannot be installed
- Automate stylesheet preprocessing in CI/CD workflows using only Python tooling
- Support LESS in legacy Python projects that cannot adopt modern JavaScript tooling
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need LESS compilation in a Python-only environment and can accept slower performance than Node.js.
The low install friction, active maintenance, MIT license, and lack of vulnerabilities make it a straightforward choice. No, if you already have Node.js available or require JavaScript evaluation within LESS files—use the reference compiler instead.
Install
lesscpy on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (ply). Active maintenance with a release 15 days ago and last commit on 2026-07-30. Stable production status and no known vulnerabilities.
Requires Python 3.11 or later
License in practice
MIT license permits commercial and private use with minimal restrictions, making it safe to integrate into most projects without licensing concerns.
Quickstart
from io import StringIO
import lesscpy
result = lesscpy.compile(StringIO("a { border-width: 2px * 3; }"), minify=True)
print(result)
Verify before relying
- Whether the package's performance characteristics (described as 'considerably slower than the Node.js compiler') are acceptable for your build pipeline
- Completeness of LESS feature coverage beyond the listed supported features for your specific stylesheets
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageply |
| Maintenance | Actively maintained 15 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 179,946 / month, #10,158 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: End Users/DesktopIntended Audience :: System AdministratorsOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Pre-processors |
Evidence: lesscpy-0.15.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “less compiler python”
- lesscpyCompiles LESS stylesheets to CSS using Python, without requiring…
- dukpyDukPy is a JavaScript interpreter for Python that runs JavaScript…
- pyScssCompiles Sass/SCSS stylesheets to CSS, supporting approximately 95%…
Give your agent the search over MCP, or paste the wish link into any chat.
More Code Generators packages
Proto Plus wraps protocol buffers to provide Python classes that behave like native Python types while maintaining protocol buffer serialization and schema validation.
Install it if you're working with protocol buffers in Python and want a more Pythonic interface, or if you're using Google Cloud libraries that depend on it.
Cython is a source code translator that compiles Python code to C, enabling optional static typing and direct C/C++ interoperability to generate efficient native extensions.
Install it if you need to optimize Python performance, wrap C/C++ libraries, or build fast native extensions.
Annotates Python abstract syntax trees with the positions of tokens and source code text, enabling tools to map AST nodes back to their originating code for refactoring, analysis, and transformation.
Beartype is a runtime type checker that validates Python type hints at function call time, catching type violations before they cause downstream bugs.
Install it if you want runtime type safety for your annotated code or need to validate type hints on third-party packages.
llvmlite provides a lightweight Python binding to LLVM's IR builder, optimizer, and JIT compiler APIs, enabling you to write JIT compilers and code generators without needing the full LLVM C++ API surface.
astor converts Python abstract syntax trees (ASTs) back to readable source code and provides tools for AST manipulation, inspection, and non-recursive tree traversal.
Install it if you need AST round-tripping or advanced tree inspection.
See also pyScss · vbuild · stylus · pscript · Flask-Minify · django-compressor · CoffeeScript · dukpy · pytailwindcss · pcpp