engunits 0.1.0__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.
@@ -0,0 +1,33 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: "3.12"
15
+ - run: pip install build
16
+ - run: python -m build
17
+ - uses: actions/upload-artifact@v4
18
+ with:
19
+ name: dist
20
+ path: dist/
21
+
22
+ publish:
23
+ needs: build
24
+ runs-on: ubuntu-latest
25
+ environment: pypi
26
+ permissions:
27
+ id-token: write
28
+ steps:
29
+ - uses: actions/download-artifact@v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,23 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - run: pip install -e ".[dev]"
21
+ - run: ruff check src/ tests/
22
+ - run: ruff format --check src/ tests/
23
+ - run: pytest --cov=engunits
@@ -0,0 +1,43 @@
1
+ # User-specific files
2
+ .claude/
3
+ CLAUDE.md
4
+
5
+ # Python
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+ *.egg-info/
10
+ *.egg
11
+ dist/
12
+ build/
13
+ *.so
14
+
15
+ # Virtual environments
16
+ .venv/
17
+ venv/
18
+
19
+ # IDE
20
+ .vscode/
21
+ .idea/
22
+ *.swp
23
+ *.swo
24
+ *~
25
+
26
+ # OS
27
+ .DS_Store
28
+ Thumbs.db
29
+
30
+ # Testing / Coverage
31
+ .coverage
32
+ htmlcov/
33
+ .pytest_cache/
34
+
35
+ # Linting
36
+ .mypy_cache/
37
+ .ruff_cache/
38
+
39
+ # Docs
40
+ docs/_build/
41
+
42
+ # Claude Code (user-specific)
43
+ .claude/settings.local.json
engunits-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matúš Cvengroš
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: engunits
3
+ Version: 0.1.0
4
+ Summary: Typed engineering quantities with SI-default storage, built on pint
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.12
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: numpy>=2.0
10
+ Requires-Dist: pint>=0.24
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=9.0; extra == "dev"
13
+ Requires-Dist: pytest-cov>=7.0; extra == "dev"
14
+ Requires-Dist: ruff>=0.9; extra == "dev"
15
+ Provides-Extra: docs
16
+ Requires-Dist: sphinx>=8.0; extra == "docs"
17
+ Requires-Dist: furo; extra == "docs"
18
+ Requires-Dist: myst-parser; extra == "docs"
19
+ Requires-Dist: sphinx-copybutton; extra == "docs"
20
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
21
+ Dynamic: license-file
22
+
23
+ # engunits
24
+
25
+ [![Tests](https://github.com/matuscvengros/engunits/actions/workflows/tests.yml/badge.svg)](https://github.com/matuscvengros/engunits/actions/workflows/tests.yml)
26
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
27
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
28
+
29
+ Typed engineering quantities with SI-default storage, built on [pint](https://pint.readthedocs.io/).
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ pip install engunits
35
+ ```
36
+
37
+ ## Quick start
38
+
39
+ ```python
40
+ from engunits import Mass, Length, Velocity
41
+
42
+ # Create quantities — SI units by default
43
+ m = Mass(1000, "lb") # stored internally as kg
44
+ l = Length(5, "ft") # stored internally as m
45
+
46
+ # Convert on demand
47
+ print(m("kg")) # 453.592 kg
48
+ print(l("m")) # 1.524 m
49
+
50
+ # Callable syntax for conversion
51
+ v = Velocity(100, "m/s")
52
+ print(v("ft/s")) # 328.084 ft/s
53
+
54
+ # Arithmetic
55
+ total = Mass(10, "kg") + Mass(5, "kg")
56
+ scaled = Length(3, "m") * 2
57
+ ratio = Mass(30, "kg") / Mass(10, "kg") # returns float: 3.0
58
+ ```
59
+
60
+ ## Supported quantities
61
+
62
+ | Class | SI Unit |
63
+ |-------------------|-----------|
64
+ | `Mass` | kg |
65
+ | `Length` | m |
66
+ | `Time` | s |
67
+ | `Temperature` | K |
68
+ | `Velocity` | m/s |
69
+ | `Force` | N |
70
+ | `Moment` | N·m |
71
+ | `Power` | W |
72
+ | `Energy` | J |
73
+ | `Area` | m² |
74
+ | `Volume` | m³ |
75
+ | `Density` | kg/m³ |
76
+ | `Pressure` | Pa |
77
+ | `AngularVelocity`| rad/s |
78
+ | `Voltage` | V |
79
+ | `Current` | A |
80
+ | `Capacity` | A·h |
81
+
82
+ ## License
83
+
84
+ MIT
@@ -0,0 +1,62 @@
1
+ # engunits
2
+
3
+ [![Tests](https://github.com/matuscvengros/engunits/actions/workflows/tests.yml/badge.svg)](https://github.com/matuscvengros/engunits/actions/workflows/tests.yml)
4
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
6
+
7
+ Typed engineering quantities with SI-default storage, built on [pint](https://pint.readthedocs.io/).
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install engunits
13
+ ```
14
+
15
+ ## Quick start
16
+
17
+ ```python
18
+ from engunits import Mass, Length, Velocity
19
+
20
+ # Create quantities — SI units by default
21
+ m = Mass(1000, "lb") # stored internally as kg
22
+ l = Length(5, "ft") # stored internally as m
23
+
24
+ # Convert on demand
25
+ print(m("kg")) # 453.592 kg
26
+ print(l("m")) # 1.524 m
27
+
28
+ # Callable syntax for conversion
29
+ v = Velocity(100, "m/s")
30
+ print(v("ft/s")) # 328.084 ft/s
31
+
32
+ # Arithmetic
33
+ total = Mass(10, "kg") + Mass(5, "kg")
34
+ scaled = Length(3, "m") * 2
35
+ ratio = Mass(30, "kg") / Mass(10, "kg") # returns float: 3.0
36
+ ```
37
+
38
+ ## Supported quantities
39
+
40
+ | Class | SI Unit |
41
+ |-------------------|-----------|
42
+ | `Mass` | kg |
43
+ | `Length` | m |
44
+ | `Time` | s |
45
+ | `Temperature` | K |
46
+ | `Velocity` | m/s |
47
+ | `Force` | N |
48
+ | `Moment` | N·m |
49
+ | `Power` | W |
50
+ | `Energy` | J |
51
+ | `Area` | m² |
52
+ | `Volume` | m³ |
53
+ | `Density` | kg/m³ |
54
+ | `Pressure` | Pa |
55
+ | `AngularVelocity`| rad/s |
56
+ | `Voltage` | V |
57
+ | `Current` | A |
58
+ | `Capacity` | A·h |
59
+
60
+ ## License
61
+
62
+ MIT
@@ -0,0 +1,14 @@
1
+ # Minimal makefile for Sphinx documentation
2
+
3
+ SPHINXOPTS ?=
4
+ SPHINXBUILD ?= sphinx-build
5
+ SOURCEDIR = .
6
+ BUILDDIR = _build
7
+
8
+ .PHONY: help Makefile
9
+
10
+ help:
11
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
12
+
13
+ %: Makefile
14
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,7 @@
1
+ # base
2
+
3
+ ```{eval-rst}
4
+ .. automodule:: engunits.base
5
+ :members:
6
+ :undoc-members:
7
+ ```
@@ -0,0 +1,7 @@
1
+ # config
2
+
3
+ ```{eval-rst}
4
+ .. automodule:: engunits.config
5
+ :members:
6
+ :undoc-members:
7
+ ```
@@ -0,0 +1,15 @@
1
+ # API Reference
2
+
3
+ ```{toctree}
4
+ :maxdepth: 1
5
+
6
+ base
7
+ config
8
+ quantities
9
+ registry
10
+ ```
11
+
12
+ ```{eval-rst}
13
+ .. automodule:: engunits
14
+ :no-members:
15
+ ```
@@ -0,0 +1,7 @@
1
+ # quantities
2
+
3
+ ```{eval-rst}
4
+ .. automodule:: engunits.quantities
5
+ :members:
6
+ :undoc-members:
7
+ ```
@@ -0,0 +1,13 @@
1
+ # registry
2
+
3
+ ```{eval-rst}
4
+ .. automodule:: engunits.registry
5
+ :members:
6
+ :undoc-members:
7
+ :exclude-members: ureg
8
+
9
+ .. data:: ureg
10
+ :type: pint.UnitRegistry
11
+
12
+ Application-wide unit registry instance.
13
+ ```
@@ -0,0 +1,34 @@
1
+ project = "engunits"
2
+ copyright = "2026, Matus Cvengros"
3
+ version = "0.1.0"
4
+
5
+ extensions = [
6
+ "myst_parser",
7
+ "sphinx.ext.autodoc",
8
+ "sphinx.ext.napoleon",
9
+ "sphinx.ext.intersphinx",
10
+ "sphinx.ext.viewcode",
11
+ "sphinx_copybutton",
12
+ "sphinx_autodoc_typehints",
13
+ ]
14
+
15
+ # MyST settings
16
+ myst_enable_extensions = ["colon_fence", "deflist"]
17
+
18
+ # Autodoc
19
+ autodoc_member_order = "bysource"
20
+ autodoc_typehints = "description"
21
+
22
+ # Napoleon (Google-style docstrings)
23
+ napoleon_google_docstring = True
24
+ napoleon_numpy_docstring = False
25
+
26
+ # Intersphinx — link to numpy/pint docs
27
+ intersphinx_mapping = {
28
+ "python": ("https://docs.python.org/3", None),
29
+ "numpy": ("https://numpy.org/doc/stable/", None),
30
+ }
31
+
32
+ # Theme
33
+ html_theme = "furo"
34
+ html_title = "engunits"
@@ -0,0 +1,9 @@
1
+ # engunits
2
+
3
+ Typed engineering quantities with SI-default storage, built on pint.
4
+
5
+ ```{toctree}
6
+ :maxdepth: 2
7
+
8
+ api/index
9
+ ```
@@ -0,0 +1,54 @@
1
+ [project]
2
+ name = "engunits"
3
+ dynamic = ["version"]
4
+ description = "Typed engineering quantities with SI-default storage, built on pint"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.12"
8
+ dependencies = [
9
+ "numpy>=2.0",
10
+ "pint>=0.24",
11
+ ]
12
+
13
+ [project.optional-dependencies]
14
+ dev = [
15
+ "pytest>=9.0",
16
+ "pytest-cov>=7.0",
17
+ "ruff>=0.9",
18
+ ]
19
+ docs = [
20
+ "sphinx>=8.0",
21
+ "furo",
22
+ "myst-parser",
23
+ "sphinx-copybutton",
24
+ "sphinx-autodoc-typehints",
25
+ ]
26
+
27
+ [build-system]
28
+ requires = ["setuptools>=75.0", "setuptools-scm>=8.0"]
29
+ build-backend = "setuptools.build_meta"
30
+
31
+ [tool.setuptools_scm]
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
35
+
36
+ [tool.pytest.ini_options]
37
+ testpaths = ["tests"]
38
+ addopts = ["--strict-markers", "--tb=short", "-q"]
39
+
40
+ [tool.ruff]
41
+ target-version = "py312"
42
+ line-length = 99
43
+ src = ["src", "tests"]
44
+
45
+ [tool.ruff.lint]
46
+ select = ["E", "W", "F", "I", "N", "UP", "B", "SIM", "RUF"]
47
+ ignore = ["E501"]
48
+
49
+ [tool.ruff.lint.isort]
50
+ known-first-party = ["engunits"]
51
+
52
+ [tool.ruff.format]
53
+ quote-style = "double"
54
+ indent-style = "space"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,46 @@
1
+ """Typed engineering quantities with SI-default storage, built on pint."""
2
+
3
+ from engunits.quantities import (
4
+ AngularVelocity,
5
+ Area,
6
+ Capacity,
7
+ Current,
8
+ Density,
9
+ Energy,
10
+ Force,
11
+ Length,
12
+ Mass,
13
+ Moment,
14
+ Power,
15
+ Pressure,
16
+ Temperature,
17
+ Time,
18
+ Velocity,
19
+ Voltage,
20
+ Volume,
21
+ )
22
+ from engunits.registry import Q_, ureg
23
+
24
+ __all__ = [
25
+ "Q_",
26
+ "AngularVelocity",
27
+ "Area",
28
+ "Capacity",
29
+ "Current",
30
+ "Density",
31
+ "Energy",
32
+ "Force",
33
+ "Length",
34
+ "Mass",
35
+ "Moment",
36
+ "Power",
37
+ "Pressure",
38
+ "Temperature",
39
+ "Time",
40
+ "Velocity",
41
+ "Voltage",
42
+ "Volume",
43
+ "ureg",
44
+ ]
45
+
46
+ __version__ = "0.1.0"