Skip to content

Commit

Permalink
ci/lint: update & simplify & bump py3.8 (#48)
Browse files Browse the repository at this point in the history
* ci/lint: update & simplify
* min py3.8
* pyproject fixed

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Borda and pre-commit-ci[bot] authored Apr 6, 2024
1 parent 3e4fbae commit 95b8760
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.7", "3.11"]
python-version: ["3.8", "3.11"]
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 10
steps:
Expand Down
40 changes: 17 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@ repos:
- id: check-docstring-first
- id: detect-private-key

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
args: ["--py37-plus"]
name: Upgrade code

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
files: \.(html|yml|yaml|toml)
# https://prettier.io/docs/en/options.html#print-width
args: ["--print-width=120"]

Expand All @@ -50,12 +44,6 @@ repos:
additional_dependencies: [tomli]
args: [--in-place]

- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
name: Format code

#- repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.991
# hooks:
Expand All @@ -71,17 +59,23 @@ repos:
- mdformat-black
- mdformat_frontmatter

- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
additional_dependencies:
- pep8-naming
- flake8-pytest-style
- flake8-bandit

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.3.5
hooks:
# try to fix what is possible
- id: ruff
args: ["--fix"]
# perform formatting updates
- id: ruff-format
# validate if all is fine with preview mode
- id: ruff

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
hooks:
- id: pyproject-fmt
additional_dependencies: [tox]
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
hooks:
- id: validate-pyproject
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

141 changes: 63 additions & 78 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,84 +1,32 @@
[metadata]
license_file = "LICENSE"
description-file = "README.md"

[build-system]
requires = [
"setuptools",
"wheel",
]


[tool.check-manifest]
ignore = [
"*.yml",
".github",
".github/*"
]


[tool.pytest.ini_options]
norecursedirs = [
".git",
".github",
"dist",
"build",
"docs",
"setuptools",
"wheel",
]
addopts = [
"--strict-markers",
"--doctest-modules",
"--color=yes",
"--disable-pytest-warnings",
]
#filterwarnings = ["error::FutureWarning"]
xfail_strict = true
junit_duration_report = "call"

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"pass",
]
[tool.coverage.run]
parallel = true
relative_files = true


[tool.codespell]
#skip = '*.py'
quiet-level = 3
# comma separated list of words; waiting for:
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
# also adding links until they ignored by its: nature
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
#ignore-words-list = ""


[tool.docformatter]
recursive = true
# this need to be shorter as some docstings are r"""...
wrap-summaries = 119
wrap-descriptions = 120
blank = true


[tool.black]
# https://github.com/psf/black
line-length = 120
exclude = "(.eggs|.git|.hg|.mypy_cache|.venv|_build|buck-out|build|dist)"


[tool.ruff]
target-version = "py38"
line-length = 120
# Enable Pyflakes `E` and `F` codes by default.
# Exclude a variety of commonly ignored directories.
exclude = [
"docs"
]

[tool.ruff.lint]
select = [
"E", "W", # see: https://pypi.org/project/pycodestyle
"F", # see: https://pypi.org/project/pyflakes
"I", # isort
"D", # see: https://pypi.org/project/pydocstyle
"N", # see: https://pypi.org/project/pep8-naming
"S", # see: https://pypi.org/project/flake8-bandit
"RUF018", # see: https://docs.astral.sh/ruff/rules/assignment-in-assert
"UP", # see: https://docs.astral.sh/ruff/rules/#pyupgrade-up
]
extend-select = [
"C4", # see: https://pypi.org/project/flake8-comprehensions
Expand All @@ -88,35 +36,72 @@ extend-select = [
"YTT", # see: https://pypi.org/project/flake8-2020
"ANN", # see: https://pypi.org/project/flake8-annotations
]
# Exclude a variety of commonly ignored directories.
exclude = [
".eggs",
".git",
".mypy_cache",
".ruff_cache",
"__pypackages__",
"_build",
"build",
"dist",
"docs"
]
ignore-init-module-imports = true
unfixable = ["F401"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"setup.py" = ["ANN202", "ANN401"]
"src/**" = ["ANN401"]
"tests/**" = [
"D100", "D101", "D103", "D107", "S101", "ANN101", "ANN401"
]
[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.codespell]
#skip = '*.py'
quiet-level = 3
# comma separated list of words; waiting for:
# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603
# also adding links until they ignored by its: nature
# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960
#ignore-words-list = ""

[tool.docformatter]
recursive = true
# this need to be shorter as some docstings are r"""...
wrap-summaries = 119
wrap-descriptions = 120
blank = true

[tool.check-manifest]
ignore = [
"*.yml",
".github",
".github/*"
]

[tool.pytest.ini_options]
norecursedirs = [
".git",
".github",
"dist",
"build",
"docs",
]
addopts = [
"--strict-markers",
"--doctest-modules",
"--color=yes",
"--disable-pytest-warnings",
]
#filterwarnings = ["error::FutureWarning"]
xfail_strict = true
junit_duration_report = "call"

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"pass",
]
[tool.coverage.run]
parallel = true
relative_files = true

[tool.mypy]
files = ["deprecate"]
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Copyright (C) 2020-2023 Jiri Borovec <...>."""

import os
from importlib.util import module_from_spec, spec_from_file_location

Expand Down Expand Up @@ -50,7 +51,7 @@ def _load_long_description(path_dir: str, version: str) -> str:
include_package_data=True,
zip_safe=False,
keywords=["python", "development", "deprecation"],
python_requires=">=3.6",
python_requires=">=3.8",
setup_requires=[],
install_requires=[],
project_urls={"Source Code": ABOUT.__source_code__, "Home page": ABOUT.__homepage__},
Expand All @@ -68,7 +69,6 @@ def _load_long_description(path_dir: str, version: str) -> str:
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down

0 comments on commit 95b8760

Please sign in to comment.