tinycss2
A tiny CSS parser
Install
tinycss2 on PyPI
pip
pip install tinycss2uv
uv add tinycss2poetry
poetry add tinycss2Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — webencodings |
| Maintenance | actively maintained — 263 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: tinycss2-1.5.1-py3-none-any.whl
Keywords: css, parser
About tinycss2
from the package's own PyPI description — quoted content, verbatim
tinycss2 is a low-level CSS parser and generator written in Python: it can parse strings, return objects representing tokens and blocks, and generate CSS strings corresponding to these objects.
Based on the CSS Syntax Level 3 specification, tinycss2 knows the grammar of CSS but doesn't know specific rules, properties or values supported in various CSS modules.
- Free software: BSD license
- For Python 3.10+, tested on CPython and PyPy
- Documentation: https://doc.courtbouillon.org/tinycss2
- Changelog: https://github.com/Kozea/tinycss2/releases
- Code, issues, tests: https://github.com/Kozea/tinycss2
- Code of conduct: https://www.courtbouillon.org/code-of-conduct
- Professional support: https://www.courtbouillon.org
- Donation: https://opencollective.com/courtbouillon
tinycss2 has been created and developed by Kozea (https://kozea.fr). Professional support, maintenance and community management is provided by CourtBouillon (https://www.courtbouillon.org).
Copyrights are retained by their contributors, no copyright assignment is required to contribute to tinycss2. Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion is licensed under the...
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
tinycss2 parses CSS strings into token and block objects and generates CSS from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.
Low install friction with a single pure-Python runtime dependency (webencodings). Active maintenance with a recent release (263 days ago) and ongoing repository activity.
Licensed under BSD (permissive), allowing commercial and private use with minimal restrictions; suitable for most projects.
Usage
pip install tinycss2
import tinycss2
tokens = tinycss2.parse_stylesheet('body { color: red; }')
for token in tokens:
print(token)
Requires Python 3.10 or later.
Verdict: tinycss2 is a stable, actively maintained CSS parser suitable for projects needing low-level CSS tokenization and generation. Its minimal dependency footprint, permissive BSD license, and support for current Python versions (3.10–3.14) make it a reliable choice with no known security vulnerabilities.
Needs verification
- Performance characteristics and parsing speed relative to typical CSS workloads.
- Whether the package is suitable for parsing malformed or adversarial CSS input.
Similar packages
permissive · top 1,000 on PyPI
pydyfpermissive · top 1,000 on PyPI
pyphencopyleft · top 1,000 on PyPI
weasyprintpermissive · top 1,000 on PyPI
tinyhtml5permissive · top 1,000 on PyPI
bleachpermissive · top 1,000 on PyPI
cssselectpermissive · top 1,000 on PyPI
larkpermissive · top 1,000 on PyPI
soupsievepermissive · top 100 on PyPI
jupyterlab-pygmentspermissive · top 1,000 on PyPI