From 09a3f5cc37680a5db751f3680cb2fddfed92c012 Mon Sep 17 00:00:00 2001 From: Matt Craig Date: Mon, 12 Aug 2024 08:34:52 -0500 Subject: [PATCH] Add pre-commit dependency and draft configuration --- .pre-commit-config.yaml | 24 ++++++++++++++++++++++++ pyproject.toml | 6 ++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..3570308c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +exclude: '^/ccdproc/extern/.*.py|.*\.fits?$' + # ^/ccdproc/extern/.*.py # Ignore files in the extern directory + # | .*\.fits?$ # Ignore FITS files +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-added-large-files + + + # Using this mirror lets us use mypyc-compiled black, which is about 2x faster + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.8.0 + 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 + extend-exclude: '^/ccdproc/extern/.*.py|.*\.fits?$' diff --git a/pyproject.toml b/pyproject.toml index 1fd50086..0d1180a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ docs = [ test = [ "black", "memory_profiler", + "pre-commit", "pytest-astropy>=0.10.0", ] @@ -51,14 +52,15 @@ include = [ [tool.black] line-length = 88 -target-version = ['py310', 'py311'] +target-version = ['py310', 'py311', 'py312'] include = '\.pyi?$|\.ipynb$' # 'extend-exclude' excludes files or directories in addition to the defaults extend-exclude = ''' # A regex preceded with ^/ will apply only to files and directories # in the root of the project. ( - ^/ccdproc/extern + ^/ccdproc/extern/.*.py # Ignore files in the extern directory + | .*\.fits?$ # Ignore FITS files ) '''