1
0
mirror of https://github.com/j178/prek.git synced 2026-04-03 17:34:03 +02:00
Files
prek/python
SeonghwanLee a64312f89e Add support for python -m prek (#1686)
Related Issue: https://github.com/j178/prek/issues/1685

## Summary
prek can now be run with python -m prek in addition to the prek command,
matching common Python CLI tools like `black`, `ruff`, and `uv`.

## Motivation
- Consistency: Many Python tools support python -m <package>
- Virtual environments: Makes it clear which Python interpreter (and
venv) is used
- Scripts & CI: Explicit execution environment
- Tool integration: Some tools only support the `python -m` form

## Changes
- Add `python/prek/` package with `__init__.py` and `__main__.py`
- Set python-source = "python" in `pyproject.toml` so maturin includes
the Python package
- `__main__.`py invokes the prek binary next to the Python executable
(e.g. `.venv/bin/prek with .venv/bin/python`), falling back to PATH if
not found

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-02-27 18:15:56 +08:00
..