Skip to content

Commit

Permalink
Make everything typecheck?
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobot1234 committed Oct 28, 2023
1 parent bd7de20 commit 20bda76
Show file tree
Hide file tree
Showing 13 changed files with 438 additions and 436 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
pull_request:
branches:
- '**'
- "**"

jobs:
tests:
Expand All @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Install dependencies
shell: bash
run: poetry install -E compiler
run: poetry install --with dev test

- name: Generate code from proto files
shell: bash
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ on:
- master
pull_request:
branches:
- '**'
- "**"

jobs:
check-formatting:
name: Check code/doc formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/action@v2.0.3
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/action@v2.0.3
- run: pipx install poetry
- uses: actions/setup-python@v4
with:
cache: "poetry"

- run: poetry install --with dev,test
- run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
- uses: jakebailey/pyright-action@v1
352 changes: 164 additions & 188 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ python-dateutil = "^2.8"
isort = {version = "^5.11.5", optional = true}
typing-extensions = "^4.7.1"

[tool.poetry.group.dev]
optional = true
[tool.poetry.group.dev.dependencies]
asv = "^0.4.2"
bpython = "^0.19"
Expand All @@ -32,6 +34,8 @@ pre-commit = "^2.17.0"
grpcio-tools = "^1.54.2"
tox = "^4.0.0"

[tool.poetry.group.test]
optional = true
[tool.poetry.group.test.dependencies]
poethepoet = ">=0.9.0"
pytest = "^6.2.5"
Expand Down Expand Up @@ -61,27 +65,27 @@ cmd = "pytest"
help = "Run tests"

[tool.poe.tasks.types]
cmd = "mypy src --ignore-missing-imports"
help = "Check types with mypy"
cmd = "pyright --exclude tests"
help = "Check types with pyright"

[tool.poe.tasks]
_black = "black . --exclude tests/output_ --target-version py310"
_black = "black . --extend-exclude tests/output_ --target-version py310"
_isort = "isort . --extend-skip-glob 'tests/output_*/**/*'"

[tool.poe.tasks.format]
sequence = ["_black", "_isort"]
sequence = ["_black", "_isort"]
help = "Apply black and isort formatting to source code"

[tool.poe.tasks.docs]
cmd = "sphinx-build docs docs/build"
cmd = "sphinx-build docs docs/build"
help = "Build the sphinx docs"

[tool.poe.tasks.bench]
shell = "asv run master^! && asv run HEAD^! && asv compare master HEAD"
help = "Benchmark current commit vs. master branch"
help = "Benchmark current commit vs. master branch"

[tool.poe.tasks.clean]
cmd = """
cmd = """
rm -rf .asv .coverage .mypy_cache .pytest_cache
dist betterproto.egg-info **/__pycache__
testsoutput_*
Expand Down Expand Up @@ -109,6 +113,10 @@ help = "Run tests with multiple pythons"
cmd = "black . --check --diff"
help = "Check if code style is correct"

[tool.pyright]
typeCheckingMode = "basic"
reportSelfClsParameterName = false

[tool.isort]
py_version = 37
profile = "black"
Expand All @@ -128,7 +136,7 @@ max_line_length = 88

[tool.doc8.ignore_path_errors]
"docs/migrating.rst" = [
"D001", # contains table which is longer than 88 characters long
"D001", # contains table which is longer than 88 characters long
]

[tool.coverage.run]
Expand Down
Loading

0 comments on commit 20bda76

Please sign in to comment.