Skip to main content

belfry

A Textual TUI for rediscovering what your Python scripts actually do.

belfry in action

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, or sys.argv indexing, even when there's no --help text 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, or error;
  • 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

pip install belfry

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.

Metadata

Release files for belfry 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for belfry 0.1.3
File Size Uploaded
belfry-0.1.3.tar.gz 27.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for belfry 0.1.3
File Interpreter ABI Platform
belfry-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 51.4 kB

Release files / belfry-0.1.3.tar.gz

Download URL belfry-0.1.3.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
512f0ad0095a49ead4f4187ec855673c52dffcc31e6db24ee62c1ebb5e76e182
BLAKE2b-256 checksum
How to use checksums
af7b3c7867fc5e23269459dda60e37c761c4eda3d2799925e5e6e4bafa181291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.

Transparency log

Release files / belfry-0.1.3-py3-none-any.whl

Download URL belfry-0.1.3-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7de636235b35fe7769848940253ba0477ae45cd5635497f05e0e3cb48f238728
BLAKE2b-256 checksum
How to use checksums
79b09f1e19a7e09fc69ab705e7888022fef4753b112439e3a947e7b6ec1c34d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page