Skip to content

Commit

Permalink
Update linting and test environments (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Dec 7, 2022
1 parent 0e0d6c4 commit bfc06c8
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 42 deletions.
6 changes: 0 additions & 6 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11.0-beta.4 - 3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand All @@ -35,7 +35,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: pip install --upgrade --pre hatch
run: pip install --upgrade hatch

- if: matrix.python-version == '3.9' && runner.os == 'Linux'
name: Lint
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| --- | --- |
| CI/CD | [![CI - Test](https://github.com/ofek/hatch-mypyc/actions/workflows/test.yml/badge.svg)](https://github.com/ofek/hatch-mypyc/actions/workflows/test.yml) [![CD - Build](https://github.com/ofek/hatch-mypyc/actions/workflows/build.yml/badge.svg)](https://github.com/ofek/hatch-mypyc/actions/workflows/build.yml) |
| Package | [![PyPI - Version](https://img.shields.io/pypi/v/hatch-mypyc.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/hatch-mypyc/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-mypyc.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/hatch-mypyc/) |
| Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/ambv/black) [![imports - isort](https://img.shields.io/badge/imports-isort-ef8336.svg)](https://github.com/pycqa/isort) [![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/) [![GitHub Sponsors](https://img.shields.io/github/sponsors/ofek?logo=GitHub%20Sponsors&style=social)](https://github.com/sponsors/ofek) |
| Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/ambv/black) [![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/) [![GitHub Sponsors](https://img.shields.io/github/sponsors/ofek?logo=GitHub%20Sponsors&style=social)](https://github.com/sponsors/ofek) |

-----

Expand Down
32 changes: 19 additions & 13 deletions hatch.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
[envs.default]
dependencies = [
"coverage[toml]>=6.2",
"coverage[toml]>=6.5",
"pytest",
"pytest-cov",
"pytest-mock",
"packaging",
"build[virtualenv]",
]
[envs.default.scripts]
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=hatch_mypyc --cov=tests {args:tests}"
no-cov = "pytest --no-cov {args:tests}"
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
cov-report = [
"- coverage combine",
"coverage report --show-missing",
]
cov = [
"test-cov",
"cov-report",
]

[[envs.all.matrix]]
python = ["3.7", "3.8", "3.9", "3.10", "3.11"]

[envs.lint]
detached = true
dependencies = [
"flake8>=4.0.1",
"flake8-bugbear>=22.3.23",
"flake8-quotes>=3.3.1",
"black>=22.3.0",
"isort>=5.10.1",
"mypy>=0.942",
"black>=22.10.0",
"mypy>=0.991",
"ruff>=0.0.166",
]
[envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:hatch_mypyc tests}"
style = [
"flake8 {args:.}",
"ruff {args:.}",
"black --check --diff {args:.}",
"isort --check-only --diff {args:.}",
]
fmt = [
"isort {args:.}",
"black {args:.}",
"ruff --fix {args:.}",
"style",
]
all = [
Expand Down
2 changes: 1 addition & 1 deletion hatch_mypyc/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT
from hatchling.plugin import hookimpl

from .plugin import MypycBuildHook
from hatch_mypyc.plugin import MypycBuildHook


@hookimpl
Expand Down
2 changes: 1 addition & 1 deletion hatch_mypyc/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pathspec
from hatchling.builders.hooks.plugin.interface import BuildHookInterface

from .utils import construct_setup_file, installed_in_prefix
from hatch_mypyc.utils import construct_setup_file, installed_in_prefix


class MypycBuildHook(BuildHookInterface):
Expand Down
8 changes: 0 additions & 8 deletions mypy.ini

This file was deleted.

72 changes: 62 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,79 @@ mypyc = "hatch_mypyc.hooks"
path = "hatch_mypyc/__about__.py"

[tool.black]
include = '\.pyi?$'
target-version = ["py37"]
line-length = 120
skip-string-normalization = true
target-version = ["py37"]

[tool.isort]
default_section = "THIRDPARTY"
force_grid_wrap = 0
include_trailing_comma = true
known_first_party = ["hatch_mypyc"]
line_length = 120
multi_line_output = 3
use_parentheses = true
[tool.ruff]
target-version = "py37"
line-length = 120
select = [
"A",
"B",
"C",
"E",
"F",
"FBT",
"I",
"N",
"Q",
"RUF",
"S",
"T",
"UP",
"W",
"YTT",
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Ignore McCabe complexity
"C901",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105", "S106", "S107",
]
unfixable = [
# Don't touch unused imports
"F401",
]

[tool.ruff.isort]
known-first-party = ["hatch_mypyc"]

[tool.ruff.flake8-quotes]
inline-quotes = "single"

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
# Tests can use relative imports and assertions
"tests/**/*" = ["I252", "S101"]

[tool.mypy]
disallow_untyped_defs = false
follow_imports = "normal"
ignore_missing_imports = true
pretty = true
show_column_numbers = true
warn_no_return = false
warn_unused_ignores = true

[tool.coverage.run]
source_pkgs = ["hatch_mypyc", "tests"]
branch = true
parallel = true
omit = [
"hatch_mypyc/__about__.py",
]

[tool.coverage.paths]
hatch_mypyc = ["hatch_mypyc", "*/hatch-mypyc/hatch_mypyc"]
tests = ["tests", "*/hatch-mypyc/tests"]

[tool.coverage.report]
exclude_lines = [
"no cov",
Expand Down

0 comments on commit bfc06c8

Please sign in to comment.