docker-python-pre-commit/README.md

32 lines
990 B
Markdown
Raw Permalink Normal View History

2023-01-19 14:43:06 +01:00
# Docker image to run pre-commit on Python apps/libraries
2024-02-13 13:34:45 +01:00
Debian stable based image with common dependencies to run `pre-commit` on Python apps/libraries:
2023-01-19 14:43:06 +01:00
2024-02-13 13:34:45 +01:00
- common python packages: `python3-all python3-dev python3-pip python3-venv pylint`
2023-01-19 14:43:06 +01:00
- `build-essential` to allow local python package using `pip`
- `pre-commit` and `git` commands
2024-02-13 13:34:45 +01:00
- pre-install `pre-commit` environments for `ruff`, `pyupgrade`, `black`, `isort`,
`flake8`, `codespell`, `yamllint`, `prettier`, `pylint` and `bandit`.
2023-01-19 14:43:06 +01:00
To use it:
```bash
2024-02-13 13:34:45 +01:00
docker run \
-it --rm \
-v "$(pwd)":/src -w /src \
brenard/python-pre-commit \
pre-commit run --all-files
2023-01-19 14:43:06 +01:00
```
2023-01-19 14:53:20 +01:00
**Note:** an example `.pre-commit-config.yaml` file is provided with Docker image source.
2024-02-13 13:34:45 +01:00
To test it on your project, use to following command:
```bash
docker run \
-it --rm \
-v "$(pwd)":/src -w /src \
-v "$(pwd)/.pre-commit-config.yaml":/src/.pre-commit-config.yaml \
brenard/python-pre-commit \
pre-commit run --all-files
```