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

Add types annotations for core.interface #3822

Merged
merged 26 commits into from
Jun 6, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented May 12, 2024

Summary

  • Add types annotations for core.interface
  • Use more specific types for ClassVar

New custom type aliases

Tuple3Ints = tuple[int, int, int]
Tuple3Floats = tuple[float, float, float]

move dunder methods to the top

add more types and tweaks

relocate more dunder methods to top

more types and format tweaks

fix type error

add types for composition

help fix materialsproject#3792 (comment)

reverse compare order for readability

Revert "reverse compare order for readability"

This reverts commit 05ea23a.

Revert "help fix materialsproject#3792 (comment)"

This reverts commit cae7aed.

add types for `core.bonds`

finish `core.ion`

add some types

revert non-interface changes
@DanielYang59 DanielYang59 force-pushed the add-types-core-interface branch from 501764f to 579083b Compare May 12, 2024 10:04
@DanielYang59
Copy link
Contributor Author

Not working on this for now, would reopen it later.

pymatgen/core/xcfunc.py Outdated Show resolved Hide resolved
@DanielYang59 DanielYang59 marked this pull request as ready for review June 4, 2024 04:15
@DanielYang59
Copy link
Contributor Author

@janosh Would appreciate it if you could review this at your convenience, thanks!

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

thanks @DanielYang59! this all looks good. just 1 minor comment regarding the test change

tests/core/test_interface.py Outdated Show resolved Hide resolved
@janosh janosh added types Type all the things core Pymatgen core labels Jun 4, 2024
@DanielYang59 DanielYang59 requested a review from janosh June 4, 2024 13:31
@DanielYang59 DanielYang59 requested a review from JaGeo as a code owner June 4, 2024 13:57
@DanielYang59
Copy link
Contributor Author

@janosh Just ping you again in case it got forgotten :) No rush

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

thanks for the consistent use of tuple type aliases!

pymatgen/io/pwmat/outputs.py Outdated Show resolved Hide resolved
@DanielYang59 DanielYang59 requested a review from janosh June 6, 2024 11:06
from pymatgen.core import Element
from pymatgen.util.typing import CompositionLike, Matrix3D, MillerIndex, Tuple3Floats, Vector3D

Tuple4Ints = tuple[int, int, int, int]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put it here because it doesn't seem to be needed by other code, tuple[int, int, int, int] doesn't seem to be commonly used. But we could relocate it if needed

Copy link
Member

Choose a reason for hiding this comment

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

ah, didn't see that. i would relocate right away

@janosh janosh added the surfaces Surface analysis label Jun 6, 2024
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

thanks @DanielYang59! 👍

@janosh janosh enabled auto-merge (squash) June 6, 2024 11:09
@DanielYang59
Copy link
Contributor Author

Thanks for reviewing! Appreciate that

@janosh janosh merged commit 65d5379 into materialsproject:master Jun 6, 2024
33 checks passed
@DanielYang59 DanielYang59 deleted the add-types-core-interface branch June 6, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Pymatgen core surfaces Surface analysis types Type all the things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants