Skip to content

Commit

Permalink
🔧 Make mypy pre-commit hook isolated (#1003)
Browse files Browse the repository at this point in the history
This makes it easier to run pre-commit in isolation, with no system dependencies other than pre-commit itself.
  • Loading branch information
chrisjsewell authored Aug 28, 2023
1 parent a09a539 commit 9eb5143
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 31 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,9 @@ jobs:
name: Lint
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install/Update build dependencies
run: |
python -m pip install --upgrade setuptools
python -m pip install --upgrade pip
- name: Install Poetry
run: |
curl -sL https://install.python-poetry.org | python -
- name: Update Pip
run: poetry run pip install -U pip setuptools
- name: Install Dependencies
run: poetry install
- uses: pre-commit/[email protected]
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- uses: pre-commit/[email protected]
16 changes: 9 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ repos:
args:
- --py36-plus

- repo: local
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
name: mypy
entry: poetry run mypy
language: system
require_serial: true
pass_filenames: false
- id: mypy
files: sphinx_needs/.*
args: []
additional_dependencies:
- sphinx==6
- types-docutils
- types-requests

- repo: https://github.com/python-poetry/poetry
rev: 1.5.0
Expand Down
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,18 @@ line-length = 120
profile = "black"

[tool.mypy]
files = "sphinx_needs"
strict = true
show_error_codes = true
implicit_reexport = true
files = "sphinx_needs"
ignore_missing_imports = true
namespace_packages = true
warn_unused_ignores = false

[[tool.mypy.overrides]]
module = [
"requests_file",
"sphinx_data_viewer.*"
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = [
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/list2need.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
OPTIONS_REGEX = re.compile(r"([^=,\s]*)=[\"']([^\"]*)[\"']")


class List2Need(nodes.General, nodes.Element): # type: ignore
class List2Need(nodes.General, nodes.Element):
pass


Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sphinx_needs.utils import add_doc, logger


class Needimport(nodes.General, nodes.Element): # type: ignore
class Needimport(nodes.General, nodes.Element):
pass


Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/directives/needservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sphinx_needs.utils import add_doc, unwrap


class Needservice(nodes.General, nodes.Element): # type: ignore
class Needservice(nodes.General, nodes.Element):
pass


Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/nodes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from docutils import nodes


class Need(nodes.General, nodes.Element): # type: ignore
class Need(nodes.General, nodes.Element):
"""
Node for containing a complete need.
Node structure:
Expand Down

0 comments on commit 9eb5143

Please sign in to comment.