A Textual TUI for rediscovering what your Python scripts do — their arguments, inputs, and outputs
Project description
belfry
A Textual TUI for rediscovering what your Python scripts actually do.
We all have folders full of .py files accumulated over months. Sometimes we've created these and in modern times coding agents often do. These often include some combination of mainline analyses, throwaway one-offs, and half-remembered experiments. Which ones take arguments? What files do they read? What do they write? belfry answers those questions at a glance, without you opening a single file.
What it shows
Run belfry in any folder. It lists every .py file (recursively, honoring .gitignore) with a script-type badge, last-modified date, and git provenance. Select a file and belfry shows you:
- The CLI arguments it accepts — parsed from
argparse/click/typer, orsys.argvindexing, even when there's no--helptext to be found; - The hardcoded input filenames it reads (
pd.read_csv,open,xr.open_dataset,np.load, …); - The output files it writes (
.to_csv,plt.savefig,json.dump,gmsh.write, …); - Its docstring and leading comments;
- A script-type badge —
cli,cell-script(Jupyter# %%),script, orerror; - The module-level constants ("knobs") for scripts driven by hardcoded values instead of CLI flags;
- A syntax-highlighted source preview.
It even resolves f-strings and Path(...) expressions, so f"./runs/{RUN_NAME}/" shows up as the real path and unresolved values are clearly flagged.
How it works
belfry reads each script with Python's ast module and never executes it — safe to point at code you don't trust or barely remember. Analysis and git lookups happen lazily as you move through the list and are cached, so it stays responsive in large trees. Git provenance falls back cleanly to filesystem mtime when a file is untracked or you're not in a git repo.
Install
</code></pre>
<p>pip install belfry</p>
<pre><code>
Requires Python 3.10+ (the only runtime dependency is textual).
Usage
belfry [PATH] [--no-recurse]
PATH— directory to scan (defaults to the current directory).--no-recurse— only scan the top level instead of descending into subdirectories.
You can also run it as a module: python -m belfry.
Key bindings
| Key | Action |
|---|---|
j / k, arrows |
navigate the file list (or scroll the details when the lower pane is focused) |
J / K |
jump focus to the lower / upper pane |
h / l |
switch tabs in the lower pane (Summary / Source) |
/ |
filter files by name |
r |
toggle recursion / rescan |
enter |
open the selected file in $EDITOR |
q |
quit |
Development
pip install -e ".[dev]"
pytest
The static analyzer (src/belfry/analyzer.py) is covered by a focused test suite with fixtures for each pattern it handles.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 belfry-0.1.1.tar.gz.
File metadata
- Download URL: belfry-0.1.1.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90d479745eb99959f62bfe86fc8dc128e92911d8f89c9fe4580a730c6c6696ba
|
|
| MD5 |
63620d3125b676d977bc984c909cba82
|
|
| BLAKE2b-256 |
85ead642ed331c17809c549beaa236dcb82f02740067934ff5092684b7e042f1
|
Provenance
The following attestation bundles were made for belfry-0.1.1.tar.gz:
Publisher:
publish.yml on brendanjmeade/belfry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
belfry-0.1.1.tar.gz -
Subject digest:
90d479745eb99959f62bfe86fc8dc128e92911d8f89c9fe4580a730c6c6696ba - Sigstore transparency entry: 1866821577
- Sigstore integration time:
-
Permalink:
brendanjmeade/belfry@29b0420c95511b2b5110bfeea7ea0a26ce96053b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/brendanjmeade
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29b0420c95511b2b5110bfeea7ea0a26ce96053b -
Trigger Event:
push
-
Statement type:
File details
Details for the file belfry-0.1.1-py3-none-any.whl.
File metadata
- Download URL: belfry-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dac7186fa844463f8e399018ef3bdb6fba98108d6dfe781adcba0bf8d43a16e1
|
|
| MD5 |
8db485bca0934eac08c1b225708d918b
|
|
| BLAKE2b-256 |
99e96593891962f538a6beb96eff0a4898dc532d6a9f2efe81540a5c94757ded
|
Provenance
The following attestation bundles were made for belfry-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on brendanjmeade/belfry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
belfry-0.1.1-py3-none-any.whl -
Subject digest:
dac7186fa844463f8e399018ef3bdb6fba98108d6dfe781adcba0bf8d43a16e1 - Sigstore transparency entry: 1866821635
- Sigstore integration time:
-
Permalink:
brendanjmeade/belfry@29b0420c95511b2b5110bfeea7ea0a26ce96053b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/brendanjmeade
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29b0420c95511b2b5110bfeea7ea0a26ce96053b -
Trigger Event:
push
-
Statement type: