tree-sitter-swift
Swift grammar for tree-sitter
Decision gist · record as of 2026-08-14
Yes, if you need to parse Swift code programmatically. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and provides prebuilt wheels for common platforms. The main caveat is that tree-sitter itself must be available in your environment; verify that dependency is clear before installing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Python 3.8 or later required; tree-sitter parser library must be available separately in your environment.
- Medium install friction due to compiled wheels; prebuilt binaries available for common platforms (macOS x86_64/arm64, Linux x86_64/aarch64, Windows x86_64/arm64, musl).
- Package is actively maintained with recent releases and no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package provided you include the license notice.
last release 2026-06-01 (74 days) · last repo commit 2026-08-11 · 217 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,943,531 downloads/mo, #3,415 on PyPI
Alternatives
Verify before relying
pip install tree-sitter-swift
import tree_sitter_swift
language = tree_sitter_swift.language()- Whether tree-sitter is automatically installed as a transitive dependency or must be installed separately.
- Performance characteristics when parsing large Swift codebases or in incremental update scenarios.
- Completeness of Swift language coverage across recent Swift versions and all language constructs.
What it is and what it does
tree-sitter-swift is a language grammar binding that plugs into the tree-sitter incremental parsing framework to parse Swift source code. It generates a syntax tree representation of Swift programs, which can be used for code analysis, transformation, linting, or IDE features. The package provides precompiled wheels for multiple platforms, eliminating the need to build the grammar locally in most cases.
The grammar is maintained actively and designed to work with tree-sitter's core parser engine. It can be used from Python, Rust, JavaScript/Node.js, or WebAssembly environments depending on which tree-sitter binding you pair it with. The package itself contains only the language definition; you supply the tree-sitter parser library separately to actually parse code.
Use it for
- Build a Swift linter or code quality checker that traverses the syntax tree to detect style violations.
- Implement IDE features like syntax highlighting, code completion, or go-to-definition by querying the parse tree.
- Analyze Swift codebases to extract metrics, find unused code, or refactor patterns across multiple files.
- Create a Swift-to-other-language transpiler or code generator that walks the syntax tree and emits different output.
- Develop a documentation generator that parses Swift source to extract and format API signatures and comments.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to parse Swift code programmatically.
The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and provides prebuilt wheels for common platforms. The main caveat is that tree-sitter itself must be available in your environment; verify that dependency is clear before installing.
Install
tree-sitter-swift on PyPI
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for common platforms (macOS x86_64/arm64, Linux x86_64/aarch64, Windows x86_64/arm64, musl). Package is actively maintained with recent releases and no known vulnerabilities.
Python 3.8 or later required; tree-sitter parser library must be available separately in your environment.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package provided you include the license notice.
Quickstart
pip install tree-sitter-swift
import tree_sitter_swift
language = tree_sitter_swift.language()
Verify before relying
- Whether tree-sitter is automatically installed as a transitive dependency or must be installed separately.
- Performance characteristics when parsing large Swift codebases or in incremental update scenarios.
- Completeness of Swift language coverage across recent Swift versions and all language constructs.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 74 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,943,531 / month, #3,415 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseTopic :: Software Development :: CompilersTopic :: Text Processing :: LinguisticTyping :: Typed |
Evidence: tree_sitter_swift-0.7.3-cp38-abi3-macosx_10_9_x86_64.whl; tree_sitter_swift-0.7.3-cp38-abi3-macosx_11_0_arm64.whl; tree_sitter_swift-0.7.3-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; tree_sitter_swift-0.7.3-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; tree_sitter_swift-0.7.3-cp38-abi3-musllinux_1_2_aarch64.whl; tree_sitter_swift-0.7.3-cp38-abi3-musllinux_1_2_x86_64.whl; tree_sitter_swift-0.7.3-cp38-abi3-win_amd64.whl; tree_sitter_swift-0.7.3-cp38-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 › “swift parser tree-sitter”
- tree-sitter-swiftProvides a tree-sitter grammar for parsing Swift source code,…
- tree-sitter-xmlProvides a tree-sitter parser grammar for XML and DTD files, enabling…
- tree-sitter-cssProvides a CSS grammar parser for tree-sitter, enabling incremental…
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-python · tree-sitter-go · tree-sitter-haskell · tree-sitter-rust · tree-sitter-java · tree-sitter-ruby · tree-sitter-kotlin · tree-sitter-php · trailmark