Skip to main content

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.

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 badgecli, 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

</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

belfry-0.1.2.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

belfry-0.1.2-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file belfry-0.1.2.tar.gz.

File metadata

  • Download URL: belfry-0.1.2.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for belfry-0.1.2.tar.gz
Algorithm Hash digest
SHA256 06a75f0be74e112efc699da72c5bd7895f0751f06892bb66d8b88e1d77590d9c
MD5 3eb8d41ccebfae92930c207ad1f67620
BLAKE2b-256 96e729dfdc60d6e3250d60bac3f799920aca60a17ccb7c7359f4e3370a4572d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for belfry-0.1.2.tar.gz:

Publisher: publish.yml on brendanjmeade/belfry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file belfry-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: belfry-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for belfry-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d888e2f4b791f5ef766e421f483af4047e1a260440aa8561bfbbd2d7aee1da9
MD5 3e89d8b68a57aecd5360d0caf237985c
BLAKE2b-256 ae150b4d90187e7653a6a3689563a79e3bbf0809570ea6e275c7b3c483440030

See more details on using hashes here.

Provenance

The following attestation bundles were made for belfry-0.1.2-py3-none-any.whl:

Publisher: publish.yml on brendanjmeade/belfry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page