Skip to content

Commit

Permalink
Added Pyright checking and fixed problems it found
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Oct 16, 2024
1 parent 7165d84 commit 5d3fc61
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ on:
pull_request:

jobs:
pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-pyright
- name: Install dependencies
run: pip install -e . pyright
- name: Run pyright
run: pyright --verifytypes asphalt.core

test:
strategy:
fail-fast: false
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ commands = [["python", "-m", "pytest", { replace = "posargs", extend = true }]]
package = "editable"
extras = ["test"]

[tool.tox.env.pyright]
deps = ["pyright"]
commands = [["pyright", "--verifytypes", "asphalt.core"]]

[tool.tox.env.docs]
commands = [["sphinx-build", "-n", "docs", "build/sphinx", { replace = "posargs", extend = true }]]
extras = ["doc"]
2 changes: 1 addition & 1 deletion src/asphalt/core/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Context:
resource has been published in this context
"""

resource_added = Signal(ResourceEvent)
resource_added: Signal[ResourceEvent] = Signal(ResourceEvent)

_task_group: TaskGroup
_reset_token: Token[Context]
Expand Down
4 changes: 2 additions & 2 deletions src/asphalt/core/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class PluginContainer:
__slots__ = "namespace", "base_class", "_entrypoints", "_resolved"

def __init__(self, namespace: str, base_class: type | None = None) -> None:
self.namespace = namespace
self.base_class = base_class
self.namespace: str = namespace
self.base_class: type | None = base_class
group = entry_points(group=namespace)
self._entrypoints = {ep.name: ep for ep in group}
self._resolved: dict[str, Any] = {}
Expand Down

0 comments on commit 5d3fc61

Please sign in to comment.