Skip to content

Commit

Permalink
Merge pull request #13 from febus982/pre-commit
Browse files Browse the repository at this point in the history
Adds pre-commit configuration
  • Loading branch information
febus982 authored Jan 23, 2024
2 parents 124bc33 + 373a437 commit 046317b
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 13 deletions.
1 change: 1 addition & 0 deletions .bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ any_other_function_with_shell_equals_true:
- subprocess.run
assert_used:
skips:
- tests/*.py
- ./tests/*.py
hardcoded_tmp_directory:
tmp_dirs:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ jobs:
- name: Check typing
run: |
make typing
2 changes: 1 addition & 1 deletion .idea/bootstrap-python-package.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Pytest.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.12
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.14
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
#- id: ruff-format
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ It is configured with all the following features:
* GitHub pages documentation using [mkdocs](https://www.mkdocs.org)

This project doesn't currently use [tox](https://tox.wiki/en/4.11.4/index.html) or other matrix
testing utilities. I prefer to run the tests only against the latest python locally, and run
testing utilities. I prefer to run the tests only against the latest python locally, and run
previous python versions directly in the CI pipeline.

## How to use this repository template to create a new package
Expand All @@ -41,14 +41,16 @@ previous python versions directly in the CI pipeline.
* Owner: The github repository owner (in this case `febus982`)
* Repository name: The github repository name (in this case `bootstrap-python-package`)
* Workflow name: `release.yml`
* Create a GitHub Actions secret named `CODECLIMATE_REPORTER_ID` (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/secrets/actions`)
* Create a GitHub Actions secret named `CODECLIMATE_REPORTER_ID` (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/secrets/actions`)
containing the codeclimate reporter id (you can find it at `https://codeclimate.com/repos/YOUR_REPO_ID/settings/test_reporter`).
If you don't want to use CodeClimate just delete `workflows/python-quality.yml`.
* Update the badges in `README.md`! (check [shields.io](https://shields.io/) for extra badges)
* Setup local development:
* Clone the repository
* Install poetry `pip install poetry`
* Install dev dependencies with `make dev-dependencies`
* (optional) It is strongly recommended to install [pre-commit](https://pre-commit.com/#installation)
and run `pre-commit install` so that formatting and linting are automatically executed during `git commit`.
* Setup GitHub pages (this need local development setup):
* Initialise documentation branch `poetry run mike deploy dev latest --update-aliases --push`
* Configure GitHub Pages to deploy from the `gh-pages` branch (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/pages`)
Expand Down
6 changes: 4 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It is configured with all the following features:
* GitHub pages documentation using [mkdocs](https://www.mkdocs.org)

This project doesn't currently use [tox](https://tox.wiki/en/4.11.4/index.html) or other matrix
testing utilities. I prefer to run the tests only against the latest python locally, and run
testing utilities. I prefer to run the tests only against the latest python locally, and run
previous python versions directly in the CI pipeline.

## How to use this repository template to create a new package
Expand All @@ -28,14 +28,16 @@ previous python versions directly in the CI pipeline.
* Owner: The github repository owner (in this case `febus982`)
* Repository name: The github repository name (in this case `bootstrap-python-package`)
* Workflow name: `release.yml`
* Create a GitHub Actions secret named `CODECLIMATE_REPORTER_ID` (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/secrets/actions`)
* Create a GitHub Actions secret named `CODECLIMATE_REPORTER_ID` (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/secrets/actions`)
containing the codeclimate reporter id (you can find it at `https://codeclimate.com/repos/YOUR_REPO_ID/settings/test_reporter`).
If you don't want to use CodeClimate just delete `workflows/python-quality.yml`.
* Update the badges in `README.md`! (check [shields.io](https://shields.io/) for extra badges)
* Setup local development:
* Clone the repository
* Install poetry `pip install poetry`
* Install dev dependencies with `make dev-dependencies`
* (optional) It is strongly recommended to install [pre-commit](https://pre-commit.com/#installation)
and run `pre-commit install` so that formatting and linting are automatically executed during `git commit`.
* Setup GitHub pages (this need local development setup):
* Initialise documentation branch `poetry run mike deploy dev latest --update-aliases --push`
* Configure GitHub Pages to deploy from the `gh-pages` branch (at URL `https://github.com/GITHUB_NAME_OR_ORGANIZATION/GITHUB_REPOSITORY/settings/pages`)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ bandit = ">=1.7.6"
black = ">=22.10.0"
mkdocs = ">=1.4.3"
mkdocstrings = { version = ">=0.24.0", extras = ["python"] }
mkdocs-gen-files = ">=0.5.0"
mkdocs-material = ">=9.1.16"
mike = ">=2.0.0"
mypy = ">=0.990"
Expand All @@ -56,7 +57,6 @@ pytest-cov = ">=4.0.0"
pytest-factoryboy = ">=2.5.0"
pytest-xdist = ">=3.0.2"
ruff = ">=0.0.263"
mkdocs-gen-files = "^0.5.0"

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand All @@ -76,13 +76,13 @@ concurrency = ["multiprocessing"]
parallel = true

[tool.coverage.report]
fail_under = 100
exclude_also = [
"pragma: no cover",
"pass",
"\\.\\.\\.",
]


[tool.ruff]
select = ["E", "F", "I"]
extend-exclude = ["docs"]
Expand Down

0 comments on commit 046317b

Please sign in to comment.