tinycss: CSS parser for Python¶
tinycss is a complete yet simple CSS parser for Python. It supports the full syntax and error handling for CSS 2.1 as well as some CSS 3 modules:
- CSS Color 3
- CSS Paged Media 3
It is designed to be easy to extend for new CSS modules and syntax, and integrates well with cssselect for Selectors 3 support.
- Free software: BSD licensed
- Compatible with Python 2.6+ and 3.x
- Latest documentation on python.org
- Source, issues and pull requests on Github
- Releases on PyPI
- Install with pip install tinycss
tinycss is tested on CPython 2.6, 2.7, 3.1 and 3.2 as well as PyPy 1.8; it should work on any implementation of Python 2.6 or later version (including 3.x) of the language.
Cython is used for optional accelerators but is only required for development versions on tinycss.
Installing with pip should Just Work:
pip install tinycss
The release tarballs contain pre-cythoned C files for the accelerators: you will not need Cython to install like this. If the accelerators fail to build for some reason, tinycss will print a warning and fall back to a pure-Python installation.
- Parsing with tinycss
- CSS 3 Modules
- Extending the parser
- Hacking tinycss
- tinycss changelog