Repository navigation
build: add mypy type checking - #54
Conversation
Replace setup.py, setup.cfg, and pytest.ini with pyproject.toml, matching python-slack-sdk, bolt-python, and python-slack-hooks. The new floor is Python 3.7. A Python CI workflow runs the tests on 3.7 to 3.15 and PyPy, and tests that need live Discovery API tokens now skip without them. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Use the ruff config shared by python-slack-sdk, bolt-python, and python-slack-hooks, with format.sh and lint.sh scripts and a Lint CI job. This removes the .flake8 config and the flake8 workflow. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Output of ./scripts/format.sh with no other changes: ruff format plus the safe ruff check fixes (one import per line, docstring blank lines, an unused import). Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Split each docstring summary onto its own line with a blank line after it, end summaries with a period, and document the missing args, so the google convention checks pass with the same ignores as the other python repos. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Replace pytype with mypy, using the config and scripts shared with python-slack-sdk, bolt-python, and python-slack-hooks, and a Typecheck CI job. Fix the errors it found: - type the HTTP request helpers and drop the unused type: ignore comments - allow an empty response body in DiscoveryResponse - remove the root __init__.py, which made the repo look like a package - fix the examples package, whose import of a parent module failed Offline tests with a local HTTP server cover the success and error paths of the request code that changed. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
===========================================
+ Coverage 23.86% 45.75% +21.89%
===========================================
Files 17 17
Lines 637 636 -1
===========================================
+ Hits 152 291 +139
+ Misses 485 345 -140 ☔ View full report in Codecov by Harness. |
The license is now an SPDX expression with LICENSE.md as its license file. This needs setuptools 77 or newer, which runs on Python 3.9+, so the package is built on the latest Python. The py3-none-any wheel still installs on 3.7+. Because of this, the unit test jobs and install.sh no longer install the package (that would build it on 3.7/3.8). The tests import it from source, as in python-slack-sdk. MANIFEST.in is dropped: setuptools already ships README.md, LICENSE.md, and py.typed. PyPy is dropped from the classifiers and the test matrix since it isn't tested. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
mwbrooks
left a comment
There was a problem hiding this comment.
Looks good so far, one small note for when it's ready.
| pytest -vv $test_target | ||
| else | ||
| pytest | ||
| ./scripts/run_mypy.sh --no-install |
There was a problem hiding this comment.
suggestion (non-blocking): mypy isn't installed on 3.7 and 3.8, so this fails with mypy: command not found there. Maybe skip it on older Pythons?
The license goes back to license = { text = "MIT" }, like
python-slack-sdk, bolt-python, and python-slack-hooks. Without the
PEP 639 form, setuptools no longer needs to be 77 or newer, so the
package builds and installs from source on 3.7 and 3.8 again.
That lets install.sh run pip install -e . once more, so the README
setup flow can import the SDK when running the examples. run_all.sh is
restored because the README still points to it for running every
example.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
mwbrooks
left a comment
There was a problem hiding this comment.
✅ Thanks @WilliamBergamin, a Typecheck job in CI means type regressions show up on the PR instead of after a release.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Summary
This pull request replaces pytype with mypy, using the shared config, and fixes what it found. It's PR 3 of 4 and stacks on #53.
scripts/run_mypy.sh,scripts/install_and_run_tests.sh, and a Typecheck CI job, and removes the pytype workflow# type: ignorecommentsimport slack_discovery_sdk.examples, which raised ImportError in the published package, and removes the root__init__.pythat made the repo itself look like a packageTesting
./scripts/run_mypy.shis cleantests/test_base_client.pyexercise the request success and error paths against a local HTTP server; they also pass on the code before this PRRequirements
🤖 Generated with Claude Code