8000 Adding py.typed file for mypy by Jgmedina95 · Pull Request #158 · ur-whitelab/exmol · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 14 commits into from
May 5, 2025
Merged

Adding py.typed file for mypy #158

merged 14 commits into from
May 5, 2025

Conversation

Jgmedina95
Copy link
Contributor
  • 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.

@Jgmedina95 Jgmedina95 linked an issue Apr 29, 2025 that may be closed by this pull request
@Jgmedina95 Jgmedina95 marked this pull request as ready for review April 29, 2025 14:41
@Jgmedina95 Jgmedina95 requested review from whitead and hgandhi2411 and removed request for whitead April 29, 2025 14:41
@whitead whitead requested a review from Copilot April 29, 2025 22:38
Copy link
@Copilot Copilot AI left a 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.

Copy link
Contributor
@hgandhi2411 hgandhi2411 left a 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.

Comment on lines 13 to 14
description="Counterfactual generation with STONED SELFIES",
author="Aditi Seshadri, Geemi Wellawatte, Andrew White",
Copy link
Contributor

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?

@whitead whitead requested a review from Copilot April 30, 2025 17:12
Copy link
@Copilot Copilot AI left a 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

@Jgmedina95 Jgmedina95 merged commit 2ee8fd7 into main May 5, 2025
5 checks passed
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.

Request: adding py.typed
2 participants
0