Initial release

This commit is contained in:
Benjamin Renard 2023-01-19 14:43:06 +01:00
commit 9bad2724b1
Signed by: bn8
GPG Key ID: 3E2E1CE1907115BC
5 changed files with 59 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*~

39
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,39 @@
# Pre-commit hooks to run tests and ensure code is cleaned.
# See https://pre-commit.com for more information
repos:
#- repo: local
# hooks:
# - id: pytest
# name: pytest
# entry: python3 -m pytest tests
# language: system
# types: [python]
# pass_filenames: false
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
require_serial: true
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ['--max-line-length=100']
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--py37-plus']
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
args: ['--target-version', 'py37', '--line-length', '100']
- repo: https://github.com/PyCQA/isort
rev: 5.11.4
hooks:
- id: isort
args: ['--profile', 'black', '--line-length', '100']

6
Dockerfile Normal file
View File

@ -0,0 +1,6 @@
from debian:stable-slim
RUN apt-get update && apt-get install --no-install-recommends -y python3-all python3-dev python3-pip python3-venv build-essential pylint3 git pre-commit && apt-get clean && rm -fr rm -rf /var/lib/apt/lists/*
RUN mkdir /tmp/src
COPY .pre-commit-config.yaml fake_python_module /tmp/src/
RUN cd /tmp/src && git init && git add * && pre-commit autoupdate && pre-commit run --all-files && rm -fr /tmp/src

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# Docker image to run pre-commit on Python apps/libraries
Image with common dependencies to run pre-commit in Python apps/libraries:
- common python packages: `python3-all python3-dev python3-pip python3-venv pylint3`
- `build-essential` to allow local python package using `pip`
- `pre-commit` and `git` commands
To use it:
```bash
docker run -it -v "$(pwd)":/src -w /src brenard/python-pre-commit
```

View File