Package: uniter
UniterIs python package, that can handle unit conversion with easy syntax.
Comes with ability to perform mathematical operations, and parsing 
from human-readable string.FeaturesUnitconversionbetween metric and imperial unitsMathematical operations between units:Addition / SubtractionMultiplication / Division / Floor divisionPowerLogical (comparison) operations between unitsParsingfrom humar-readable stringAbility toadd custom unitsAdding formulas to create relation between units of different physics quantity (e.g. ohm's law)SyntaxHere are some examples of features, including bad one to show you what you should
not do while using all of these aspects.Conversionfromuniter.unitsimport*print(DM(80).convert_to(M))# prints out 8m in Unit objectprint(DM(80)[M])# same thing but shorter syntaxprint(DM(80)[KG])# raises TypeError: Illegal conversion from Length to objectAddition / SubtractionConverts to last used unit in calculationfromuniter.unitsimport*print(KM(50)+M(30))# prints out 5030m in Unit objectprint(KM(50)-M(30))# prints out 4070m in Unit objectprint(KM(50)-KG(30))# raise TypeError: Subtraction of non-equal units (Length - Mass)Multiplication / Division / Floor divisionOne of mul/div values needs to be int/float, not Unit typefromuniter.unitsimport*print(KM(30)*2)# prints out 900km in Unit objectprint(KM(30)*80)# prints out 2400km in Unit objectprint(KM(30)/6)# prints out 5km in Unit objectprint(KM(8)//6)# prints out 1km in Unit objectprint(KM(8)*KG(6))# TypeError: Multiplication of Unit with KG, use int/float instead!Powerfromuniter.unitsimport*print(KM(2)**16)# prints out 65536km in Unit objectprint(KM(2)**KM(3))# Power of Unit with KM, use int/float instead!Parsing string to Uniter unitsimportuniterprint(uniter.parse("2m + 5km"))# returns 5.002km in Unit objectCustom quantity/unitsBefore creation of your custom units, you need to know that units are structurized
as inheritance ofUnit (Base Class)->{Your name of unit here}->{Name of unit}.
This structure can basically handle that you cannot convert your unit to another incompatible
units.Example of structuring Length and Mass quatitiesUnit
├─── Length
│    ├─── KM
│    ├─── M
│    ├─── DM
│    ├─── CM
│    └─── ...
└─── Mass
     ├─── KG
     ├─── G
     ├─── MG
     └─── ...Now for creation, for making basic units using prefixes like k (kilo), m (mili), M (mega) etc.
you can just use defined decorators inUniter.pyfile like that:fromuniter.UniterimportUnit,Unitor,Quantitor,UnitType# In this example I am using keywords arguments to make it clearer for you# Creates physics quantity of your name and sign@Quantitor(sign="EQ")classExampleQuantity(Unit):pass# Creating unit of out ExampleQuantity quantity:## - Multiplier is difference between this unit and default one## - IF MULTUPLIER IS 1 THEN THIS UNIT IS CONSIDERED AS DEFAULT## - I've also defined unit type, this is not required,#   it is used to filter out specific type of units@Unitor(symbol="fU",mp=1,unit_type=UnitType.METRIC)classFirstU(ExampleQuantity):passAdd custom calculation methodIf you are trying to make quantity with different type of calculation,
than a regular units multiplication or division,
you can define it via__conv__(self, unit)method which returnsfloat.Here i will show you piece of my code fromAngle.py:fromuniter.UniterimportUnit,Quantitor@Quantitor("°")classAngle(Unit):def__conv__(self,unit):frommathimportpi,degrees,radiansDEGS=[DEG,MOA,SOA]ifself.__class__inDEGSandunitinDEGS:returnsuper().__conv__(unit)# type: ignoreelifself.__class__inDEGSandunitisRAD:returnradians(float(self[DEG]))elifself.__class__isRADandunitinDEGS:returnfloat(DEG(degrees(float(self)))[unit])...# other units