Skip to content

Commit

Permalink
Bump deps and tools (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Apr 19, 2023
1 parent c3bf68b commit ff8ab27
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 44 deletions.
1 change: 0 additions & 1 deletion .github/workflows/check.yml
Expand Up @@ -21,7 +21,6 @@ jobs:
- "3.10"
- "3.9"
- "3.8"
- "3.7"
steps:
- name: Setup python for tox
uses: actions/setup-python@v4
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Expand Up @@ -15,7 +15,7 @@ repos:
rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
args: ["--py38-plus"]
exclude: "^(tests/roots/test-dummy/dummy_module.py)$"
- id: pyupgrade
files: "^(tests/roots/test-dummy/dummy_module.py)$"
Expand All @@ -25,21 +25,21 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
args: [--safe]
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.1]
additional_dependencies: [black==23.3]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "0.6.1"
rev: "1.3.0"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
Expand All @@ -48,8 +48,8 @@ repos:
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==23.3.12
- flake8-comprehensions==3.11.1
- flake8-bugbear==23.3.23
- flake8-comprehensions==3.12
- flake8-pytest-style==1.7.2
- flake8-spellcheck==0.28
- flake8-unused-arguments==0.0.13
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Expand Up @@ -2,7 +2,7 @@
build-backend = "hatchling.build"
requires = [
"hatch-vcs>=0.3",
"hatchling>=1.13",
"hatchling>=1.14",
]

[project]
Expand All @@ -19,7 +19,7 @@ keywords = [
license = "MIT"
maintainers = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }]
authors = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }]
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Sphinx :: Extension",
Expand All @@ -34,19 +34,19 @@ dynamic = [
"version",
]
dependencies = [
"Sphinx>=5.3",
"Sphinx>=6.1.3",
]
optional-dependencies.docs = [
"furo>=2022.12.7",
"furo>=2023.3.27",
"sphinx>=6.1.3",
"sphinx-autodoc-typehints>=1.23.4",
]
optional-dependencies.testing = [
"covdefaults>=2.2.2",
"coverage>=7.2.2",
"covdefaults>=2.3",
"coverage>=7.2.3",
"diff-cover>=7.5",
"nptyping>=2.5",
"pytest>=7.2.2",
"pytest>=7.3.1",
"pytest-cov>=4",
"sphobjinv>=2.3.1",
"typing-extensions>=4.5",
Expand Down
10 changes: 2 additions & 8 deletions src/sphinx_autodoc_typehints/__init__.py
Expand Up @@ -406,15 +406,9 @@ def _get_type_hint(autodoc_mock_imports: list[str], name: str, obj: Any) -> dict

def backfill_type_hints(obj: Any, name: str) -> dict[str, Any]:
parse_kwargs = {}
if sys.version_info < (3, 8):
try:
import typed_ast.ast3 as ast
except ImportError:
return {}
else:
import ast
import ast

parse_kwargs = {"type_comments": True}
parse_kwargs = {"type_comments": True}

def _one_child(module: Module) -> stmt | None:
children = module.body # use the body to ignore type comments
Expand Down
2 changes: 1 addition & 1 deletion src/sphinx_autodoc_typehints/patches.py
Expand Up @@ -12,7 +12,7 @@
from .attributes_patch import patch_attribute_handling


@lru_cache() # A cute way to make sure the function only runs once.
@lru_cache # A cute way to make sure the function only runs once.
def fix_autodoc_typehints_for_overloaded_methods() -> None:
"""
sphinx-autodoc-typehints responds to the "autodoc-process-signature" event
Expand Down
42 changes: 21 additions & 21 deletions tox.ini
@@ -1,5 +1,7 @@
[tox]
envlist =
requires =
tox>=4.2
env_list =
fix
py311
py310
Expand All @@ -9,62 +11,60 @@ envlist =
type
coverage
readme
isolated_build = true
skip_missing_interpreters = true
minversion = 3.21

[testenv]
description = run tests with {basepython}
passenv =
PIP_*
PYTEST_*
setenv =
COVERAGE_FILE = {toxworkdir}{/}.coverage.{envname}
package = wheel
wheel_build_env = .pkg
extras =
testing
type-comment
pass_env =
PIP_*
PYTEST_*
set_env =
COVERAGE_FILE = {toxworkdir}{/}.coverage.{envname}
commands =
pytest {tty:--color=yes} {posargs: \
--junitxml {toxworkdir}{/}junit.{envname}.xml --cov {envsitepackagesdir}{/}sphinx_autodoc_typehints --cov {toxinidir}{/}tests \
--cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \
--cov-report html:{envtmpdir}{/}htmlcov --cov-report xml:{toxworkdir}{/}coverage.{envname}.xml \
tests}
diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}{/}coverage.{envname}.xml
package = wheel
wheel_build_env = .pkg

[testenv:fix]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
skip_install = true
deps =
pre-commit>=3.2
pre-commit>=3.2.2
commands =
pre-commit run --all-files --show-diff-on-failure

[testenv:type]
description = run type check on code base
setenv =
{tty:MYPY_FORCE_COLOR = 1}
deps =
mypy==1.1.1
types-docutils>=0.19.1.6
mypy==1.2
types-docutils>=0.19.1.7
set_env =
{tty:MYPY_FORCE_COLOR = 1}
commands =
mypy --python-version 3.10 src
mypy --python-version 3.10 tests

[testenv:coverage]
description = combine coverage files and generate diff (against DIFF_AGAINST defaulting to origin/main)
passenv =
DIFF_AGAINST
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage
skip_install = true
deps =
covdefaults>=2.3
coverage>=7.2.2
coverage>=7.2.3
diff-cover>=7.5
extras =
parallel_show_output = true
pass_env =
DIFF_AGAINST
set_env =
COVERAGE_FILE = {toxworkdir}/.coverage
commands =
coverage combine
coverage report --skip-covered --show-missing
Expand All @@ -91,7 +91,7 @@ commands =

[testenv:dev]
description = generate a DEV environment
usedevelop = true
package = editable
commands =
python -m pip list --format=columns
python -c 'import sys; print(sys.executable)'
Expand Down

0 comments on commit ff8ab27

Please sign in to comment.