Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:

pre-commit-check:
runs-on: ubuntu-latest
env:
SKIP: "mypy"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ permissions: {}

jobs:
type-check:
strategy:
fail-fast: true
matrix:
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- run: pip install ".[jupyter-executor]" mypy
# As more modules are type check clean, add them here
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
# All additional modules should be defined in setup.py
- run: pip install ".[types]"
# Any additional configuration should be defined in pyproject.toml
- run: |
mypy \
autogen/logger \
autogen/exception_utils.py \
autogen/coding \
autogen/oai/openai_utils.py
mypy
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ repos:
website/docs/tutorial/code-executors.ipynb |
notebook/.*
)$
# See https://jaredkhan.com/blog/mypy-pre-commit
- repo: local
hooks:
- id: mypy
name: mypy
entry: "./scripts/pre-commit-mypy-run.sh"
language: python
# use your preferred Python version
# language_version: python3.8
additional_dependencies: [".[types]"]
types: [python]
# use require_serial so that script
# is only called once per commit
require_serial: true
# Print the number of files as a sanity-check
verbose: true
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.4
hooks:
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ max-complexity = 10

[tool.mypy]

files = [
"autogen/logger",
"autogen/exception_utils.py",
"autogen/coding",
"autogen/oai/openai_utils.py",
]

strict = true
python_version = "3.8"
ignore_missing_imports = true
Expand Down
13 changes: 13 additions & 0 deletions scripts/pre-commit-mypy-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# taken from: https://jaredkhan.com/blog/mypy-pre-commit

# A script for running mypy,
# with all its dependencies installed.

set -o errexit

# Change directory to the project root directory.
cd "$(dirname "$0")"/..

mypy
17 changes: 10 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
"docker",
]

jupyter_executor = [
"jupyter-kernel-gateway",
"websocket-client",
"requests",
"jupyter-client>=8.6.0",
"ipykernel>=6.29.0",
]

setuptools.setup(
name="pyautogen",
version=__version__,
Expand Down Expand Up @@ -57,13 +65,8 @@
"graph": ["networkx", "matplotlib"],
"websurfer": ["beautifulsoup4", "markdownify", "pdfminer.six", "pathvalidate"],
"redis": ["redis"],
"jupyter-executor": [
"jupyter-kernel-gateway",
"websocket-client",
"requests",
"jupyter-client>=8.6.0",
"ipykernel>=6.29.0",
],
"jupyter-executor": jupyter_executor,
"types": ["mypy==1.9.0"] + jupyter_executor,
},
classifiers=[
"Programming Language :: Python :: 3",
Expand Down