Skip to content

Commit

Permalink
Adds make type-check (#269)
Browse files Browse the repository at this point in the history
To run python type checking at the command line for dev-time and PR
validation-time.

Switches from "basic" to "standard" validation for Pylance in vscode, to
match the default `pyright` level

Additionally, fixes some type errors found in various projects.
  • Loading branch information
markwaddle authored Nov 26, 2024
1 parent 4fc41da commit 9118a0e
Show file tree
Hide file tree
Showing 101 changed files with 1,244 additions and 222 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/assistants-explorer-assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,24 @@ defaults:
working-directory: assistants/explorer-assistant

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python 3.11
run: uv python install 3.11

- name: test
run: |
make test
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/assistants-guided-conversation-assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,24 @@ defaults:
working-directory: assistants/guided-conversation-assistant

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python 3.11
run: uv python install 3.11

- name: test
run: |
make test
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/assistants-prospector-assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,24 @@ defaults:
working-directory: assistants/prospector-assistant

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python 3.11
run: uv python install 3.11

- name: test
run: |
make test
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/assistants-skill-assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,24 @@ defaults:
working-directory: assistants/skill-assistant

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python 3.11
run: uv python install 3.11

- name: test
run: |
make test
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/workbench-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: pytest
run: uv run pytest --dbtype=${{ matrix.dbtype }}
- name: test
run: make test PYTEST_ARGS="--dbtype=${{ matrix.dbtype }}"

build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"python.analysis.fixAll": ["source.unusedImports"],
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.typeCheckingMode": "standard",
"python.defaultInterpreterPath": "${workspaceFolder}/workbench-service/.venv",
"python.languageServer": "Pylance",
"python.testing.pytestEnabled": true,
Expand Down
2 changes: 1 addition & 1 deletion assistants/explorer-assistant/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"python.analysis.diagnosticMode": "workspace",
"python.analysis.fixAll": ["source.unusedImports"],
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.typeCheckingMode": "standard",
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
Expand Down
2 changes: 1 addition & 1 deletion assistants/explorer-assistant/assistant/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class AssistantConfigModel(BaseModel):
" code snippets, and other types of content. If you wrap your response in triple backticks, you can specify the"
" language for syntax highlighting. For example, ```python print('Hello, World!')``` will produce a code"
" snippet in Python. Mermaid markdown is supported if you wrap the content in triple backticks and specify"
" 'mermaid' as the language. For example, ```mermaid graph TD; A-->B;``` will render a flowchart for the"
' \'mermaid\' as the language. For example, ```mermaid graph TD; A["A"]-->B["B"];``` will render a flowchart for the'
" user.ABC markdown is supported if you wrap the content in triple backticks and specify 'abc' as the"
" language.For example, ```abc C4 G4 A4 F4 E4 G4``` will render a music score and an inline player with a link"
" to download the midi file."
Expand Down
5 changes: 5 additions & 0 deletions assistants/explorer-assistant/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ assistant-extensions = { path = "../../libraries/python/assistant-extensions", e
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
dev = [
"pyright>=1.1.389",
]
48 changes: 47 additions & 1 deletion assistants/explorer-assistant/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"python.analysis.fixAll": ["source.unusedImports"],
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.typeCheckingMode": "standard",
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
Expand Down
5 changes: 5 additions & 0 deletions assistants/guided-conversation-assistant/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@ openai-client = { path = "../../libraries/python/openai-client", editable = true
requires = ["hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
dev = [
"pyright>=1.1.389",
]

[tool.pyright]
exclude = ["venv", ".venv"]
Loading

0 comments on commit 9118a0e

Please sign in to comment.