Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ci:
autofix_prs: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
hooks:
# https://github.com/pre-commit/pre-commit-hooks/issues/718
# - id: check-added-large-files # Fails with git v1.8.3
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
args: [--allow-multiple-documents]
- id: debug-statements
- id: end-of-file-fixer
- id: file-contents-sorter
files: (requirements.txt)$
- id: mixed-line-ending
- id: trailing-whitespace


- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.8.0"
hooks:
- id: mypy
additional_dependencies:
- types-pkg_resources
70 changes: 66 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ build-backend = "setuptools.build_meta"
name = "pyaps3"
description = "Python based Atmospheric Phase Screen estimation"
authors = [
{name="Romain Jolivet", email="insar@geologie.ens.fr"},
{name="Angelique Benoit"},
{ name = "Romain Jolivet", email = "insar@geologie.ens.fr" },
{ name = "Angelique Benoit" },
]
readme = "README.md"
requires-python = ">=3.8"
keywords = ["InSAR", "troposphere", "geodesy", "geophysics", "ERA5"]
license = {text = "GPL-3.0-or-later"}
classifiers=[
license = { text = "GPL-3.0-or-later" }
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
Expand Down Expand Up @@ -50,3 +50,65 @@ pyaps3 = ["*.cfg"]
[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "no-local-version"


[tool.ruff]
src = ["src"] # For known-first-party imports
unsafe-fixes = true

[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # pycodestyle (errors)
"W", # pycodestyle (warnings)
# "EM", # flake8-errmsg
"EXE", # flake8-executable
"F", # Pyflakes
"I", # isort
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # Pylint
# "PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"TRY", # tryceratops
# "UP", # pyupgrade <- not working with Pydantic lower python versions
"YTT", # flake8-2020
]

ignore = [
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"N803", # Argument name should be lowercase
"N806", # Variable _ in function should be lowercase
"PIE796", # Non-unique values are redundant and likely a mistake.
"PLR", # Pylint Refactor
"PTH123", # `open()` should be replaced by `Path.open()`
"PTH207", # "Replace `glob` with `Path.glob` or `Path.rglob`
"ISC001", # The following rules may cause conflicts when used with the formatter
"TRY003", # Avoid specifying long messages outside the exception
]

[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = ["F403"]
"tests/**" = ["D", "N", "PTH"]

[tool.ruff.lint.flake8-unused-arguments]
# Whether to allow unused variadic arguments, like *args and **kwargs.
ignore-variadic-names = true


[tool.mypy]
python_version = "3.10"
ignore_missing_imports = true
Loading