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

Suggestion: Use stronger types instead of int/float #166

Open
niklasbeinghaus opened this issue Oct 11, 2024 · 1 comment
Open

Suggestion: Use stronger types instead of int/float #166

niklasbeinghaus opened this issue Oct 11, 2024 · 1 comment

Comments

@niklasbeinghaus
Copy link

Description

I'd love to suggest to use a library that ensures a plausible value conversion between the different units.

Possible candidates:
https://github.com/vikramsamak/PhsiPy-Api
https://github.com/pacosalces/physunits/tree/master/physunits
https://github.com/juhasch/PhysicalQuantities

What's difficult in communicating with each other doesn't need to be complicated in programming. Using strong types reduces confusion and helps understanding which units are used to calculate something. Also, this would allow for easier extension and additional values involved later on...

@akokam
Copy link

akokam commented Oct 13, 2024

I highly recommend pydantic.
It not only helps you expressing types but it also validates at runtime. With mypy etc you can even have statics checks in your pipelines and/or githooks (pre-commit).

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

No branches or pull requests

2 participants