-
Notifications
You must be signed in to change notification settings - Fork 45
Adding py.typed file for mypy #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Adding py.typed file necessary for mypy
- Added mypy to the pre-commit file
- Fixed mypy typing issues raised (nothing major, mainly Optionals here and there)
- Added the path to the py.typed file in the setup.py file.
… in setup.py. Also including py.typed into the setup data
…nts where necessary
There was a problem hiding this comment.
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 adds a py.typed file for mypy and integrates mypy into the pre-commit checks, while also addressing minor typing issues across the codebase. Key changes include updating package_data in setup.py, modifying type annotations (e.g. to use Optional types), and updating the pre-commit configuration to include mypy.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
setup.py | Added "exmol/py.typed" to package_data and added a type: ignore comment on version. |
paper1_CFs/RF.ipynb | Updated notebook kernelspec to a more standard Python 3 naming. |
exmol/plot_utils.py | Added an explicit "return None" branch and updated type declaration for figure_kwargs. |
exmol/exmol.py | Updated various type annotations, including a modified return type for name_morgan_bit and changes in get_functional_groups, plus improved inline type hints. |
docs/source/conf.py | Added a type annotation for the exclude_patterns variable. |
.pre-commit-config.yaml | Added configuration to run mypy as part of the pre-commit hooks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. There are still optional args that are not py.typed.
description="Counterfactual generation with STONED SELFIES", | ||
author="Aditi Seshadri, Geemi Wellawatte, Andrew White", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May also be time to update description?
There was a problem hiding this comment.
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 adds support for mypy type checking by including a py.typed file, updates pre-commit hooks to run mypy, and makes several type annotation refinements and style updates.
- Added py.typed to package_data and updated setup.py accordingly
- Updated type annotations (e.g. Optional types and union return types) and adjusted API definitions in exmol/exmol.py
- Updated notebook metadata and fixed a call to a JAX utility in a notebook
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
setup.py | Added comment ignore for version and included "exmol/py.typed" in package_data |
paper3_Scents/GNNModelTrainingAndEvaluation.ipynb | Updated JAX utility call from jax.tree_leaves to jax.tree_util.tree_leaves |
paper1_CFs/RF.ipynb | Updated notebook kernel metadata |
exmol/plot_utils.py | Added an explicit return None for non-SVG branch and refined type annotation for kwargs |
exmol/exmol.py | Updated several type annotations (e.g. Optional types, union annotations) and return types |
docs/source/conf.py | Added type annotation for exclude_patterns |
.pre-commit-config.yaml | Added mypy hook to pre-commit config |
Comments suppressed due to low confidence (3)
exmol/exmol.py:496
- [nitpick] The use of the union type 'list | tuple' for selfies_mut suggests that the function may return either type. Ensure that downstream consumers can handle both cases.
selfies_mut: list | tuple = stoned.get_mutated_SELFIES(
exmol/exmol.py:500
- [nitpick] Similarly, using 'list | tuple' for smiles_back requires that any code using this variable correctly handles both possible types.
smiles_back: list | tuple = [sf.decoder(x) for x in selfies_mut]
.pre-commit-config.yaml:18
- [nitpick] Ensure that the specified mypy version (v1.15.0) in the pre-commit hook is fully compatible with your type annotations and configuration.
- repo: https://github.com/pre-commit/mirrors-mypy