CLI tool for finding Python function definitions using ty's LSP server
Project description
ty-find
A command-line tool for Python code navigation using ty's LSP server. Uses a daemon-backed architecture to keep LSP connections warm between commands (~50-100ms after initial startup).
Usage with Claude Code
Add this to your project's CLAUDE.md to enable type-aware code navigation:
### Python Symbol Navigation (ty-find)
IMPORTANT: Use `tyf` instead of Grep for Python symbol lookups.
Grep matches in comments, strings, and docs — tyf is type-aware and precise.
Run `tyf --help` to see all commands. Run `tyf <cmd> --help` for details.
- Symbol overview (definition + type + refs): `tyf inspect my_function`
- Find definition: `tyf find MyClass`
- Class public interface: `tyf members TheirClass`
- All usages before refactoring: `tyf refs my_function` or `tyf refs -f file.py -l LINE -c COL`
- File outline: `tyf list file.py`
All commands accept multiple symbols in one call — batch to save tool invocations.
Grep is still appropriate for string literals, config values, TODOs, and non-symbol text.
Why ty-find over grep?
- Type-aware precision — grep matches in comments, docstrings, and strings; tyf returns only actual code references through ty's type inference engine
- Rich symbol detail — definition location, type signatures, full class interfaces (methods, properties, class variables), and cross-project references, all in one call
- Token-efficient — condensed output by default, giving AI agents maximum information in minimum context window space
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
From PyPI
pip install ty-find
# Or with uv
uv add --dev ty-find
From Git (Pre-Release)
Requires the Rust toolchain to build from source:
pip install "ty-find @ git+https://github.com/mojzis/ty-find.git"
# Or with uv
uv add --dev "ty-find @ git+https://github.com/mojzis/ty-find.git"
From Source
git clone https://github.com/mojzis/ty-find.git
cd ty-find
cargo install --path .
Note: Windows support is limited — see Platform Support below.
Platform Support
ty-find builds and installs on all platforms, but the background daemon requires Unix domain sockets and is only available on Unix systems (Linux, macOS).
| Command | Linux / macOS | Windows |
|---|---|---|
find --file |
Yes | Yes |
find (no file) |
Yes | No |
find --fuzzy |
Yes | No |
inspect |
Yes | No |
refs |
Yes | No |
list |
Yes | No |
daemon |
Yes | No |
On Windows, daemon-dependent commands exit with a clear error message. Adding the package as a dependency won't break your project on Windows — it just won't have full functionality. PRs for Windows named-pipe support are welcome!
Usage
Inspect (Definition + Type Info + References)
All-in-one command — searches the workspace by symbol name, no file needed. Supports multiple symbols in a single call:
tyf inspect calculate_sum
# Inspect multiple symbols at once (results grouped by symbol)
tyf inspect calculate_sum UserService Config
# Narrow to a specific file
tyf inspect calculate_sum --file src/math.py
# JSON output for scripting
tyf --format json inspect UserService
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
Document Outline
tyf list src/services/user.py
Daemon Management
The daemon starts automatically on first use. Manual control:
tyf daemon start # Start manually
tyf daemon status # Check status
tyf daemon stop # Stop
Output Formats
All commands support --format (placed before the subcommand): human (default), json, csv, paths.
tyf --format json inspect 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.
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.3.0.tar.gz.
File metadata
- Download URL: ty_find-0.3.0.tar.gz
- Upload date:
- Size: 960.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb8c6180d0f12e4871e98c1e6b13b205c15142f3adb75f7494354a5c640bb492
|
|
| MD5 |
fe678c585b69461f8cde18e043c9bb6c
|
|
| BLAKE2b-256 |
5fb287384cdcdc5be115b79c51b1e5e2892b563225099b5b0302e91424608115
|
Provenance
The following attestation bundles were made for ty_find-0.3.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.3.0.tar.gz -
Subject digest:
fb8c6180d0f12e4871e98c1e6b13b205c15142f3adb75f7494354a5c640bb492 - Sigstore transparency entry: 1065089015
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ty_find-0.3.0-py3-none-win_amd64.whl.
File metadata
- Download URL: ty_find-0.3.0-py3-none-win_amd64.whl
- Upload date:
- Size: 802.3 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 |
f360e145d8470152a4fe905efad83d8b7de83fe6679f755dbff1e51bb6137108
|
|
| MD5 |
628774e6b0352d644dac4c13d9eb7964
|
|
| BLAKE2b-256 |
35d5445257182a7f08343bb0f39d08e9542fd7b0177c26cf8a61e3b0ee62ecae
|
Provenance
The following attestation bundles were made for ty_find-0.3.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.3.0-py3-none-win_amd64.whl -
Subject digest:
f360e145d8470152a4fe905efad83d8b7de83fe6679f755dbff1e51bb6137108 - Sigstore transparency entry: 1065089078
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ty_find-0.3.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ty_find-0.3.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 |
8412fc78e9c5716809dfe129c670ff8df4d0016f3109466258252df2864bb09e
|
|
| MD5 |
522280701168a2f8bfef1a7eb1bab062
|
|
| BLAKE2b-256 |
211ce705f719deec628d70a49870e5c8c19e8715273faedbc6acb813968a0c83
|
Provenance
The following attestation bundles were made for ty_find-0.3.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.3.0-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
8412fc78e9c5716809dfe129c670ff8df4d0016f3109466258252df2864bb09e - Sigstore transparency entry: 1065089124
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ty_find-0.3.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: ty_find-0.3.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 |
3bf789f05b99bbd8fcbfce39a711de55fa839a41f4d03066f50627c46d49c398
|
|
| MD5 |
98653afadc4df4a8385c519c2e248d60
|
|
| BLAKE2b-256 |
6352b9f615c2938a2c7e9645549f9f14aaceeb851eef1798a299919ad09eb6a6
|
Provenance
The following attestation bundles were made for ty_find-0.3.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.3.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
3bf789f05b99bbd8fcbfce39a711de55fa839a41f4d03066f50627c46d49c398 - Sigstore transparency entry: 1065089196
- Sigstore integration time:
-
Permalink:
mojzis/ty-find@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mojzis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@09b667127d18899a2a852c1b8f372b6dc0f9a406 -
Trigger Event:
push
-
Statement type: