Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: make everything type check #540

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 14 additions & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ 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/[email protected]
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
- 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
with:
extra-args: "--exclude tests"
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
Loading