Add README: install, usage, development
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
# new-python
|
||||||
|
|
||||||
|
CLI tool to scaffold a Python repository configured with pipenv, a basic `justfile`, code formatters, and a pre-commit hook. For use in test-driven development workflows.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Clone the repo, then create a symlink to `./bin/new-python` in a directory in your PATH, such as `~/.local/bin`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://git.wisehodl.dev/jay/new-python ~/lib/new-python
|
||||||
|
ln -s ~/lib/new-python/bin/new-python ~/.local/bin/new-python
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
new-python NAME [--packages PKG ...] [--dir PATH] [--python VERSION]
|
||||||
|
```
|
||||||
|
|
||||||
|
- `NAME` — Project name in kebab-case (e.g., `demo-project`)
|
||||||
|
- `--packages` — Runtime dependencies to add to the Pipfile
|
||||||
|
- `--dir` — Parent directory for the new project (default: current directory)
|
||||||
|
- `--python` — Python version pin (default: `3.12.4`, must be installed in pyenv)
|
||||||
|
|
||||||
|
The script renders the template, initializes a Git repo on `main`, runs `pipenv install --dev`, creates the initial commit, and installs the pre-commit hook.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ new-python demo-project --dir ~/path/to/repo
|
||||||
|
/home/user/path/to/repo/demo-project
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
- `pipenv install --dev` — set up virtual environment
|
||||||
|
- `just test` — run test suite (pass path to run a single test)
|
||||||
|
- `just ci` — run linter, formatter checks, and tests
|
||||||
|
- `just fmt` — run automatic code formatters
|
||||||
|
|
||||||
|
Template files live in `template/` and use `{{NAME}}`, `{{PKG}}`, and `{{PYVER}}` placeholders. `tests/test_selfhost.py` checks that this repository's configuration matches the template files.
|
||||||
Reference in New Issue
Block a user