f265f8f849db9ac7871ae7a9b3c4261a4dc79d78
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.
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
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.
$ new-python demo-project --dir ~/path/to/repo
/home/user/path/to/repo/demo-project
Development
pipenv install --dev— set up virtual environmentjust test— run test suite (pass path to run a single test)just ci— run linter, formatter checks, and testsjust 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.
Languages
Python
87%
Just
10.3%
Shell
2.7%