@@ -17,6 +17,53 @@ converting one of them.
1717Quantities store the value in a base unit, and then provide methods to get that
1818quantity as a particular unit.
1919
20+ ## Installation
21+
22+ ### Using ` pip `
23+
24+ ``` bash
25+ python3 -m pip install frequenz-quantities
26+ ```
27+
28+ ### Using ` pyproject.toml `
29+
30+ Add this to your ` pyproject.toml ` file:
31+
32+ ``` toml
33+ [project ]
34+ dependencies = [
35+ " frequenz-quantities >= 1.0.0, < 2"
36+ ]
37+ ```
38+
39+ > [ !NOTE]
40+ > We recommend pinning the dependency to the latest version for programs,
41+ > like ` "frequenz-quantities == 1.0.0" ` , and specifying a version range
42+ > spanning one major version for libraries, like ` "frequenz-quantities >= 1.0.0, < 2" ` .
43+ > We follow [ semver] ( https://semver.org/ ) .
44+
45+ ## Quick Start
46+
47+ ``` python
48+ from frequenz.quantities import Power, Current, Voltage
49+
50+ # Create quantities using unit-specific constructors
51+ power = Power.from_watts(1500.0 )
52+ current = Current.from_amperes(10.0 )
53+ voltage = Voltage.from_volts(230.0 )
54+
55+ # Perform operations between quantities
56+ total_power = power + Power.from_kilowatts(2.0 )
57+ print (f " Total power: { total_power} " ) # Total power: 3500 W
58+
59+ # Convert to different units
60+ print (f " Power in kW: { total_power.as_kilowatts()} " ) # Power in kW: 3.5
61+
62+ # Type safety prevents invalid operations
63+ # This would raise a TypeError:
64+ # invalid = power + current # Can't add power and current!
65+ ```
66+
2067## Documentation
2168
2269For more information on how to use this library and examples, please check the
0 commit comments