Skip to content
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

Comply with PEP 561 #481

Merged
merged 1 commit into from
May 7, 2023
Merged

Comply with PEP 561 #481

merged 1 commit into from
May 7, 2023

Conversation

mhostetter
Copy link
Owner

Fixes #480

@mhostetter mhostetter added the typing Related to type hints label May 6, 2023
@mhostetter mhostetter changed the base branch from master to release/0.3.x May 6, 2023 18:51
@mhostetter
Copy link
Owner Author

@Minnerlas can you install the .whl file inside this zip (built from this branch) and see if it provides the correct flags to mypy. And if the types in galois play well with mypy? I really have never tested with mypy. Thanks.

dist-pr481.zip

@codecov
Copy link

codecov bot commented May 6, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (a2fa1ac) 96.33% compared to head (a2cc563) 96.33%.

Additional details and impacted files
@@              Coverage Diff               @@
##           release/0.3.x     #481   +/-   ##
==============================================
  Coverage          96.33%   96.33%           
==============================================
  Files                 46       46           
  Lines               5833     5833           
==============================================
  Hits                5619     5619           
  Misses               214      214           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mhostetter
Copy link
Owner Author

I verified this is packaged correctly and works with mypy.

# file: test.py
import galois
GF = galois.GF(256.0)

Before

PS C:\Users\matth> python3 -m mypy test.py
test.py:1: error: Skipping analyzing "galois": module is installed, but missing library stubs or py.typed marker  [import]
test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

After

PS C:\Users\matth> python3 -m mypy test.py
test.py:3: error: No overload variant of "GF" matches argument type "float"  [call-overload]
test.py:3: note: Possible overload variants:
test.py:3: note:     def GF(order: int, *, irreducible_poly: Optional[PolyLike] = ..., primitive_element: Union[int, PolyLike, None] = ..., verify: bool = ..., compile: Optional[Literal['auto', 'jit-lookup', 'jit-calculate', 'python-calculate']] = ..., repr: Optional[Literal['int', 'poly', 'power']] = ...) -> Type[FieldArray]
test.py:3: note:     def GF(characteristic: int, degree: int, *, irreducible_poly: Optional[PolyLike] = ..., primitive_element: Union[int, PolyLike, None] = ..., verify: bool = ..., compile: Optional[Literal['auto', 'jit-lookup', 'jit-calculate', 'python-calculate']] = ..., repr: Optional[Literal['int', 'poly', 'power']] = ...) -> Type[FieldArray]
Found 1 error in 1 file (checked 1 source file)

@mhostetter mhostetter merged commit e1c43ab into release/0.3.x May 7, 2023
@mhostetter mhostetter deleted the specify-typed-package branch May 7, 2023 14:39
@Minnerlas
Copy link

I am sorry, I haven't seen that I was tagged until now. Thanks for the quick fix though!

@mhostetter
Copy link
Owner Author

No problem. Open another issue if v0.3.5 has issues with mypy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typing Related to type hints
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add py.typed marker to the project so that tools like mypy recognize the type definitons
2 participants