Metadata-Version: 2.4
Name: frequenz-quantities
Version: 1.0.2
Summary: Types for holding quantities with units
Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
License-Expression: MIT
Project-URL: Documentation, https://frequenz-floss.github.io/frequenz-quantities-python/
Project-URL: Changelog, https://github.com/frequenz-floss/frequenz-quantities-python/releases
Project-URL: Issues, https://github.com/frequenz-floss/frequenz-quantities-python/issues
Project-URL: Repository, https://github.com/frequenz-floss/frequenz-quantities-python
Project-URL: Support, https://github.com/frequenz-floss/frequenz-quantities-python/discussions/categories/support
Keywords: frequenz,python,lib,library,quantities,unit,conversion
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: <4,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typing-extensions<5,>=4.12.0
Provides-Extra: dev-flake8
Requires-Dist: flake8==7.3.0; extra == "dev-flake8"
Requires-Dist: flake8-datetimez==26.8.1; extra == "dev-flake8"
Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
Requires-Dist: flake8-pyproject==1.2.4; extra == "dev-flake8"
Requires-Dist: pydoclint==0.9.1; extra == "dev-flake8"
Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
Provides-Extra: dev-formatting
Requires-Dist: black==26.5.1; extra == "dev-formatting"
Requires-Dist: isort==9.0.1; extra == "dev-formatting"
Provides-Extra: dev-mkdocs
Requires-Dist: Markdown==3.10.3; extra == "dev-mkdocs"
Requires-Dist: black==26.5.1; extra == "dev-mkdocs"
Requires-Dist: mike==2.2.0; extra == "dev-mkdocs"
Requires-Dist: mkdocs-gen-files==0.6.1; extra == "dev-mkdocs"
Requires-Dist: mkdocs-literate-nav==0.6.3; extra == "dev-mkdocs"
Requires-Dist: mkdocs-macros-plugin==1.5.0; extra == "dev-mkdocs"
Requires-Dist: mkdocs-material==9.7.7; extra == "dev-mkdocs"
Requires-Dist: mkdocstrings[python]==1.0.6; extra == "dev-mkdocs"
Requires-Dist: mkdocstrings-python==2.0.7; extra == "dev-mkdocs"
Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-mkdocs"
Provides-Extra: dev-mypy
Requires-Dist: mypy==2.3.1; extra == "dev-mypy"
Requires-Dist: types-Markdown==3.10.2.20260712; extra == "dev-mypy"
Requires-Dist: frequenz-quantities[dev-mkdocs,dev-noxfile,dev-pytest,marshmallow]; extra == "dev-mypy"
Provides-Extra: dev-noxfile
Requires-Dist: nox==2026.8.17; extra == "dev-noxfile"
Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-noxfile"
Provides-Extra: dev-pylint
Requires-Dist: frequenz-quantities[dev-mkdocs,dev-noxfile,dev-pytest,marshmallow]; extra == "dev-pylint"
Provides-Extra: dev-pytest
Requires-Dist: pytest==9.1.1; extra == "dev-pytest"
Requires-Dist: pylint==4.0.8; extra == "dev-pytest"
Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.19.0; extra == "dev-pytest"
Requires-Dist: pytest-mock==3.15.1; extra == "dev-pytest"
Requires-Dist: pytest-asyncio==1.4.0; extra == "dev-pytest"
Requires-Dist: async-solipsism==0.9; extra == "dev-pytest"
Requires-Dist: hypothesis==6.165.10; extra == "dev-pytest"
Requires-Dist: frequenz-quantities[marshmallow]; extra == "dev-pytest"
Provides-Extra: marshmallow
Requires-Dist: marshmallow<5,>=4; extra == "marshmallow"
Requires-Dist: marshmallow-dataclass<9,>=8.0.0; extra == "marshmallow"
Provides-Extra: dev
Requires-Dist: frequenz-quantities[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest,marshmallow]; extra == "dev"
Dynamic: license-file

# Frequenz Quantities Library

[![Build Status](https://github.com/frequenz-floss/frequenz-quantities-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/frequenz-floss/frequenz-quantities-python/actions/workflows/ci.yaml)
[![PyPI Package](https://img.shields.io/pypi/v/frequenz-quantities)](https://pypi.org/project/frequenz-quantities/)
[![Docs](https://img.shields.io/badge/docs-latest-informational)](https://frequenz-floss.github.io/frequenz-quantities-python/)

## Introduction

This library provide types for holding quantities with units. The main goal is
to avoid mistakes while working with different types of quantities, for example
avoiding adding a length to a time.

It also prevents mistakes when operating between the same quantity but in
different units, like adding a power in Joules to a power in Watts without
converting one of them.

Quantities store the value in a base unit, and then provide methods to get that
quantity as a particular unit.

## Installation

### Using `pip`

```bash
python3 -m pip install frequenz-quantities
```

### Using `pyproject.toml`

Add this to your `pyproject.toml` file:

```toml
[project]
dependencies = [
    "frequenz-quantities >= 1.0.0, < 2"
]
```

> [!NOTE]
> We recommend pinning the dependency to the latest version for programs,
> like `"frequenz-quantities == 1.0.0"`, and specifying a version range
> spanning one major version for libraries, like `"frequenz-quantities >= 1.0.0, < 2"`.
> We follow [semver](https://semver.org/).

## Quick Start

```python
from frequenz.quantities import Power, Current, Voltage

# Create quantities using unit-specific constructors
power = Power.from_watts(1500.0)
current = Current.from_amperes(10.0)
voltage = Voltage.from_volts(230.0)

# Perform operations between quantities
total_power = power + Power.from_kilowatts(2.0)
print(f"Total power: {total_power}")  # Total power: 3500 W

# Convert to different units
print(f"Power in kW: {total_power.as_kilowatts()}")  # Power in kW: 3.5

# Type safety prevents invalid operations
# This would raise a TypeError:
# invalid = power + current  # Can't add power and current!
```

## Documentation

For more information on how to use this library and examples, please check the
[Documentation website](https://frequenz-floss.github.io/frequenz-quantities-python/).

## Supported Platforms

The following platforms are officially supported (tested):

- **Python:** 3.11
- **Operating System:** Ubuntu Linux 20.04
- **Architectures:** amd64, arm64

## Contributing

If you want to know how to build this project and contribute to it, please
check out the [Contributing Guide](CONTRIBUTING.md).
