Add type annotations to code-base (automatically via Claude; and then tweaked and validated hand). - #121
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces project-wide Python type annotations and enforces them via a new mypy configuration, with a few incidental runtime-safety tweaks made while tightening types.
Changes:
- Add
typing_extensionsand a mypy-based type-checking step/configuration inpyproject.toml. - Add/upgrade type annotations across core modules (ducts, registries, caches, utils, filesystem/remote/database clients).
- Apply a handful of small behavioral fixes discovered during typing (e.g., safer module detection in logging, stricter config save/load validation).
Reviewed changes
Copilot reviewed 45 out of 46 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Adds typing_extensions, lint env type-checking deps, mypy config, and runs mypy in lint checks. |
.gitignore |
Ignores .mypy_cache/. |
omniduct/__init__.py |
Adds return type for about(). |
omniduct/_version.py |
Switches dependency lists to be derived from distribution metadata. |
omniduct/duct.py |
Adds extensive typing (incl. Self) and some narrowing/casts. |
omniduct/registry.py |
Types for registry construction/lookup and namespace population helpers. |
omniduct/restful/base.py |
Adds typing for REST client base and request helpers. |
omniduct/utils/about.py |
Adds typing + clarifies notebook/text rendering control flow. |
omniduct/utils/config.py |
Adds typing, improves module detection, and validates save/load filename presence. |
omniduct/utils/debug.py |
Adds typing and hardens logger context inference and progress bar finishing. |
omniduct/utils/decorators.py |
Adds typing for decorator helpers. |
omniduct/utils/dependencies.py |
Types + simplifies package version detection via importlib.metadata. |
omniduct/utils/magics.py |
Adds typing for IPython magic argument wrappers/providers. |
omniduct/utils/ports.py |
Adds typing and a small regex-match guard in load balancer. |
omniduct/utils/processes.py |
Adds typing to subprocess helpers and timeout context manager. |
omniduct/utils/proxies.py |
Adds typing to TreeProxy helpers and methods. |
omniduct/utils/storage.py |
Adds typing to ensure_path_exists. |
omniduct/utils/submodules.py |
Adds typing + improves docstring format for submodule import helper. |
omniduct/remotes/base.py |
Adds typing across port-forward registry and remote base APIs. |
omniduct/remotes/ssh.py |
Adds typing across SSH remote implementation. |
omniduct/remotes/ssh_paramiko.py |
Adds typing across Paramiko SSH remote implementation. |
omniduct/remotes/stub.py |
Adds typing to remote stub methods. |
omniduct/filesystems/_pyarrow_compat.py |
Adds typing to PyArrow compatibility filesystem wrapper. |
omniduct/filesystems/_webhdfs_helpers.py |
Adds typing for WebHDFS helpers and XML parsing casts. |
omniduct/filesystems/local.py |
Adds typing to local filesystem implementation. |
omniduct/filesystems/s3.py |
Adds typing to S3 filesystem implementation. |
omniduct/filesystems/stub.py |
Adds typing to filesystem stub methods. |
omniduct/filesystems/webhdfs.py |
Adds typing and narrows remote/filesystem assumptions for auto-conf. |
omniduct/caches/_serializers.py |
Adds typing to serializers and file handles. |
omniduct/caches/base.py |
Adds typing for cache API + cached_method decorator. |
omniduct/caches/filesystem.py |
Adds typing and clarifies filesystem-client resolution via registry. |
omniduct/databases/_cursor_formatters.py |
Adds typing across cursor formatters and CSV formatting. |
omniduct/databases/_cursor_serializer.py |
Adds typing for cursor serializer and cached cursor wrapper. |
omniduct/databases/_namespaces.py |
Adds typing to namespace parsing/rendering. |
omniduct/databases/_pandas.py |
Adds typing and guards for pandas internal SQL helpers in multi-insert mode. |
omniduct/databases/_schemas.py |
Adds typing + refactors reflected table binding for pandas introspection. |
omniduct/databases/druid.py |
Adds typing for Druid client. |
omniduct/databases/exasol.py |
Adds typing for Exasol client. |
omniduct/databases/hiveserver2.py |
Adds typing + a few runtime checks for hive CLI path. |
omniduct/databases/neo4j.py |
Adds typing for Neo4j client. |
omniduct/databases/presto.py |
Adds typing + hardens error parsing branch. |
omniduct/databases/pyspark.py |
Adds typing for PySpark client + SparkCursor wrapper. |
omniduct/databases/sqlalchemy.py |
Adds typing for SQLAlchemy client, dataframe/table operations. |
omniduct/databases/stub.py |
Adds typing for database stub methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
matthewwardrop
force-pushed
the
add-type-annotations
branch
3 times, most recently
from
March 17, 2026 05:42
b4704b2 to
5dcd592
Compare
… checked by hand).
matthewwardrop
force-pushed
the
add-type-annotations
branch
from
March 17, 2026 05:46
5dcd592 to
6ef1bba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This gives rich type annotations validated by mypy. We fixed a few small bugs along the way.