|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +ProgramVer is a Python/tkinter GUI app that replicates Microsoft's `winver` — it displays a customizable window with program version info, copyright notices, and buttons to open a License or EULA file in a secondary window. It is published to PyPI and is designed to be forked and customized per-program. |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +### Install dependencies |
| 12 | +```bash |
| 13 | +pip install -r requirements.txt |
| 14 | +``` |
| 15 | + |
| 16 | +### Run all tests |
| 17 | +```bash |
| 18 | +# Linux (requires xvfb for headless tkinter) |
| 19 | +xvfb-run -a python -m pytest tests/ -v |
| 20 | + |
| 21 | +# Windows / macOS |
| 22 | +python -m pytest tests/ -v |
| 23 | +``` |
| 24 | + |
| 25 | +### Run a single test |
| 26 | +```bash |
| 27 | +# Linux |
| 28 | +xvfb-run -a python -m pytest tests/test_main.py::TestProgramVer::test_name -v |
| 29 | + |
| 30 | +# Windows / macOS |
| 31 | +python -m pytest tests/test_main.py::TestProgramVer::test_name -v |
| 32 | +``` |
| 33 | + |
| 34 | +### Run tests with coverage |
| 35 | +```bash |
| 36 | +xvfb-run -a python -m pytest tests/ --cov=. --cov-report=term-missing |
| 37 | +``` |
| 38 | + |
| 39 | +### Lint |
| 40 | +```bash |
| 41 | +pylint $(git ls-files '*.py') |
| 42 | +``` |
| 43 | + |
| 44 | +## Architecture |
| 45 | + |
| 46 | +All application logic lives in a single module: **`main.py`**. It exposes four functions: |
| 47 | + |
| 48 | +- `get_resource_path(filename)` — resolves paths relative to the module file (needed for PyPI installs where the CWD may differ from the package location). |
| 49 | +- `ProgramVer()` — builds and runs the main tkinter window: logo images, version/copyright labels, and two buttons. |
| 50 | +- `openLicense()` — opens `LICENSE.txt` in a new `Tk()` window. |
| 51 | +- `openEULA()` — opens `EULA.txt` in a new `Tk()` window. |
| 52 | + |
| 53 | +`__main__.py` is the entry point; it just calls `ProgramVer()`. `setup.cfg` / `pyproject.toml` register the `programver` console script pointing at `main:ProgramVer`. |
| 54 | + |
| 55 | +**Customization intent:** The strings inside `ProgramVer()` (window title, version label, trademark text, license blurb) and the image files in `imgs/` are expected to be replaced when the project is forked. `LICENSE.txt` and `EULA.txt` in the repo root are the files opened at runtime. |
| 56 | + |
| 57 | +## Testing |
| 58 | + |
| 59 | +Tests are in `tests/test_main.py` using `unittest.TestCase`. All tkinter calls are mocked with `unittest.mock.patch` so tests run headlessly. The `# pylint: disable=import-error, invalid-name` comments at the top of both `main.py` and `test_main.py` are intentional — do not remove them. |
| 60 | + |
| 61 | +CI runs the full matrix: Ubuntu, Windows, macOS × Python 3.9–3.12. Coverage target is 100% for `main.py`. |
| 62 | + |
| 63 | +## Coding Conventions |
| 64 | + |
| 65 | +- 4-space indentation (no tabs). |
| 66 | +- Semantic Versioning for releases. |
| 67 | +- Version number appears in `main.py` (the `info` label), `pyproject.toml`, `setup.cfg`, and `setup.py` — update all four on a version bump. |
0 commit comments