Skip to content

Commit

Permalink
Clean up lint handling (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 5, 2023
1 parent 6e95791 commit 9597e47
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Run Linters
run: |
hatch run typing:test
hatch run lint:style
hatch run lint:build
pipx run interrogate .
pipx run doc8 --max-line-length=200
Expand All @@ -32,14 +32,16 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.12"]
include:
- os: windows-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "pypy-3.8"
python-version: "pypy-3.9"
- os: macos-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.11"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.6.1"
hooks:
- id: mypy
files: "^jupyter_server_terminals"
stages: [manual]
args: ["--install-types", "--non-interactive"]
additional_dependencies:
["traitlets>=5.13", "jupyter_server>=2.9", "terminado>=0.17.1"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
Expand Down
36 changes: 11 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,37 +79,24 @@ dependencies = ["coverage[toml]", "pytest-cov"]
test = "python -m pytest -vv --cov jupyter_server_terminals --cov-branch --cov-report term-missing:skip-covered {args}"
nowarn = "test -W default {args}"

[tool.hatch.envs.typing]
features = ["test"]
dependencies = ["mypy>=1.6.0", "traitlets>=5.11.1", "jupyter_server>=2.8.0"]
[tool.hatch.envs.typing.scripts]
test = "mypy --install-types --non-interactive {args}"

[tool.hatch.envs.lint]
dependencies = [
"mdformat>0.7",
"mdformat-gfm>=0.3.5",
"ruff==0.1.3"
]
detached = true
dependencies = ["pre-commit"]
[tool.hatch.envs.lint.scripts]
style = [
"ruff {args:.}",
"ruff format {args:.}",
"mdformat --check {args:docs *.md}"
]
fmt = [
"ruff --fix {args:.}",
"ruff format {args:.}",
"mdformat {args:docs *.md}"
]
build = "pre-commit run --all-files ruff"

[tool.hatch.envs.typing]
dependencies = [ "pre-commit"]
detached = true
[tool.hatch.envs.typing.scripts]
test = "pre-commit run --all-files --hook-stage manual mypy"

[tool.pytest.ini_options]
minversion = "6.0"
xfail_strict = true
log_cli_level = "info"
addopts = [
"-raXs", "--durations=10", "--color=yes", "--doctest-modules",
"-ra", "--durations=10", "--color=yes", "--doctest-modules",
"--showlocals", "--strict-markers", "--strict-config",
]
testpaths = [
Expand All @@ -124,8 +111,7 @@ filterwarnings = [
"ignore:unclosed <socket.socket:ResourceWarning",
# From juypter core
"module:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning",
# From jupyter_events
"module:jsonschema.RefResolver is deprecated as of:DeprecationWarning",
"module:datetime.datetime.utc:DeprecationWarning",
]

[tool.coverage.run]
Expand Down Expand Up @@ -190,4 +176,4 @@ fail-under=100
exclude = ["tests", "docs"]

[tool.repo-review]
ignore = ["PY007", "PP308", "GH102", "PC140"]
ignore = ["PY007", "GH102"]

0 comments on commit 9597e47

Please sign in to comment.