Skip to content

Commit

Permalink
Merge pull request #60 from rstcheck/update-tooling
Browse files Browse the repository at this point in the history
Update tooling
  • Loading branch information
Cielquan committed Sep 9, 2023
2 parents 4c223df + 9d4a7b5 commit cf047e4
Show file tree
Hide file tree
Showing 35 changed files with 815 additions and 621 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev"]
steps:
- uses: actions/checkout@v3

Expand All @@ -51,5 +51,16 @@ jobs:
- name: Install tox via pipx
run: pipx install tox

- name: Run tests via tox
run: tox -m py${{ matrix.python-version }}
- name: Run tests via tox (linux/macos)
if: runner.os != 'Windows'
run: |
major=$(python -c "import sys;print(sys.version_info[0])")
minor=$(python -c "import sys;print(sys.version_info[1])")
tox -m py${major}.${minor}
- name: Run tests via tox (windows)
if: runner.os == 'Windows'
run: |
$major = python -c "import sys;print(sys.version_info[0])"
$minor = python -c "import sys;print(sys.version_info[1])"
tox -m py${major}.${minor}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Pipfile.lock
*.bak.*
objects.*.txt
.coverage_cache/
.ruff_cache/
.flakeheaven_cache/
__version__.py
51 changes: 17 additions & 34 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ minimum_pre_commit_version: "2.17"
default_stages: [commit]

ci:
skip: [mypy, pylint, flakeheaven]
skip: [mypy]

repos:
# ----------------------------------------------
Expand Down Expand Up @@ -40,22 +40,17 @@ repos:
# Python
# ----------------------------------------------

# pyupgrade - upgrade old syntax to new
- repo: https://github.com/asottile/pyupgrade
rev: b3e813e5d60a472ba815a45d107bbdf106405973 # frozen: v3.10.1
# ruff - python linter with fixing ability
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 47023bed2b253176c10ba0f760c85e952e52e5fd # frozen: v0.0.287
hooks:
- id: pyupgrade
args: ["--py37-plus"]

# isort - sort imports
- repo: https://github.com/PyCQA/isort
rev: dbf82f2dd09ae41d9355bcd7ab69187a19e6bf2f # frozen: 5.12.0
hooks:
- id: isort
- id: ruff
name: ruff (fix)
args: ["--fix-only", "--exit-non-zero-on-fix", "--config=pyproject.toml"]

# black - python formatter
- repo: https://github.com/psf/black
rev: 193ee766ca496871f93621d6b58d57a6564ff81b # frozen: 23.7.0
rev: b70b2c619671f0c6adc722742181bd2fa6e2a2f4 # frozen: 23.9.0
hooks:
- id: black
args: ["--safe"]
Expand All @@ -73,7 +68,7 @@ repos:

# prettier - multi formatter
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 672abe14d309fc28817d45b6be25ea976a92222a # frozen: v3.0.2
rev: fc260393cc4ec09f8fc0a5ba4437f481c8b55dc1 # frozen: v3.0.3
hooks:
- id: prettier

Expand Down Expand Up @@ -143,6 +138,14 @@ repos:
# Python
# ----------------------------------------------

# ruff - python linter with fixing ability
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 47023bed2b253176c10ba0f760c85e952e52e5fd # frozen: v0.0.287
hooks:
- id: ruff
name: ruff (lint)
args: ["--config=pyproject.toml"]

# python specific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0
Expand All @@ -151,7 +154,6 @@ repos:
- id: fix-encoding-pragma
args: ["--remove"]
- id: name-tests-test
args: ["--django"]

# several python code regex hooks
- repo: https://github.com/pre-commit/pygrep-hooks
Expand All @@ -163,15 +165,6 @@ repos:
- id: python-no-eval
- id: python-no-log-warn

# flakeheaven - wrapper for flake8
- repo: https://github.com/flakeheaven/flakeheaven
rev: 289c489c9654342dae2ad871527c5951acb2f22d # frozen: 3.3.0
hooks:
- id: flakeheaven
types: [python]
additional_dependencies:
- "git+https://github.com/cielquan/my-flake8-plugins.git@v1.5.0"

# Lint hooks managed via tox envs b/c they need the pkg installed
- repo: local
hooks:
Expand All @@ -186,16 +179,6 @@ repos:
types: [python]
pass_filenames: false
require_serial: true
# pylint - python linter
- id: pylint
name: pylint
description: run pylint over the installed package via tox
entry: tox
args: ["-e", "pylint", "--"]
language: python
additional_dependencies: [tox]
types: [python]
require_serial: true

# ----------------------------------------------
# Shell script
Expand Down
5 changes: 2 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ formats:
- htmlzip

python:
version: "3.8"
system_packages: false
version: "3.11"
install:
- method: pip
path: .
Expand All @@ -18,5 +17,5 @@ python:

sphinx:
configuration: docs/source/conf.py
fail_on_warning: true
fail_on_warning: false
builder: dirhtml
2 changes: 1 addition & 1 deletion .rstcheck.project.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ignore_directives =
automodule,
click,
mdinclude,
spelling,
spelling:word-list,
ignore_roles =
issue,
ignore_messages=Hyperlink target "skipping-code-blocks" is not referenced
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ NOTE: please use them in this order.

- Auto discover pyproject.toml file on py311 and up

### Documentation

