tree-sitter-css
CSS grammar for tree-sitter
Decision gist · record as of 2026-08-14
Yes, if you are already using tree-sitter in your Python project and need to parse CSS. The package is well-maintained within the tree-sitter ecosystem, has no known vulnerabilities, and offers permissive licensing. Medium install friction is typical for compiled language bindings. Not worth installing if you need a standalone CSS parser or do not already have tree-sitter as a dependency.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires tree-sitter core library and language bindings installed separately; Python 3.10 or later required.
- Medium install friction due to compiled wheels; prebuilt binaries available for common platforms (x86_64, ARM, Windows).
- Requires Python 3.10+.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2025-09-28 (320 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,074,204 downloads/mo, #3,319 on PyPI
Alternatives
Verify before relying
pip install tree-sitter-css
from tree_sitter import Language, Parser
# Load the CSS grammar and create a parser
CSS_LANGUAGE = Language('path/to/tree_sitter_css.so', 'css')
parser = Parser()
parser.set_language(CSS_LANGUAGE)
# Parse CSS code
tree = parser.parse(b'body { color: red; }')- Whether tree-sitter core library is automatically installed as a dependency or must be installed separately.
- Specific tree-sitter API version compatibility for this grammar release.
- Performance characteristics for large CSS files or real-time parsing scenarios.
What it is and what it does
tree-sitter-css is a language grammar module that plugs into the tree-sitter incremental parser framework to parse CSS code into syntax trees. It is not a standalone parser but rather a grammar definition that works with tree-sitter's core parsing engine, which must be installed separately. The package provides precompiled binaries for multiple platforms and Python versions, making it straightforward to add CSS parsing capabilities to Python applications that already use tree-sitter.
The grammar enables applications to parse CSS incrementally—updating only the parts of the syntax tree that changed when the source is edited—rather than reparsing the entire file. This is useful for code editors, linters, static analyzers, and other tools that need to understand CSS structure and maintain performance during interactive use.
Use it for
- Build a CSS linter or formatter that understands the full syntax tree of stylesheets.
- Implement a code editor with incremental CSS parsing for real-time syntax highlighting and error detection.
- Analyze CSS codebases to extract selectors, properties, or dependencies for refactoring or auditing.
- Create a CSS-aware code transformation tool that modifies stylesheets while preserving structure.
- Develop a static analysis tool that detects CSS anti-patterns or unused rules.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are already using tree-sitter in your Python project and need to parse CSS.
The package is well-maintained within the tree-sitter ecosystem, has no known vulnerabilities, and offers permissive licensing. Medium install friction is typical for compiled language bindings. Not worth installing if you need a standalone CSS parser or do not already have tree-sitter as a dependency.
Install
tree-sitter-css on PyPI
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for common platforms (x86_64, ARM, Windows). Requires Python 3.10+. Package is aging (320 days since last release) but shows no signs of abandonment.
Requires tree-sitter core library and language bindings installed separately; Python 3.10 or later required.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install tree-sitter-css
from tree_sitter import Language, Parser
# Load the CSS grammar and create a parser
CSS_LANGUAGE = Language('path/to/tree_sitter_css.so', 'css')
parser = Parser()
parser.set_language(CSS_LANGUAGE)
# Parse CSS code
tree = parser.parse(b'body { color: red; }')
Verify before relying
- Whether tree-sitter core library is automatically installed as a dependency or must be installed separately.
- Specific tree-sitter API version compatibility for this grammar release.
- Performance characteristics for large CSS files or real-time parsing scenarios.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Aging 320 days since the last release |
| First released | |
| Downloads | 2,074,204 / month, #3,319 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersTopic :: Software Development :: CompilersTopic :: Text Processing :: LinguisticTyping :: Typed |
Evidence: tree_sitter_css-0.25.0-cp310-abi3-macosx_10_9_x86_64.whl; tree_sitter_css-0.25.0-cp310-abi3-macosx_11_0_arm64.whl; tree_sitter_css-0.25.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; tree_sitter_css-0.25.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; tree_sitter_css-0.25.0-cp310-abi3-musllinux_1_2_aarch64.whl; tree_sitter_css-0.25.0-cp310-abi3-musllinux_1_2_x86_64.whl; tree_sitter_css-0.25.0-cp310-abi3-win_amd64.whl; tree_sitter_css-0.25.0-cp310-abi3-win_arm64.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 › “css parser tree-sitter”
- tree-sitter-cssProvides a CSS grammar parser for tree-sitter, enabling incremental…
- tree-sitter-xmlProvides a tree-sitter parser grammar for XML and DTD files, enabling…
- tree-sitter-hclProvides a tree-sitter parser grammar for HCL and Terraform, enabling…
Give your agent the search over MCP, or paste the wish link into any chat.
More Linguistic packages
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
tiktoken is a fast BPE tokenizer that converts text into token sequences compatible with OpenAI models, supporting multiple encoding schemes including o200k_base and model-specific encodings.
Install it if you work with OpenAI APIs or need to understand token boundaries in GPT-family models.
Detects character encoding and language in byte sequences with high accuracy, supporting 99 encodings and returning confidence scores, language tags, and MIME types.
Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.
Converts Unicode text to ASCII by transliterating non-ASCII characters into their closest ASCII equivalents, with no runtime dependencies.
However, if transliteration quality or ongoing maintenance matters, consider unidecode instead despite its GPL-only license.
Lark is a parsing library that builds abstract syntax trees from context-free grammars, supporting multiple parsing algorithms (Earley, LALR(1), CYK) with automatic line and column tracking.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
See also tree-sitter-java · tree-sitter-python · tree-sitter-html · tree-sitter-c · tree-sitter-json · tree-sitter-javascript · tree-sitter-powershell · tree-sitter-c-sharp · tree-sitter-go · tree-sitter-regex