CLI tool for finding Python function definitions using ty's LSP server
Project description
ty-find
An LSP adapter for AI coding agents. Symbol name in, structured code intelligence out.
LSP servers are the gold standard for code navigation — but they require file positions (file.py:29:7). LLMs think in symbol names (MyClass). To use an LSP, an LLM first has to grep for the position, which is imprecise and adds a round-trip. tyf bridges this gap: one command gives you definition, signature, and references — by name, no file paths needed.
$ tyf show list_animals
# Definition (func)
main.py:14:1
# Signature
def list_animals(animals: list[Animal]) -> None
# Refs: 2 across 1 file(s)
$ tyf show list_animals --all # add docs, refs, test refs
Built for: Claude Code, Codex, Cursor, Gemini CLI — and humans who want fast terminal-based navigation.
Why tyf?
vs grep/ripgrep:
- grep matches text — tyf understands Python's type system
- grep returns hits in comments, strings, and docstrings; tyf returns only real symbol references
vs raw LSP (in editors):
- LSP requires
file:line:colpositions to answer queries - An LLM doesn't know positions without searching first
- Searching with grep is imprecise — circular problem
- tyf accepts symbol names directly, resolves positions internally
Usage with Claude Code
Add this to your project's CLAUDE.md to enable type-aware code navigation:
### Python Symbol Navigation — `tyf`
This project has `tyf` — a type-aware code search that gives LSP-quality
results by symbol name. Use `tyf` instead of grep/ripgrep for Python symbol lookups.
- `tyf show my_function` — definition + signature (add `-d` docs, `-r` refs, `-t` test refs, or `--all`)
- `tyf find MyClass` — find definition location
- `tyf refs my_function` — all usages (before refactoring)
- `tyf members TheirClass` — class public API
- `tyf list file.py` — file outline
All commands accept multiple symbols — batch to save tool calls.
Run `tyf <cmd> --help` for options.
Use grep for: string literals, config values, TODOs, non-Python files.
Installation
Prerequisite: ty type checker (uv add --dev ty)
Optional: ripgrep (rg) — speeds up lookups for non-existent symbols by quickly verifying whether a symbol appears in any .py file before retrying LSP queries. Without it, searches for non-existent symbols still work but may be slower.
# macOS
brew install ripgrep
# Ubuntu/Debian
sudo apt install ripgrep
# Or via cargo
cargo install ripgrep
uv add --dev ty-find
Note: On Windows, only tyf find --file is supported for now. All other commands require Unix domain sockets (Linux, macOS).
Usage
Show (Definition + Signature + References)
All-in-one command — searches the workspace by symbol name, no file needed. Add -d (docs), -r (references), -t (test refs), or --all for everything:
tyf show calculate_sum
# Multiple symbols at once
tyf show calculate_sum UserService Config
# Include docstring + refs + test refs
tyf show calculate_sum --all
# Narrow to a specific file
tyf show calculate_sum --file src/math.py
Find Symbol by Name
Searches the workspace for a symbol's definition. Supports multiple symbols in a single call. Use --fuzzy for partial/prefix matching with richer output (kind + container):
tyf find calculate_sum
# Find multiple symbols at once (results grouped by symbol)
tyf find calculate_sum multiply divide
# Narrow to a specific file (text-based search + goto_definition)
tyf find function_name --file myfile.py
# Fuzzy/prefix match (returns symbol kind + container info)
tyf find handle_ --fuzzy
Find References
# By position (exact, pipeable from list)
tyf refs -f myfile.py --line 10 --column 5
# By name
tyf refs my_function MyClass
# Mixed and piped
tyf refs file.py:10:5 my_func
... | tyf refs --stdin
Members (Class Public API)
tyf members MyClass
Document Outline
tyf list src/services/user.py
Daemon Management
The daemon starts automatically on first use. Run tyf daemon --help for manual control.
Output Formats
All commands support --format (placed before the subcommand): human (default), json, csv, paths.
tyf --format json show MyClass
tyf --format csv find User --fuzzy
Architecture
CLI Command → Daemon Client (auto-connects) → Unix Socket
→ Daemon Server (5min idle timeout) → LSP Client Pool → ty LSP Server
The daemon keeps LSP connections warm: first command takes 1-2s, subsequent commands 50-100ms. See How it works for details.
Development
cargo build --release
cargo test
cargo clippy
cargo fmt --check
# Verbose logging
RUST_LOG=ty_find=debug cargo run -- find hello_world
Troubleshooting
# Check ty is installed
ty --version
# Debug daemon issues
tyf daemon status
RUST_LOG=ty_find=debug tyf daemon start
# Restart daemon
tyf daemon stop && tyf daemon start
Contributing
Contributions welcome! Please open an issue to discuss major changes.
License
MIT License - see LICENSE file for details.
Credits
Built with ty - Astral's Python type checker.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ty_find-0.4.0.tar.gz.
File metadata
- Download URL: ty_find-0.4.0.tar.gz
- Upload date:
- Size: 971.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38af79873f47a45eedc6c8e83d34b61809f0820e11d00e074c2597acbc7061e4
|
|
| MD5 |
abf0051f43dfd9d64abee4482fd70018
|
|
| BLAKE2b-256 |
b442d091804cb90af13e2491886eec672fabffc87c15b1a603f0996d2f30d1c8
|
Provenance
The following attestation bundles were made for ty_find-0.4.0.tar.gz:
Publisher:
release.yml on mojzis/ty-find
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ty_find-0.4.0.tar.gz -
Subject digest:
38af79873f47a45eedc6c8e83d34b61809f0820e11d00e074c2597acbc7061e4 - Sigstore transparency entry: 1096000818
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ty_find-0.4.0-py3-none-win_amd64.whl.
File metadata
- Download URL: ty_find-0.4.0-py3-none-win_amd64.whl
- Upload date:
- Size: 808.0 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97dd5117129386c55ea1ca4e2a291dca129a5cd4eb882bccc7c806b08968dbb3
|
|
| MD5 |
72bcde6577715eab4f797f680e6f54cb
|
|
| BLAKE2b-256 |
3188c5d1a4ef2a8401493504086c7bb1502432a4f723f05e86f03684a409f85e
|
Provenance
The following attestation bundles were made for ty_find-0.4.0-py3-none-win_amd64.whl:
Publisher:
release.yml on mojzis/ty-find
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ty_find-0.4.0-py3-none-win_amd64.whl -
Subject digest:
97dd5117129386c55ea1ca4e2a291dca129a5cd4eb882bccc7c806b08968dbb3 - Sigstore transparency entry: 1096000860
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ty_find-0.4.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ty_find-0.4.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f8cc4c76786abeff6d536343d91236814fd862a6485d434a9f6d771545f80ab
|
|
| MD5 |
a7daf4a16866c1156166b273fb05fa16
|
|
| BLAKE2b-256 |
6385576c5c72f5b98faf9118b58137928e9a6299d84839ac76342f1c68f30663
|
Provenance
The following attestation bundles were made for ty_find-0.4.0-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on mojzis/ty-find
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ty_find-0.4.0-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
0f8cc4c76786abeff6d536343d91236814fd862a6485d434a9f6d771545f80ab - Sigstore transparency entry: 1096000894
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ty_find-0.4.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: ty_find-0.4.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58bce5374a914b6fb4f6d333b1921ff0b485f8a3b68eac6b26f3fd6c68effa8a
|
|
| MD5 |
2ceeaf5c0cd22aef21b31969c4c2fb6a
|
|
| BLAKE2b-256 |
6e87c064fe35522a3d44b1523c7cb96186f24a1e144ab3ddcbc1b9aac0822644
|
Provenance
The following attestation bundles were made for ty_find-0.4.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on mojzis/ty-find
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ty_find-0.4.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
58bce5374a914b6fb4f6d333b1921ff0b485f8a3b68eac6b26f3fd6c68effa8a - Sigstore transparency entry: 1096000927
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@95389b5b9025e3f1705e3830215d9b8f7962fbf5 -
Trigger Event:
push
-
Statement type: