diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..c38f8521 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,72 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: debug-statements + - id: double-quote-string-fixer + - id: name-tests-test + - id: requirements-txt-fixer +- repo: https://github.com/asottile/setup-cfg-fmt + rev: v1.20.1 + hooks: + - id: setup-cfg-fmt +- repo: https://github.com/asottile/reorder_python_imports + rev: v3.1.0 + hooks: + - id: reorder-python-imports + exclude: ^(pre_commit/resources/|testing/resources/python3_hooks_repo/) + args: [--py37-plus, --add-import, 'from __future__ import annotations'] +- repo: https://github.com/asottile/add-trailing-comma + rev: v2.2.3 + hooks: + - id: add-trailing-comma + args: [--py36-plus] +- repo: https://github.com/asottile/pyupgrade + rev: v2.32.1 + hooks: + - id: pyupgrade + args: [--py37-plus] +- repo: https://github.com/pre-commit/mirrors-autopep8 + rev: v1.6.0 + hooks: + - id: autopep8 +- repo: https://github.com/pycqa/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + additional_dependencies: [flake8-bugbear, flake8-import-order, flake8-print] +- repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + +- repo: https://github.com/asottile/blacken-docs + rev: v1.12.1 + hooks: + - id: blacken-docs +- repo: https://github.com/pycqa/isort + rev: 5.6.4 + hooks: + - id: isort + args: ["--profile", "black"] +- repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: ["-L", "coffea_casa", "tests", "docs/*rst"] +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.942 + hooks: + - id: mypy + name: mypy with Python 3.7 + files: coffea_casa + additional_dependencies: ["dask", "distributed"] + args: ["--python-version=3.7"] + - id: mypy + name: mypy with Python 3.9 + files: coffea_casa + additional_dependencies: ["dask", "distributed"] + args: ["--python-version=3.9"] \ No newline at end of file diff --git a/.readthedocs.yml b/.readthedocs.yml index 4f9b90a4..5d821d74 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,17 +1,18 @@ version: 2 build: - image: latest - -sphinx: - configuration: docs/conf.py - -formats: all + os: ubuntu-22.04 + tools: + python: "3.11" python: - version: 3.8 install: - method: pip path: . extra_requirements: - docs + +sphinx: + configuration: docs/conf.py + +formats: all diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..a77b6d3c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = ["setuptools>=42"] +build-backend = "setuptools.build_meta" + +[tool.black] +target-version = ['py37', 'py38', 'py39'] +include = '\.pyi?$' +exclude = ''' +/( + \.git + | .eggs + | build +)/ +''' + +[tool.mypy] +files = "coffea_casa" +pretty = true +strict = true +strict_equality = true +python_version = "3.7" +disallow_untyped_calls = true +disallow_untyped_defs = true +disallow_incomplete_defs = true +disallow_untyped_decorators = true +check_untyped_defs = true +disallow_any_generics = true +disallow_subclassing_any = true +warn_return_any = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_unused_configs = true +warn_unreachable = true +show_error_codes = true +show_error_context = true +no_implicit_optional = true +ignore_missing_imports = true +enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] + +# pyproject.toml +[tool.pytest.ini_options] +minversion = "6.0" +testpaths = [ + "tests",] +log_cli_level = "INFO" +xfail_strict = true +filterwarnings = ['error'] diff --git a/setup.cfg b/setup.cfg index c8dc700e..c38333f6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,8 @@ ignore = E741, # Too long lines (still not ready for it) E501 +# extend-ignore uses flake8's default ignore list, and adds to it +extend-ignore = E203, E501 max-line-length = 120 [versioneer]