belfry 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- belfry-0.1.0/LICENSE +21 -0
- belfry-0.1.0/PKG-INFO +124 -0
- belfry-0.1.0/README.md +94 -0
- belfry-0.1.0/pyproject.toml +43 -0
- belfry-0.1.0/setup.cfg +4 -0
- belfry-0.1.0/src/belfry/__init__.py +3 -0
- belfry-0.1.0/src/belfry/__main__.py +4 -0
- belfry-0.1.0/src/belfry/analyzer.py +1168 -0
- belfry-0.1.0/src/belfry/app.py +519 -0
- belfry-0.1.0/src/belfry/cli.py +50 -0
- belfry-0.1.0/src/belfry/gitinfo.py +49 -0
- belfry-0.1.0/src/belfry/models.py +79 -0
- belfry-0.1.0/src/belfry/scanner.py +141 -0
- belfry-0.1.0/src/belfry.egg-info/PKG-INFO +124 -0
- belfry-0.1.0/src/belfry.egg-info/SOURCES.txt +19 -0
- belfry-0.1.0/src/belfry.egg-info/dependency_links.txt +1 -0
- belfry-0.1.0/src/belfry.egg-info/entry_points.txt +2 -0
- belfry-0.1.0/src/belfry.egg-info/requires.txt +4 -0
- belfry-0.1.0/src/belfry.egg-info/top_level.txt +1 -0
- belfry-0.1.0/tests/test_analyzer.py +271 -0
- belfry-0.1.0/tests/test_scanner.py +34 -0
belfry-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brendan Meade
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
belfry-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: belfry
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Textual TUI for rediscovering what your Python scripts do — their arguments, inputs, and outputs
|
|
5
|
+
Author-email: Brendan Meade <brendanjmeade@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/brendanjmeade/belfry
|
|
8
|
+
Project-URL: Repository, https://github.com/brendanjmeade/belfry
|
|
9
|
+
Project-URL: Issues, https://github.com/brendanjmeade/belfry/issues
|
|
10
|
+
Keywords: tui,textual,scripts,static-analysis,ast,developer-tools,cli
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: textual>=0.60
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# belfry
|
|
32
|
+
|
|
33
|
+
**Ring a bell.** A [Textual](https://github.com/Textualize/textual) TUI for
|
|
34
|
+
rediscovering what your Python scripts actually do.
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
You know the folder: dozens of `.py` files accumulated over months — mainline
|
|
39
|
+
analyses, throwaway one-offs, and half-remembered experiments. Which ones take
|
|
40
|
+
arguments? What files do they read? What do they write? `belfry` answers those
|
|
41
|
+
questions at a glance, without you opening a single file.
|
|
42
|
+
|
|
43
|
+
A *belfry* is a bell tower — and, as in "bats in the belfry," a place where
|
|
44
|
+
things hang half-forgotten until you go and ring them.
|
|
45
|
+
|
|
46
|
+
## What it shows
|
|
47
|
+
|
|
48
|
+
Run `belfry` in any folder. It lists every `.py` file (recursively, honoring
|
|
49
|
+
`.gitignore`) with a script-type badge, last-modified date, and git provenance.
|
|
50
|
+
Select a file and belfry shows you:
|
|
51
|
+
|
|
52
|
+
- the **CLI arguments** it accepts — parsed from `argparse` / `click` / `typer`,
|
|
53
|
+
or `sys.argv` indexing, even when there's no `--help` text to be found;
|
|
54
|
+
- the **hardcoded input filenames** it reads (`pd.read_csv`, `open`,
|
|
55
|
+
`xr.open_dataset`, `np.load`, …);
|
|
56
|
+
- the **output files** it writes (`.to_csv`, `plt.savefig`, `json.dump`,
|
|
57
|
+
`gmsh.write`, …);
|
|
58
|
+
- its **docstring and leading comments**;
|
|
59
|
+
- a **script-type badge** — `cli`, `cell-script` (Jupyter `# %%`), `script`, or
|
|
60
|
+
`error`;
|
|
61
|
+
- the module-level constants ("knobs") for scripts driven by hardcoded values
|
|
62
|
+
instead of CLI flags;
|
|
63
|
+
- a **syntax-highlighted source preview**.
|
|
64
|
+
|
|
65
|
+
It even resolves f-strings and `Path(...)` expressions, so
|
|
66
|
+
`f"./runs/{RUN_NAME}/"` shows up as the real path and unresolved values are
|
|
67
|
+
clearly flagged.
|
|
68
|
+
|
|
69
|
+
## How it works
|
|
70
|
+
|
|
71
|
+
belfry reads each script with Python's `ast` module and **never executes it** —
|
|
72
|
+
safe to point at code you don't trust or barely remember. Analysis and git
|
|
73
|
+
lookups happen lazily as you move through the list and are cached, so it stays
|
|
74
|
+
responsive in large trees. Git provenance falls back cleanly to filesystem
|
|
75
|
+
mtime when a file is untracked or you're not in a git repo.
|
|
76
|
+
|
|
77
|
+
## Install
|
|
78
|
+
|
|
79
|
+
belfry is not on PyPI yet. Install from source:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git clone git@github.com:brendanjmeade/belfry.git
|
|
83
|
+
cd belfry
|
|
84
|
+
pip install -e .
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Requires Python 3.10+ (the only runtime dependency is `textual`).
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
belfry [PATH] [--no-recurse]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- `PATH` — directory to scan (defaults to the current directory).
|
|
96
|
+
- `--no-recurse` — only scan the top level instead of descending into subdirectories.
|
|
97
|
+
|
|
98
|
+
You can also run it as a module: `python -m belfry`.
|
|
99
|
+
|
|
100
|
+
## Key bindings
|
|
101
|
+
|
|
102
|
+
| Key | Action |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| `j` / `k`, arrows | navigate the file list (or scroll the details when the lower pane is focused) |
|
|
105
|
+
| `J` / `K` | jump focus to the lower / upper pane |
|
|
106
|
+
| `h` / `l` | switch tabs in the lower pane (Summary / Source) |
|
|
107
|
+
| `/` | filter files by name |
|
|
108
|
+
| `r` | toggle recursion / rescan |
|
|
109
|
+
| `enter` | open the selected file in `$EDITOR` |
|
|
110
|
+
| `q` | quit |
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install -e ".[dev]"
|
|
116
|
+
pytest
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The static analyzer (`src/belfry/analyzer.py`) is covered by a focused test
|
|
120
|
+
suite with fixtures for each pattern it handles.
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
Not yet licensed — a license will be added before the first release.
|
belfry-0.1.0/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# belfry
|
|
2
|
+
|
|
3
|
+
**Ring a bell.** A [Textual](https://github.com/Textualize/textual) TUI for
|
|
4
|
+
rediscovering what your Python scripts actually do.
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
You know the folder: dozens of `.py` files accumulated over months — mainline
|
|
9
|
+
analyses, throwaway one-offs, and half-remembered experiments. Which ones take
|
|
10
|
+
arguments? What files do they read? What do they write? `belfry` answers those
|
|
11
|
+
questions at a glance, without you opening a single file.
|
|
12
|
+
|
|
13
|
+
A *belfry* is a bell tower — and, as in "bats in the belfry," a place where
|
|
14
|
+
things hang half-forgotten until you go and ring them.
|
|
15
|
+
|
|
16
|
+
## What it shows
|
|
17
|
+
|
|
18
|
+
Run `belfry` in any folder. It lists every `.py` file (recursively, honoring
|
|
19
|
+
`.gitignore`) with a script-type badge, last-modified date, and git provenance.
|
|
20
|
+
Select a file and belfry shows you:
|
|
21
|
+
|
|
22
|
+
- the **CLI arguments** it accepts — parsed from `argparse` / `click` / `typer`,
|
|
23
|
+
or `sys.argv` indexing, even when there's no `--help` text to be found;
|
|
24
|
+
- the **hardcoded input filenames** it reads (`pd.read_csv`, `open`,
|
|
25
|
+
`xr.open_dataset`, `np.load`, …);
|
|
26
|
+
- the **output files** it writes (`.to_csv`, `plt.savefig`, `json.dump`,
|
|
27
|
+
`gmsh.write`, …);
|
|
28
|
+
- its **docstring and leading comments**;
|
|
29
|
+
- a **script-type badge** — `cli`, `cell-script` (Jupyter `# %%`), `script`, or
|
|
30
|
+
`error`;
|
|
31
|
+
- the module-level constants ("knobs") for scripts driven by hardcoded values
|
|
32
|
+
instead of CLI flags;
|
|
33
|
+
- a **syntax-highlighted source preview**.
|
|
34
|
+
|
|
35
|
+
It even resolves f-strings and `Path(...)` expressions, so
|
|
36
|
+
`f"./runs/{RUN_NAME}/"` shows up as the real path and unresolved values are
|
|
37
|
+
clearly flagged.
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
|
|
41
|
+
belfry reads each script with Python's `ast` module and **never executes it** —
|
|
42
|
+
safe to point at code you don't trust or barely remember. Analysis and git
|
|
43
|
+
lookups happen lazily as you move through the list and are cached, so it stays
|
|
44
|
+
responsive in large trees. Git provenance falls back cleanly to filesystem
|
|
45
|
+
mtime when a file is untracked or you're not in a git repo.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
belfry is not on PyPI yet. Install from source:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone git@github.com:brendanjmeade/belfry.git
|
|
53
|
+
cd belfry
|
|
54
|
+
pip install -e .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Requires Python 3.10+ (the only runtime dependency is `textual`).
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
belfry [PATH] [--no-recurse]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- `PATH` — directory to scan (defaults to the current directory).
|
|
66
|
+
- `--no-recurse` — only scan the top level instead of descending into subdirectories.
|
|
67
|
+
|
|
68
|
+
You can also run it as a module: `python -m belfry`.
|
|
69
|
+
|
|
70
|
+
## Key bindings
|
|
71
|
+
|
|
72
|
+
| Key | Action |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `j` / `k`, arrows | navigate the file list (or scroll the details when the lower pane is focused) |
|
|
75
|
+
| `J` / `K` | jump focus to the lower / upper pane |
|
|
76
|
+
| `h` / `l` | switch tabs in the lower pane (Summary / Source) |
|
|
77
|
+
| `/` | filter files by name |
|
|
78
|
+
| `r` | toggle recursion / rescan |
|
|
79
|
+
| `enter` | open the selected file in `$EDITOR` |
|
|
80
|
+
| `q` | quit |
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install -e ".[dev]"
|
|
86
|
+
pytest
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The static analyzer (`src/belfry/analyzer.py`) is covered by a focused test
|
|
90
|
+
suite with fixtures for each pattern it handles.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
Not yet licensed — a license will be added before the first release.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "belfry"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A Textual TUI for rediscovering what your Python scripts do — their arguments, inputs, and outputs"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Brendan Meade", email = "brendanjmeade@gmail.com" }]
|
|
14
|
+
keywords = ["tui", "textual", "scripts", "static-analysis", "ast", "developer-tools", "cli"]
|
|
15
|
+
dependencies = ["textual>=0.60"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Topic :: Software Development",
|
|
28
|
+
"Topic :: Utilities",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = ["pytest"]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/brendanjmeade/belfry"
|
|
36
|
+
Repository = "https://github.com/brendanjmeade/belfry"
|
|
37
|
+
Issues = "https://github.com/brendanjmeade/belfry/issues"
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
belfry = "belfry.cli:main"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.packages.find]
|
|
43
|
+
where = ["src"]
|
belfry-0.1.0/setup.cfg
ADDED