Jul-21-2023, 02:13 PM
Hi everyone !
This is my first post here so I hope I am not posting things in the wrong category.
I wanted to present to you the new library I programmed called impunity.
It will hunt physical annotations in the Python AST and check if there are any inconsistencies between physical units.
It simply uses a decorator for the checks for now.
The code is here.
It works like that :
It uses the Pint library to get the conversions but will have almost no overhead since the checks are statics.
I really look forward to have some people giving feedbacks and / or contribute if this library can help them.
Have a great day !
This is my first post here so I hope I am not posting things in the wrong category.
I wanted to present to you the new library I programmed called impunity.
It will hunt physical annotations in the Python AST and check if there are any inconsistencies between physical units.
It simply uses a decorator for the checks for now.
The code is here.
It works like that :
@impunity def speed(d: "m", t: "s") -> "m / s": return d / t speed(10, 10) # returns 1 @impunity def speed(d: "m", t: "s") -> "km / h": return d / t speed(10, 10) # returns 3.6And will raise an error when conversions are not possible.
It uses the Pint library to get the conversions but will have almost no overhead since the checks are statics.
I really look forward to have some people giving feedbacks and / or contribute if this library can help them.
Have a great day !
