Skip to content

Add type annotations to code-base (automatically via Claude; and then tweaked and validated hand). - #121

Merged
matthewwardrop merged 1 commit into
mainfrom
add-type-annotations
Mar 17, 2026
Merged

Add type annotations to code-base (automatically via Claude; and then tweaked and validated hand).#121
matthewwardrop merged 1 commit into
mainfrom
add-type-annotations

Conversation

@matthewwardrop

Copy link
Copy Markdown
Collaborator

This gives rich type annotations validated by mypy. We fixed a few small bugs along the way.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_extensions and a mypy-based type-checking step/configuration in pyproject.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.

Comment thread omniduct/_version.py
Comment thread omniduct/restful/base.py Outdated
Comment thread omniduct/utils/processes.py
Comment thread omniduct/remotes/base.py Outdated
@matthewwardrop
matthewwardrop force-pushed the add-type-annotations branch 3 times, most recently from b4704b2 to 5dcd592 Compare March 17, 2026 05:42
@matthewwardrop
matthewwardrop merged commit 1bde249 into main Mar 17, 2026
5 checks passed
@matthewwardrop
matthewwardrop deleted the add-type-annotations branch March 17, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants