Skip to content

Commit

Permalink
Use hatchling, ruff and add 3.12 support
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Jun 11, 2023
1 parent a5227e3 commit b545423
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 183 deletions.
1 change: 0 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ jobs:
run: tox -vv --notest -e ${{ matrix.tox_env }}
- name: Run test suite
run: tox --skip-pkg-install -e ${{ matrix.tox_env }}

59 changes: 9 additions & 50 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,33 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.272"
hooks:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
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.3]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.3.0"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.11.2"
hooks:
- id: flake8
additional_dependencies:
- 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
- flake8-noqa==1.3.1
- pep8-naming==0.13.3
- flake8-pyproject==1.2.3
- id: pyproject-fmt
additional_dependencies: ["tox>=4.6"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
rev: "v3.0.0-alpha.9-for-vscode"
hooks:
- id: prettier
additional_dependencies:
- prettier@2.7.1
- "@prettier/plugin-xml@2.2"
args: ["--print-width=120", "--prose-wrap=always"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
hooks:
- id: markdownlint
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.9.2"
hooks:
- id: pyproject-fmt
17 changes: 0 additions & 17 deletions CHANGELOG.md

This file was deleted.

17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,22 @@ Add `[gh]` section to the same file as tox configuration. If you're using `tox.i
```ini
[gh]
python =
3.6 = py36
3.7 = py37
3.12 = py312
3.11 = py311, type
3.10 = py310
3.9 = py39
3.8 = py38
3.9 = py39, type
3.7 = py37
```

This will run different set of tox environments on different python versions set up via GitHub `setup-python` action:

- on Python 3.6 job, tox runs `py36` environment,
- on Python 3.7 job, tox runs `py37` environment,
- on Python 3.8 job, tox runs `py38` environment,
- in Python 3.9 job, tox runs `py39` and `type` environments.
- on Python 3.9 job, tox runs `py39` environment,
- on Python 3.10 job, tox runs `py310` environment,
- in Python 3.11 job, tox runs `py311` and `type` environments,
- on Python 3.12 job, tox runs `py312` environment.

#### Workflow Configuration

Expand All @@ -66,11 +70,12 @@ jobs:
- Windows
- MacOs
py:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7"
- "3.6"
steps:
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v2
Expand Down
110 changes: 90 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,101 @@
[build-system]
build-backend = 'setuptools.build_meta'
build-backend = "hatchling.build"
requires = [
"setuptools>=67.6.1",
"setuptools-scm>=7.1",
"hatch-vcs>=0.3",
"hatchling>=1.17.1",
]

[tool.setuptools_scm]
write_to = "src/tox_gh/version.py"
[project]
name = "tox-gh"
description = "Seamless integration of tox into GitHub Actions."
readme = "README.md"
keywords = [
"environments",
"isolated",
"testing",
"virtual",
]
license = "MIT"
maintainers = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }]
requires-python = ">=3.7"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet",
"Topic :: Software Development :: Libraries",
"Topic :: System",
]
dynamic = [
"version",
]
dependencies = [
"tox>=4.6",
]
optional-dependencies.test = [
"covdefaults>=2.3",
"devpi-process>=0.3",
"pytest>=7.3.2",
"pytest-cov>=4.1",
"pytest-mock>=3.10",
]
urls.Documentation = "https://github.com/tox-dev/tox-gh#tox-gh"
urls.Homepage = "https://github.com/tox-dev/tox-gh"
urls.Source = "https://github.com/tox-dev/tox-gh"
urls.Tracker = "https://github.com/tox-dev/tox-gh/issues"
entry-points.tox = {"tox-gh"="tox_gh.plugin"}

[tool.hatch]
build.hooks.vcs.version-file = "src/tox_gh/version.py"
build.targets.sdist.include = ["/src", "/tests"]
version.source = "vcs"

[tool.black]
line-length = 120

[tool.isort]
line_length = 120
profile = "black"
known_first_party = ["tox_gh"]

[tool.flake8]
max-complexity = 22
max-line-length = 120
unused-arguments-ignore-abstract-functions = true
noqa-require-code = true
dictionaries = ["en_US", "python", "technical", "django"]

[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.coverage]
html.show_contexts = true
html.skip_covered = false
paths.source = ["src", ".tox/*/lib/*/site-packages", ".tox\\*\\Lib\\site-packages", "**/src", "**\\src"]
paths.other = [".", "*/tox_gh", "*\\tox_gh"]
report.fail_under = 96
run.parallel = true
run.plugins = ["covdefaults"]

[tool.mypy]
python_version = "3.9"
python_version = "3.11"
show_error_codes = true
strict = true

[tool.ruff]
select = ["ALL"]
line-length = 120
target-version = "py37"
isort = {known-first-party = ["platformdirs", "tests"], required-imports = ["from __future__ import annotations"]}
ignore = [
"ANN101", # Missing type annotation for `self` in method
"D301", # Use `r"""` if any backslashes in a docstring
"D205", # 1 blank line required between summary line and description
"D401", # First line of docstring should be in imperative mood
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"S104", # Possible binding to all interface
]
[tool.ruff.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"FBT", # don"t care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"D", # don"t care about documentation in tests
"S603", # `subprocess` call: check for execution of untrusted input
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
]
59 changes: 0 additions & 59 deletions setup.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions src/tox_gh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""GitHub Actions integration."""
from __future__ import annotations

from .version import version as __version__
Expand Down
Loading

0 comments on commit b545423

Please sign in to comment.