- Update inv file for pydantic links ([#60](https://github.com/rstcheck/rstcheck-core/pull/60))

### Miscellaneous

- Ignore "no newline at end of file" errors when C++ code is checked by clang (such as on macOS) ([#45](https://github.com/rstcheck/rstcheck-core/pull/45))
Expand All @@ -32,6 +36,10 @@ NOTE: please use them in this order.
- Add basic pydantic v2 support ([#53](https://github.com/rstcheck/rstcheck-core/pull/53))
- Update Sphinx Theme Version and remove outdated Dark Mode Lib ([#51](https://github.com/rstcheck/rstcheck-core/pull/51))
- Switch from poetry to setuptools ([#59](https://github.com/rstcheck/rstcheck-core/pull/59))
- Change test file naming convention ([#60](https://github.com/rstcheck/rstcheck-core/pull/60))
- Change dev tooling ([#60](https://github.com/rstcheck/rstcheck-core/pull/60))
- Drop pydantic v1 support ([#60](https://github.com/rstcheck/rstcheck-core/pull/60))
- Add python 3.12 to CI ([#60](https://github.com/rstcheck/rstcheck-core/pull/60))

## [1.0.3 (2022-11-12)](https://github.com/rstcheck/rstcheck-core/releases/v1.0.3)

Expand Down
2 changes: 1 addition & 1 deletion docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
API
===

.. spelling::
.. spelling:word-list::
apidoc
autoapidoc
Expand Down
40 changes: 21 additions & 19 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
"""Configuration file for the Sphinx documentation builder."""
# pylint: disable=C0103
from __future__ import annotations

import datetime
import os
import re
import shutil
import typing as t
from datetime import date
from importlib.util import find_spec
from pathlib import Path

import sphinx.ext.autodoc
import sphinx_rtd_theme # type: ignore[import]
from sphinx.application import Sphinx

if t.TYPE_CHECKING:
import sphinx.ext.autodoc
from sphinx.application import Sphinx

try:
from importlib.metadata import metadata # pylint: disable=ungrouped-imports
from importlib.metadata import metadata
except ModuleNotFoundError: # pragma: py-gte-38
from importlib_metadata import metadata # type: ignore[import,no-redef]

Expand All @@ -31,10 +33,10 @@
author = "Steven Myint <git@stevenmyint.com>"
GH_REPO_LINK = "https://github.com/rstcheck/rstcheck-core"
CREATION_YEAR = 2013
CURRENT_YEAR = f"{date.today().year}"
copyright = ( # noqa: VNE003 # pylint: disable=W0622
CURRENT_YEAR = f"{datetime.datetime.now(tz=datetime.UTC).date().year}"
copyright = ( # noqa: A001
f"{CREATION_YEAR}{('-' + CURRENT_YEAR) if CURRENT_YEAR != CREATION_YEAR else ''}, "
+ f"{author} and AUTHORS"
f"{author} and AUTHORS"
)
RSTCHECK_CORE_VERSION = metadata(project)["Version"]
release = RSTCHECK_CORE_VERSION #: The full version, including alpha/beta/rc tags
Expand All @@ -46,9 +48,9 @@


#: -- GENERAL CONFIG -------------------------------------------------------------------
extensions: t.List[str] = []
extensions: list[str] = []
today_fmt = "%Y-%m-%d"
exclude_patterns: t.List[str] = [] #: Files to exclude for source of doc
exclude_patterns: list[str] = [] #: Files to exclude for source of doc

#: Added dirs for static and template files if they exist
html_static_path = ["_static"] if Path("_static").exists() else []
Expand Down Expand Up @@ -106,7 +108,7 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"pattern": ("https://docs.python.org/3/library/", "objects.pattern.inv"),
"pydantic": ("https://pydantic-docs.helpmanual.io/usage/", "objects.pydantic.inv"),
"pydantic": ("https://docs.pydantic.dev/latest/usage/", "objects.pydantic.inv"),
"sphinx": ("https://www.sphinx-doc.org/en/master/extdev/", "objects.sphinx.inv"),
}

Expand Down Expand Up @@ -143,17 +145,17 @@
extensions.append("sphinx.ext.autodoc")
autodoc_typehints = "description"
autodoc_member_order = "bysource"
autodoc_mock_imports: t.List[str] = []
autodoc_mock_imports: list[str] = []
autodoc_default_options = {"members": True}


def _remove_module_docstring( # pylint: disable=R0913
app: Sphinx, # pylint: disable=W0613
def _remove_module_docstring(
app: Sphinx, # noqa: ARG001
what: str,
name: str, # pylint: disable=W0613
obj: t.Any, # pylint: disable=W0613 # noqa: ANN401
options: sphinx.ext.autodoc.Options, # pylint: disable=W0613
lines: t.List[str],
name: str, # noqa: ARG001
obj: t.Any, # noqa: ANN401,ARG001
options: sphinx.ext.autodoc.Options, # noqa: ARG001
lines: list[str],
) -> None:
"""Remove module docstring."""
if what == "module":
Expand Down Expand Up @@ -199,4 +201,4 @@ def setup(app: Sphinx) -> None:


for msg in NOT_LOADED_MSGS:
print(msg)
print(msg) # noqa: T201
Binary file modified docs/source/objects.pydantic.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/source/workflows/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ This will run:
Different environment lists are available and can be selected with ``tox -m <ENVLIST>``:

- test: run full test suite with ``pytest`` and report coverage.
- py3.7 - py3.10 run full test suite with specific python version and report coverage.
- py`X`.`Y` run full test suite with specific python version and report coverage.
- docs: run all documentation tests.


Expand Down

0 comments on commit cf047e4

Please sign in to comment.