--- id: tree-sitter-css version: "0.25.0" license: MIT license_treatment: permissive maintenance: aging --- # tree-sitter-css — CSS grammar for tree-sitter License: permissive · Maintenance: aging · Downloads: 2.1M/mo ## 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 above — verify before relying. Provides a CSS grammar parser for tree-sitter, enabling incremental parsing and syntax tree analysis of CSS code. 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 pip install tree-sitter-css uv add tree-sitter-css poetry add tree-sitter-css ## Installing tree-sitter-css 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. 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; }') Requires tree-sitter core library and language bindings installed separately; Python 3.10 or later required. 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_current - Install friction: medium - Maintenance: aging - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags css parser tree-sitter, incremental css parsing, css syntax tree analysis, tree-sitter language binding, css grammar parser, parse css code, css ast generation, parsing, tree-sitter, css [View on SkillFed](https://skillfed.io/packages/tree-sitter-css) · [View on PyPI](https://pypi.org/project/tree-sitter-css/)