TypedUnit 0.2.9__tar.gz → 0.2.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- typedunit-0.2.9/.github/workflows/deploy_anaconda.yml → typedunit-0.2.13/.github/workflows/deploy_release.yml +12 -3
- {typedunit-0.2.9 → typedunit-0.2.13}/PKG-INFO +1 -1
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit/_version.py +3 -3
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit.egg-info/PKG-INFO +1 -1
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit.egg-info/SOURCES.txt +7 -2
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit.egg-info/scm_file_list.json +7 -2
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit.egg-info/scm_version.json +2 -2
- typedunit-0.2.13/docs/source/code.rst +20 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/source/conf.py +1 -0
- typedunit-0.2.13/docs/source/guide/concepts.rst +37 -0
- typedunit-0.2.13/docs/source/guide/installation.rst +21 -0
- typedunit-0.2.13/docs/source/guide/pint.rst +24 -0
- typedunit-0.2.13/docs/source/guide/quickstart.rst +27 -0
- typedunit-0.2.13/docs/source/guide/validation.rst +40 -0
- typedunit-0.2.13/docs/source/index.rst +93 -0
- typedunit-0.2.13/docs/source/references.rst +11 -0
- typedunit-0.2.13/docs/source/theory.rst +12 -0
- typedunit-0.2.13/docs/source/units.rst +35 -0
- typedunit-0.2.9/.github/workflows/deploy_PyPi.yml +0 -18
- typedunit-0.2.9/docs/source/code.rst +0 -7
- typedunit-0.2.9/docs/source/index.rst +0 -13
- typedunit-0.2.9/docs/source/references.rst +0 -6
- typedunit-0.2.9/docs/source/theory.rst +0 -5
- {typedunit-0.2.9 → typedunit-0.2.13}/.coveragerc +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.flake8 +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.github/dependabot.yml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.github/workflows/deploy_coverage.yml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.github/workflows/deploy_documentation.yml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.github/workflows/quality.yml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.github/workflows/tests.yml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.gitignore +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/.pre-commit-config.yaml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/CONTRIBUTING.md +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/LICENSE +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/Makefile +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/README.rst +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit/__init__.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit/directories.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit/helper.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit/units.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit/utils.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit.egg-info/dependency_links.txt +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit.egg-info/requires.txt +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/TypedUnit.egg-info/top_level.txt +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/conda.recipe/meta.yaml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/Makefile +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/examples/README.rst +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/examples/example_0.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/examples/example_1.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/images/logo.png +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/make.bat +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/redirect.html +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/source/_static/default.css +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/source/_static/layout.css +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/source/_static/thumbnail.png +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/docs/source/sg_execution_times.rst +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/pyproject.toml +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/pytest.ini +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/setup.cfg +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/tests/__init__.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/tests/test_0.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/tools/next_release_version.py +0 -0
- {typedunit-0.2.9 → typedunit-0.2.13}/tools/release_tag.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: Publish
|
|
1
|
+
name: Publish release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -8,10 +8,19 @@ permissions:
|
|
|
8
8
|
contents: read
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
|
-
|
|
11
|
+
pypi:
|
|
12
|
+
name: Publish to PyPI
|
|
13
|
+
uses: MartinPdeS/MPSActions/.github/workflows/publish_pure_package_to_PyPi.yml@a01969bc5af90666281f9d37acffdf6a4629763a
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.11"
|
|
16
|
+
test-command: python -c 'import TypedUnit; print(TypedUnit.__version__)'
|
|
17
|
+
secrets:
|
|
18
|
+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
19
|
+
|
|
20
|
+
conda:
|
|
21
|
+
name: Publish Conda package
|
|
12
22
|
uses: MartinPdeS/MPSActions/.github/workflows/publish_compiled_package_to_anaconda.yml@a01969bc5af90666281f9d37acffdf6a4629763a
|
|
13
23
|
with:
|
|
14
|
-
# One noarch archive supports all declared Python versions; test it on 3.14.
|
|
15
24
|
python_versions: '["3.14"]'
|
|
16
25
|
os_list: '["ubuntu-latest"]'
|
|
17
26
|
package_name: typedunit
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
21
|
+
__version__ = version = '0.2.13'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 13)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g62984b710'
|
|
@@ -9,10 +9,9 @@ README.rst
|
|
|
9
9
|
pyproject.toml
|
|
10
10
|
pytest.ini
|
|
11
11
|
.github/dependabot.yml
|
|
12
|
-
.github/workflows/deploy_PyPi.yml
|
|
13
|
-
.github/workflows/deploy_anaconda.yml
|
|
14
12
|
.github/workflows/deploy_coverage.yml
|
|
15
13
|
.github/workflows/deploy_documentation.yml
|
|
14
|
+
.github/workflows/deploy_release.yml
|
|
16
15
|
.github/workflows/quality.yml
|
|
17
16
|
.github/workflows/tests.yml
|
|
18
17
|
TypedUnit/__init__.py
|
|
@@ -42,9 +41,15 @@ docs/source/index.rst
|
|
|
42
41
|
docs/source/references.rst
|
|
43
42
|
docs/source/sg_execution_times.rst
|
|
44
43
|
docs/source/theory.rst
|
|
44
|
+
docs/source/units.rst
|
|
45
45
|
docs/source/_static/default.css
|
|
46
46
|
docs/source/_static/layout.css
|
|
47
47
|
docs/source/_static/thumbnail.png
|
|
48
|
+
docs/source/guide/concepts.rst
|
|
49
|
+
docs/source/guide/installation.rst
|
|
50
|
+
docs/source/guide/pint.rst
|
|
51
|
+
docs/source/guide/quickstart.rst
|
|
52
|
+
docs/source/guide/validation.rst
|
|
48
53
|
tests/__init__.py
|
|
49
54
|
tests/test_0.py
|
|
50
55
|
tools/next_release_version.py
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
".coveragerc",
|
|
4
4
|
".flake8",
|
|
5
5
|
".github/dependabot.yml",
|
|
6
|
-
".github/workflows/deploy_PyPi.yml",
|
|
7
|
-
".github/workflows/deploy_anaconda.yml",
|
|
8
6
|
".github/workflows/deploy_coverage.yml",
|
|
9
7
|
".github/workflows/deploy_documentation.yml",
|
|
8
|
+
".github/workflows/deploy_release.yml",
|
|
10
9
|
".github/workflows/quality.yml",
|
|
11
10
|
".github/workflows/tests.yml",
|
|
12
11
|
".gitignore",
|
|
@@ -34,10 +33,16 @@
|
|
|
34
33
|
"docs/source/_static/thumbnail.png",
|
|
35
34
|
"docs/source/code.rst",
|
|
36
35
|
"docs/source/conf.py",
|
|
36
|
+
"docs/source/guide/concepts.rst",
|
|
37
|
+
"docs/source/guide/installation.rst",
|
|
38
|
+
"docs/source/guide/pint.rst",
|
|
39
|
+
"docs/source/guide/quickstart.rst",
|
|
40
|
+
"docs/source/guide/validation.rst",
|
|
37
41
|
"docs/source/index.rst",
|
|
38
42
|
"docs/source/references.rst",
|
|
39
43
|
"docs/source/sg_execution_times.rst",
|
|
40
44
|
"docs/source/theory.rst",
|
|
45
|
+
"docs/source/units.rst",
|
|
41
46
|
"pyproject.toml",
|
|
42
47
|
"pytest.ini",
|
|
43
48
|
"tests/__init__.py",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.. _source_code:
|
|
2
|
+
|
|
3
|
+
API reference
|
|
4
|
+
=============
|
|
5
|
+
|
|
6
|
+
The reference below is generated from the public modules. See the user guide
|
|
7
|
+
for examples and design explanations.
|
|
8
|
+
|
|
9
|
+
.. automodule:: TypedUnit
|
|
10
|
+
:members:
|
|
11
|
+
:undoc-members:
|
|
12
|
+
:show-inheritance:
|
|
13
|
+
|
|
14
|
+
.. automodule:: TypedUnit.helper
|
|
15
|
+
:members:
|
|
16
|
+
:show-inheritance:
|
|
17
|
+
|
|
18
|
+
.. automodule:: TypedUnit.units
|
|
19
|
+
:members:
|
|
20
|
+
:show-inheritance:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Core concepts
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
TypedUnit has three complementary pieces.
|
|
5
|
+
|
|
6
|
+
Dimensional types
|
|
7
|
+
-----------------
|
|
8
|
+
|
|
9
|
+
Classes such as ``Length`` and ``Voltage`` are lightweight marker types. They
|
|
10
|
+
do not wrap or copy a quantity:
|
|
11
|
+
|
|
12
|
+
.. code-block:: python
|
|
13
|
+
|
|
14
|
+
distance = 2 * ureg.kilometer
|
|
15
|
+
isinstance(distance, Length) # True
|
|
16
|
+
isinstance(distance, Mass) # False
|
|
17
|
+
|
|
18
|
+
Pint still owns arithmetic, conversion, formatting, and NumPy integration.
|
|
19
|
+
|
|
20
|
+
The shared registry
|
|
21
|
+
-------------------
|
|
22
|
+
|
|
23
|
+
Import ``ureg`` from TypedUnit rather than constructing a second registry.
|
|
24
|
+
It includes domain units such as ``particle``, ``event``, ``photoelectron``,
|
|
25
|
+
and ``sqrt_hertz``.
|
|
26
|
+
|
|
27
|
+
Derived annotation types
|
|
28
|
+
------------------------
|
|
29
|
+
|
|
30
|
+
Unit classes can describe derived dimensions:
|
|
31
|
+
|
|
32
|
+
.. code-block:: python
|
|
33
|
+
|
|
34
|
+
EnergyPerTime = Energy / Time
|
|
35
|
+
isinstance(2 * ureg.watt, EnergyPerTime) # True
|
|
36
|
+
|
|
37
|
+
These expressions describe dimensions; use Pint expressions for calculations.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Installation
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
.. code-block:: console
|
|
5
|
+
|
|
6
|
+
$ python -m pip install TypedUnit
|
|
7
|
+
|
|
8
|
+
TypedUnit supports Python 3.10 and newer. Pydantic is optional; install it
|
|
9
|
+
separately when using Pydantic models or dataclasses.
|
|
10
|
+
|
|
11
|
+
For a development checkout:
|
|
12
|
+
|
|
13
|
+
.. code-block:: console
|
|
14
|
+
|
|
15
|
+
$ git clone https://github.com/MartinPdeS/TypedUnit.git
|
|
16
|
+
$ cd TypedUnit
|
|
17
|
+
$ python -m pip install -e ".[testing,documentation]"
|
|
18
|
+
$ pytest
|
|
19
|
+
|
|
20
|
+
The package exposes one application-wide registry, :data:`TypedUnit.ureg`.
|
|
21
|
+
Use it when creating quantities so dimensional checks remain consistent.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Working with Pint
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
TypedUnit is a thin layer over Pint. A quantity remains a normal
|
|
5
|
+
``pint.Quantity`` and can be converted, indexed, or used with NumPy.
|
|
6
|
+
|
|
7
|
+
.. code-block:: python
|
|
8
|
+
|
|
9
|
+
from TypedUnit import Length, ureg
|
|
10
|
+
|
|
11
|
+
diameter = 30 * ureg.centimeter
|
|
12
|
+
area = (diameter / 2) ** 2 * 3.14159
|
|
13
|
+
assert isinstance(diameter, Length)
|
|
14
|
+
print(area.to(ureg.square_meter))
|
|
15
|
+
|
|
16
|
+
Dimensionality is the source of truth: metres and kilometres are both
|
|
17
|
+
``Length``. Avoid mixing registries; use the shared ``TypedUnit.ureg`` at
|
|
18
|
+
integration boundaries when external libraries return quantities.
|
|
19
|
+
|
|
20
|
+
TypedUnit classes are markers, not constructors. Create values with Pint:
|
|
21
|
+
|
|
22
|
+
.. code-block:: python
|
|
23
|
+
|
|
24
|
+
energy = 3 * ureg.joule
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Quick start
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
Create quantities as you would with Pint, and use TypedUnit classes where
|
|
5
|
+
physical meaning matters:
|
|
6
|
+
|
|
7
|
+
.. code-block:: python
|
|
8
|
+
|
|
9
|
+
from TypedUnit import Energy, Power, Time, ureg, validate_units
|
|
10
|
+
|
|
11
|
+
energy = 100 * ureg.joule
|
|
12
|
+
duration = 10 * ureg.second
|
|
13
|
+
|
|
14
|
+
assert isinstance(energy, Energy)
|
|
15
|
+
assert isinstance(duration, Time)
|
|
16
|
+
|
|
17
|
+
@validate_units
|
|
18
|
+
def average_power(energy: Energy, duration: Time) -> Power:
|
|
19
|
+
return (energy / duration).to(ureg.watt)
|
|
20
|
+
|
|
21
|
+
print(average_power(energy, duration)) # 10.0 watt
|
|
22
|
+
|
|
23
|
+
Passing ``5 * ureg.meter`` as ``energy`` raises an error before the function
|
|
24
|
+
body runs. Conversion remains explicit: ``energy.to(ureg.kilojoule)``.
|
|
25
|
+
|
|
26
|
+
TypedUnit checks dimensionality, not the display unit. Joules and kilowatt
|
|
27
|
+
hours are both ``Energy``; metres are not.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Validating function inputs
|
|
2
|
+
==========================
|
|
3
|
+
|
|
4
|
+
Decorate a function after adding TypedUnit annotations:
|
|
5
|
+
|
|
6
|
+
.. code-block:: python
|
|
7
|
+
|
|
8
|
+
from TypedUnit import Energy, Time, validate_units, ureg
|
|
9
|
+
|
|
10
|
+
@validate_units
|
|
11
|
+
def energy_rate(energy: Energy, time: Time, label: str = "run"):
|
|
12
|
+
return energy / time, label
|
|
13
|
+
|
|
14
|
+
Only parameters annotated with a TypedUnit class are checked. Ordinary
|
|
15
|
+
annotations such as ``str`` and ``int`` are not runtime-validated, and return
|
|
16
|
+
values are not checked.
|
|
17
|
+
|
|
18
|
+
Optional and collection inputs
|
|
19
|
+
------------------------------
|
|
20
|
+
|
|
21
|
+
``Optional`` unit values and homogeneous lists or tuples are supported:
|
|
22
|
+
|
|
23
|
+
.. code-block:: python
|
|
24
|
+
|
|
25
|
+
from typing import Optional
|
|
26
|
+
from TypedUnit import Length, Time, validate_units, ureg
|
|
27
|
+
|
|
28
|
+
@validate_units
|
|
29
|
+
def summarize(points: list[Length], elapsed: Optional[Time] = None):
|
|
30
|
+
return len(points), elapsed
|
|
31
|
+
|
|
32
|
+
Invalid values raise ``ValueError`` with the parameter name and, for a
|
|
33
|
+
collection, its index. A required ``None`` is rejected as well.
|
|
34
|
+
|
|
35
|
+
Pydantic
|
|
36
|
+
--------
|
|
37
|
+
|
|
38
|
+
TypedUnit classes can be used as annotations in Pydantic dataclasses or
|
|
39
|
+
models. Use ``@validate_units`` on calculation functions that accept those
|
|
40
|
+
fields when an explicit function boundary is useful.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
**Date**: |today|, **Version**: |version|
|
|
2
|
+
|
|
3
|
+
TypedUnit documentation
|
|
4
|
+
=======================
|
|
5
|
+
|
|
6
|
+
TypedUnit adds readable, runtime-checkable physical quantity types to Pint.
|
|
7
|
+
It keeps Pint's quantity objects and operations while giving APIs a vocabulary
|
|
8
|
+
for physical meaning such as ``Length``, ``Energy``, and ``Frequency``.
|
|
9
|
+
|
|
10
|
+
Start here
|
|
11
|
+
----------
|
|
12
|
+
|
|
13
|
+
A typical TypedUnit workflow has three small steps:
|
|
14
|
+
|
|
15
|
+
#. Create values with the shared :data:`TypedUnit.ureg` registry.
|
|
16
|
+
#. Annotate boundaries with the dimensional type that the value represents.
|
|
17
|
+
#. Add :func:`TypedUnit.validate_units` where runtime validation is useful.
|
|
18
|
+
|
|
19
|
+
This keeps unit conversion and arithmetic in Pint while making interfaces
|
|
20
|
+
self-documenting and checking dimensional mistakes close to their source.
|
|
21
|
+
|
|
22
|
+
.. code-block:: python
|
|
23
|
+
|
|
24
|
+
from TypedUnit import Energy, ureg, validate_units
|
|
25
|
+
|
|
26
|
+
@validate_units
|
|
27
|
+
def efficiency(input_energy: Energy, output_energy: Energy) -> float:
|
|
28
|
+
return (output_energy / input_energy).to_base_units().magnitude
|
|
29
|
+
|
|
30
|
+
input_energy = 2 * ureg.kilojoule
|
|
31
|
+
output_energy = 500 * ureg.joule
|
|
32
|
+
print(efficiency(input_energy, output_energy))
|
|
33
|
+
|
|
34
|
+
Choose a path
|
|
35
|
+
-------------
|
|
36
|
+
|
|
37
|
+
* New to TypedUnit? Read :doc:`guide/installation` and :doc:`guide/quickstart`.
|
|
38
|
+
* Designing an API? See :doc:`guide/concepts` and :doc:`guide/validation`.
|
|
39
|
+
* Integrating with Pint or NumPy? Read :doc:`guide/pint`.
|
|
40
|
+
* Looking for a type or helper? Open :doc:`units` and :doc:`code`.
|
|
41
|
+
* Want runnable examples? Browse :doc:`gallery/index`.
|
|
42
|
+
|
|
43
|
+
What TypedUnit provides
|
|
44
|
+
-----------------------
|
|
45
|
+
|
|
46
|
+
TypedUnit supplies a shared registry, dimensional marker classes, and an
|
|
47
|
+
optional validation decorator. Marker classes describe what a value means;
|
|
48
|
+
they do not replace Pint quantities or introduce a second unit system.
|
|
49
|
+
|
|
50
|
+
The package is intentionally small at integration boundaries. Existing Pint
|
|
51
|
+
quantities can be passed through TypedUnit annotations, converted normally,
|
|
52
|
+
and used with NumPy. Applications can adopt the annotations incrementally,
|
|
53
|
+
starting with public functions and configuration models.
|
|
54
|
+
|
|
55
|
+
Compatibility notes
|
|
56
|
+
-------------------
|
|
57
|
+
|
|
58
|
+
Use :data:`TypedUnit.ureg` throughout an application. Quantities created by a
|
|
59
|
+
second Pint registry may have compatible dimensions but are different runtime
|
|
60
|
+
objects, which can make validation and comparisons surprising. Convert values
|
|
61
|
+
at library boundaries and keep registry ownership explicit.
|
|
62
|
+
|
|
63
|
+
.. toctree::
|
|
64
|
+
:maxdepth: 2
|
|
65
|
+
:caption: Learn
|
|
66
|
+
|
|
67
|
+
guide/installation
|
|
68
|
+
guide/quickstart
|
|
69
|
+
guide/concepts
|
|
70
|
+
guide/validation
|
|
71
|
+
guide/pint
|
|
72
|
+
theory
|
|
73
|
+
|
|
74
|
+
.. toctree::
|
|
75
|
+
:maxdepth: 2
|
|
76
|
+
:caption: API reference
|
|
77
|
+
|
|
78
|
+
units
|
|
79
|
+
code
|
|
80
|
+
references
|
|
81
|
+
|
|
82
|
+
.. toctree::
|
|
83
|
+
:maxdepth: 2
|
|
84
|
+
:caption: Examples
|
|
85
|
+
|
|
86
|
+
gallery/index
|
|
87
|
+
|
|
88
|
+
Indices and tables
|
|
89
|
+
==================
|
|
90
|
+
|
|
91
|
+
* :ref:`genindex`
|
|
92
|
+
* :ref:`modindex`
|
|
93
|
+
* :ref:`search`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
.. _references:
|
|
2
|
+
|
|
3
|
+
References
|
|
4
|
+
===========
|
|
5
|
+
|
|
6
|
+
* `Pint documentation <https://pint.readthedocs.io/>`_ — quantities,
|
|
7
|
+
dimensionality, conversion, and registries.
|
|
8
|
+
* `Python typing documentation <https://docs.python.org/3/library/typing.html>`_
|
|
9
|
+
— annotation syntax used by the validator.
|
|
10
|
+
* `Pydantic documentation <https://docs.pydantic.dev/>`_ — model and dataclass
|
|
11
|
+
validation when Pydantic is installed.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.. _theory:
|
|
2
|
+
|
|
3
|
+
Theoretical background
|
|
4
|
+
======================
|
|
5
|
+
|
|
6
|
+
TypedUnit separates values from meaning. Pint stores a magnitude and unit and
|
|
7
|
+
performs dimensional arithmetic. TypedUnit maps selected Pint dimensionalities
|
|
8
|
+
to Python classes, allowing the same meaning to appear in annotations and
|
|
9
|
+
runtime checks without changing the quantity object.
|
|
10
|
+
|
|
11
|
+
For practical usage, start with :doc:`guide/quickstart` and
|
|
12
|
+
:doc:`guide/validation`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Unit types
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
All public unit classes are re-exported from ``TypedUnit``.
|
|
5
|
+
|
|
6
|
+
.. list-table:: Common types
|
|
7
|
+
:header-rows: 1
|
|
8
|
+
:widths: 28 36 36
|
|
9
|
+
|
|
10
|
+
* - Type
|
|
11
|
+
- Dimension
|
|
12
|
+
- Typical units
|
|
13
|
+
* - ``Length`` / ``Area`` / ``Volume``
|
|
14
|
+
- length / length squared / volume
|
|
15
|
+
- meter, square_meter, liter
|
|
16
|
+
* - ``Mass`` / ``Time`` / ``Frequency``
|
|
17
|
+
- mass / time / inverse time
|
|
18
|
+
- kilogram, second, hertz
|
|
19
|
+
* - ``Velocity`` / ``FlowRate``
|
|
20
|
+
- length per time / liter per second
|
|
21
|
+
- meter / second, liter / second
|
|
22
|
+
* - ``Energy`` / ``Power``
|
|
23
|
+
- energy / energy per time
|
|
24
|
+
- joule, watt
|
|
25
|
+
* - ``Voltage`` / ``Current`` / ``Resistance``
|
|
26
|
+
- potential / current / resistance
|
|
27
|
+
- volt, ampere, ohm
|
|
28
|
+
* - ``Temperature`` / ``Angle``
|
|
29
|
+
- temperature / angle
|
|
30
|
+
- kelvin, degree
|
|
31
|
+
* - ``Dimensionless`` / ``AnyUnit``
|
|
32
|
+
- no dimensions / any dimensionality
|
|
33
|
+
- dimensionless / any Pint quantity
|
|
34
|
+
|
|
35
|
+
See :doc:`code` for the complete generated class reference.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: Publish to PyPI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags: ["v*"]
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
contents: read
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
publish:
|
|
12
|
-
uses: MartinPdeS/MPSActions/.github/workflows/publish_pure_package_to_PyPi.yml@a01969bc5af90666281f9d37acffdf6a4629763a
|
|
13
|
-
with:
|
|
14
|
-
python-version: "3.11"
|
|
15
|
-
# The reusable workflow wraps this command in double quotes.
|
|
16
|
-
test-command: python -c 'import TypedUnit; print(TypedUnit.__version__)'
|
|
17
|
-
secrets:
|
|
18
|
-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
.. _source_code:
|
|
2
|
-
|
|
3
|
-
Source Code
|
|
4
|
-
===========
|
|
5
|
-
|
|
6
|
-
This section provides an overview of the primary classes used in the `FiberFusing` package. Each class includes detailed descriptions of its members and inherited members, organized by their source order for easy reference.
|
|
7
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|