Skip to content

Add typehints#11

Merged
seanmacavaney merged 14 commits into
terrierteam:masterfrom
Samoed:Samoed-patch-1
Sep 5, 2025
Merged

Add typehints#11
seanmacavaney merged 14 commits into
terrierteam:masterfrom
Samoed:Samoed-patch-1

Conversation

@Samoed

@Samoed Samoed commented Aug 22, 2025

Copy link
Copy Markdown

No description provided.

@Samoed

Samoed commented Aug 28, 2025

Copy link
Copy Markdown
Author

Hi @seanmacavaney can you review?

@Samoed

Samoed commented Sep 5, 2025

Copy link
Copy Markdown
Author

@cmacdonald @seanmacavaney can you review?

@cmacdonald

Copy link
Copy Markdown
Collaborator

Thanks for this, nice work.

We should add a mypy GHA that verifies the types. Can you take a style.yml file from another of our projects?

@Samoed

Samoed commented Sep 5, 2025

Copy link
Copy Markdown
Author

Added ruff config

@Samoed

Samoed commented Sep 5, 2025

Copy link
Copy Markdown
Author

I tried to add mypy, but it raises some errors. I can try to fix it

@cmacdonald

Copy link
Copy Markdown
Collaborator

Here is the mypy output:

py/__init__.py:9: error: Cannot find implementation or library stub for module named "numpy"  [import-not-found]
py/__init__.py:9: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
py/__init__.py:10: error: Cannot find implementation or library stub for module named "pytrec_eval_ext"  [import-not-found]
py/__init__.py:41: error: Need type annotation for "run"  [var-annotated]
py/__init__.py:70: error: Need type annotation for "qrel"  [var-annotated]
py/__init__.py:180: error: Need type annotation for "param_meas"  [var-annotated]
py/__init__.py:187: error: Item "None" of "Optional[Match[str]]" has no attribute "group"  [union-attr]

Comment thread py/__init__.py Outdated
Comment thread py/__init__.py Outdated
Comment thread py/__init__.py
Comment thread py/__init__.py Outdated
@cmacdonald

Copy link
Copy Markdown
Collaborator

added some comments - nearly there @Samoed !

@Samoed

Samoed commented Sep 5, 2025

Copy link
Copy Markdown
Author

Changed ruff to singe quotes

@cmacdonald

Copy link
Copy Markdown
Collaborator

LGTM. are you happy @seanmacavaney ?

@seanmacavaney

Copy link
Copy Markdown
Collaborator

To avoid increasing the min supported python version, I switched to Dict, List, Set from typing.

I think this is good to go, I'll merge and release.

Thanks a bunch @Samoed!

@seanmacavaney
seanmacavaney merged commit b727b73 into terrierteam:master Sep 5, 2025
9 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.

3 participants