unitforge 0.4.2__tar.gz → 0.5.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.
- unitforge-0.5.0/.gitlab-ci.yml +137 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/Cargo.lock +9 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/Cargo.toml +15 -6
- {unitforge-0.4.2 → unitforge-0.5.0}/PKG-INFO +1 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/Readme.md +2 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/install_hooks.sh +0 -0
- unitforge-0.5.0/python/unitforge/__init__.pyi +2041 -0
- unitforge-0.5.0/python/unitforge/py.typed +0 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/scripts/generate_python_stubs.py +4 -0
- unitforge-0.5.0/src/errors.rs +159 -0
- unitforge-0.5.0/src/impl_macros.rs +1468 -0
- unitforge-0.5.0/src/internal.rs +264 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/src/lib.rs +79 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/src/prelude.rs +24 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/acceleration.rs +14 -8
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/angle.rs +20 -8
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/angular_acceleration.rs +11 -5
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/angular_velocity.rs +11 -5
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/area.rs +19 -13
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/area_of_moment.rs +9 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/charge.rs +10 -4
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/compliance.rs +9 -3
- unitforge-0.5.0/src/quantities/density.rs +128 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/distance.rs +34 -28
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/force.rs +19 -13
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/force_area.rs +9 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/force_distance.rs +24 -19
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/force_div_distance_power_four.rs +10 -4
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/force_per_volume.rs +10 -4
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/force_stress.rs +9 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/force_volume.rs +9 -3
- unitforge-0.5.0/src/quantities/frequency.rs +77 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/inverse_angle.rs +9 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/inverse_area.rs +9 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/inverse_distance.rs +19 -13
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/inverse_stress.rs +9 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/mass.rs +33 -38
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/mass_per_distance.rs +9 -3
- unitforge-0.5.0/src/quantities/molar_mass.rs +38 -0
- unitforge-0.5.0/src/quantities/pressure_rate.rs +47 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/rotational_stiffness.rs +10 -4
- unitforge-0.5.0/src/quantities/specific_gas_constant.rs +39 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/stiffness.rs +12 -6
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/strain.rs +13 -8
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/stress.rs +14 -8
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/stress_squared.rs +9 -3
- unitforge-0.5.0/src/quantities/temperature.rs +38 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/time.rs +29 -12
- unitforge-0.5.0/src/quantities/universal_gas_constant.rs +41 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/velocity.rs +14 -8
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/velocity_squared.rs +16 -4
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/voltage.rs +13 -7
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities/volume.rs +19 -13
- {unitforge-0.4.2 → unitforge-0.5.0}/src/quantities.template.rs +84 -80
- {unitforge-0.4.2 → unitforge-0.5.0}/src/relations.rs +7 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/bindings/matrix3_py.template.rs +2 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/bindings/vector3_py.template.rs +61 -15
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/matrix2.rs +20 -9
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/matrix2x3.rs +16 -5
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/matrix3.rs +25 -12
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/matrix3x2.rs +16 -5
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/vector2.rs +18 -8
- {unitforge-0.4.2 → unitforge-0.5.0}/src/small_linalg/vector3.rs +19 -12
- {unitforge-0.4.2 → unitforge-0.5.0}/test.sh +124 -18
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/matrix2.rs +3 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/matrix2x3.rs +10 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/matrix3.rs +11 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/matrix3x2.rs +10 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/ndarray_dot.rs +2 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantities.rs +215 -18
- unitforge-0.5.0/tests/quantity_core/constants.rs +109 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core/construction.rs +2 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core/metadata.rs +20 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core/normalization.rs +1 -1
- unitforge-0.5.0/tests/quantity_core/plain_storage.rs +34 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core/relations.rs +13 -5
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core/runtime_quantity.rs +13 -5
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core/scalar_edges.rs +4 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core.rs +6 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_serde.rs +40 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/small_linalg_edge_cases.rs +56 -9
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/small_linalg_interfaces.rs +2 -2
- unitforge-0.5.0/tests/test_quantities.py +86 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/test_small_linalg.py +55 -2
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/vector2.rs +18 -3
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/vector3.rs +3 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/unitforge_macros/Cargo.toml +1 -1
- {unitforge-0.4.2 → unitforge-0.5.0}/unitforge_macros/src/lib.rs +6 -6
- unitforge-0.4.2/.gitlab-ci.yml +0 -43
- unitforge-0.4.2/src/impl_macros.rs +0 -1000
- unitforge-0.4.2/src/internal.rs +0 -55
- unitforge-0.4.2/src/quantities/density.rs +0 -122
- unitforge-0.4.2/src/quantities/mass_div_time_squared_volume.rs +0 -30
- unitforge-0.4.2/tests/test_quantities.py +0 -38
- {unitforge-0.4.2 → unitforge-0.5.0}/.gitignore +0 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/Readme_py.md +0 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/pyproject.toml +0 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/python/unitforge/__init__.py +0 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/common/mod.rs +0 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/quantity_core/enum_iter.rs +0 -0
- {unitforge-0.4.2 → unitforge-0.5.0}/tests/typecheck/mypy_smoke.py +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
image: "rust:latest"
|
|
2
|
+
|
|
3
|
+
stages:
|
|
4
|
+
- lint
|
|
5
|
+
- test
|
|
6
|
+
- python
|
|
7
|
+
|
|
8
|
+
variables:
|
|
9
|
+
CARGO_TERM_COLOR: always
|
|
10
|
+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
|
11
|
+
|
|
12
|
+
.default_rust:
|
|
13
|
+
before_script:
|
|
14
|
+
- rustc --version
|
|
15
|
+
- cargo --version
|
|
16
|
+
|
|
17
|
+
.default_python:
|
|
18
|
+
before_script:
|
|
19
|
+
- apt-get update
|
|
20
|
+
- apt-get install -y python3 python3-venv python3-dev pkg-config
|
|
21
|
+
- python3 --version
|
|
22
|
+
|
|
23
|
+
# --------------------
|
|
24
|
+
# LINT
|
|
25
|
+
# --------------------
|
|
26
|
+
|
|
27
|
+
lint:
|
|
28
|
+
stage: lint
|
|
29
|
+
extends: .default_rust
|
|
30
|
+
script:
|
|
31
|
+
- ./test.sh lint-base
|
|
32
|
+
allow_failure: true
|
|
33
|
+
|
|
34
|
+
lint_serde:
|
|
35
|
+
stage: lint
|
|
36
|
+
extends: .default_rust
|
|
37
|
+
script:
|
|
38
|
+
- ./test.sh lint-serde
|
|
39
|
+
allow_failure: true
|
|
40
|
+
|
|
41
|
+
lint_strum:
|
|
42
|
+
stage: lint
|
|
43
|
+
extends: .default_rust
|
|
44
|
+
script:
|
|
45
|
+
- ./test.sh lint-strum
|
|
46
|
+
allow_failure: true
|
|
47
|
+
|
|
48
|
+
lint_pyo3:
|
|
49
|
+
stage: lint
|
|
50
|
+
extends: .default_rust
|
|
51
|
+
script:
|
|
52
|
+
- ./test.sh lint-pyo3
|
|
53
|
+
allow_failure: true
|
|
54
|
+
|
|
55
|
+
# --------------------
|
|
56
|
+
# RUST TESTS
|
|
57
|
+
# --------------------
|
|
58
|
+
|
|
59
|
+
test_base:
|
|
60
|
+
stage: test
|
|
61
|
+
extends: .default_rust
|
|
62
|
+
script:
|
|
63
|
+
- ./test.sh test-base
|
|
64
|
+
|
|
65
|
+
test_serde:
|
|
66
|
+
stage: test
|
|
67
|
+
extends: .default_rust
|
|
68
|
+
script:
|
|
69
|
+
- ./test.sh test-serde
|
|
70
|
+
|
|
71
|
+
test_strum:
|
|
72
|
+
stage: test
|
|
73
|
+
extends: .default_rust
|
|
74
|
+
script:
|
|
75
|
+
- ./test.sh test-strum
|
|
76
|
+
|
|
77
|
+
test_no_ndarray:
|
|
78
|
+
stage: test
|
|
79
|
+
extends: .default_rust
|
|
80
|
+
script:
|
|
81
|
+
- ./test.sh test-no-ndarray
|
|
82
|
+
|
|
83
|
+
test_serde_no_ndarray:
|
|
84
|
+
stage: test
|
|
85
|
+
extends: .default_rust
|
|
86
|
+
script:
|
|
87
|
+
- ./test.sh test-serde-no-ndarray
|
|
88
|
+
|
|
89
|
+
test_strum_no_ndarray:
|
|
90
|
+
stage: test
|
|
91
|
+
extends: .default_rust
|
|
92
|
+
script:
|
|
93
|
+
- ./test.sh test-strum-no-ndarray
|
|
94
|
+
|
|
95
|
+
test_plain_f64:
|
|
96
|
+
stage: test
|
|
97
|
+
extends: .default_rust
|
|
98
|
+
script:
|
|
99
|
+
- ./test.sh test-plain-f64
|
|
100
|
+
|
|
101
|
+
test_plain_f64_serde:
|
|
102
|
+
stage: test
|
|
103
|
+
extends: .default_rust
|
|
104
|
+
script:
|
|
105
|
+
- ./test.sh test-plain-f64-serde
|
|
106
|
+
|
|
107
|
+
test_plain_f32:
|
|
108
|
+
stage: test
|
|
109
|
+
extends: .default_rust
|
|
110
|
+
script:
|
|
111
|
+
- ./test.sh test-plain-f32
|
|
112
|
+
|
|
113
|
+
test_plain_f32_serde:
|
|
114
|
+
stage: test
|
|
115
|
+
extends: .default_rust
|
|
116
|
+
script:
|
|
117
|
+
- ./test.sh test-plain-f32-serde
|
|
118
|
+
|
|
119
|
+
# --------------------
|
|
120
|
+
# PYTHON / PYO3
|
|
121
|
+
# --------------------
|
|
122
|
+
|
|
123
|
+
test_pyo3:
|
|
124
|
+
stage: python
|
|
125
|
+
extends:
|
|
126
|
+
- .default_rust
|
|
127
|
+
- .default_python
|
|
128
|
+
script:
|
|
129
|
+
- ./test.sh test-pyo3
|
|
130
|
+
|
|
131
|
+
typecheck_pyo3:
|
|
132
|
+
stage: python
|
|
133
|
+
extends:
|
|
134
|
+
- .default_rust
|
|
135
|
+
- .default_python
|
|
136
|
+
script:
|
|
137
|
+
- ./test.sh typecheck-pyo3
|
|
@@ -125,6 +125,12 @@ version = "1.21.3"
|
|
|
125
125
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
126
126
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
127
127
|
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "paste"
|
|
130
|
+
version = "1.0.15"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
|
133
|
+
|
|
128
134
|
[[package]]
|
|
129
135
|
name = "portable-atomic"
|
|
130
136
|
version = "1.10.0"
|
|
@@ -345,11 +351,12 @@ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
|
|
345
351
|
|
|
346
352
|
[[package]]
|
|
347
353
|
name = "unitforge"
|
|
348
|
-
version = "0.
|
|
354
|
+
version = "0.5.0"
|
|
349
355
|
dependencies = [
|
|
350
356
|
"ndarray",
|
|
351
357
|
"num-traits",
|
|
352
358
|
"numpy",
|
|
359
|
+
"paste",
|
|
353
360
|
"pyo3",
|
|
354
361
|
"serde",
|
|
355
362
|
"serde_json",
|
|
@@ -360,7 +367,7 @@ dependencies = [
|
|
|
360
367
|
|
|
361
368
|
[[package]]
|
|
362
369
|
name = "unitforge_macros"
|
|
363
|
-
version = "0.
|
|
370
|
+
version = "0.5.0"
|
|
364
371
|
dependencies = [
|
|
365
372
|
"regex",
|
|
366
373
|
]
|
|
@@ -4,7 +4,7 @@ crate-type = ["cdylib", "rlib"]
|
|
|
4
4
|
|
|
5
5
|
[package]
|
|
6
6
|
name = "unitforge"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.0"
|
|
8
8
|
edition = "2021"
|
|
9
9
|
authors = ["Dr.Q team <info@askdrq.com>", "Henrik Stromberg <henrik@askdrq.com>"]
|
|
10
10
|
description = "A library for unit and quantity consistent computations in Rust"
|
|
@@ -15,20 +15,29 @@ readme = "Readme.md"
|
|
|
15
15
|
# ToDo: documentation
|
|
16
16
|
|
|
17
17
|
[dependencies]
|
|
18
|
-
ndarray = { version = "0.16" }
|
|
19
|
-
num-traits = "0.2.19"
|
|
18
|
+
ndarray = { version = "0.16", optional = true }
|
|
19
|
+
num-traits = { version = "0.2.19", default-features = false }
|
|
20
|
+
paste = "1.0.15"
|
|
20
21
|
serde = { version = "1", optional = true, features = ["derive"] }
|
|
21
22
|
serde_json = { version = "1.0.140", optional = true }
|
|
22
23
|
pyo3 = { version = "0.28.3", features = ["extension-module", "auto-initialize", "multiple-pymethods"], optional = true }
|
|
23
24
|
numpy = { version = "0.28.0", optional = true }
|
|
24
25
|
strum = { version = "0.28.0", optional = true }
|
|
25
26
|
strum_macros = { version = "0.28.0", optional = true }
|
|
26
|
-
unitforge_macros = { version = "0.
|
|
27
|
+
unitforge_macros = { version = "0.5.0", path = "unitforge_macros" }
|
|
27
28
|
|
|
28
29
|
[features]
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
default = []
|
|
31
|
+
ndarray = ["dep:ndarray"]
|
|
32
|
+
serde = ["dep:serde", "dep:serde_json", "ndarray?/serde"]
|
|
33
|
+
pyo3 = ["dep:pyo3", "dep:numpy", "ndarray"]
|
|
31
34
|
strum = ["dep:strum", "dep:strum_macros"]
|
|
35
|
+
storage-f64 = []
|
|
36
|
+
storage-f32 = []
|
|
37
|
+
no_std = []
|
|
32
38
|
|
|
33
39
|
[workspace]
|
|
34
40
|
members = ["unitforge_macros"]
|
|
41
|
+
|
|
42
|
+
[profile.dev]
|
|
43
|
+
panic = "abort"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unitforge
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -9,9 +9,7 @@ Classifier: Topic :: Scientific/Engineering :: Physics
|
|
|
9
9
|
Requires-Dist: numpy>=2.2.0
|
|
10
10
|
Summary: A library for unit and quantity consistent computations in Rust
|
|
11
11
|
Keywords: units,quantities,simulation,physics
|
|
12
|
-
Author: Dr.Q team <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
|
|
13
12
|
Author-email: "Dr.Q team" <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
|
|
14
|
-
License: MIT
|
|
15
13
|
Requires-Python: >=3.7
|
|
16
14
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
15
|
Project-URL: Repository, https://gitlab.com/henrikjstromberg/unitforge
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
- **Unit conversion:** Quantities can be set or read in arbitrary units.
|
|
11
11
|
- **Computing Precision** Values are stored in exponential format (f64*10^i32) to prevent floating point precision issues.
|
|
12
12
|
- **Formating** Quantities are displayed with 4 significant digits and configured display unit.
|
|
13
|
-
- **ndarray support:**
|
|
13
|
+
- **ndarray support:** Optional `ndarray` integration with `features = ["ndarray"]`; quantities may be used as inner types for arrays.
|
|
14
14
|
- **3D Vector and matrix operations:** Structs for 3D vectors and matrices are included to allow fast and unit-safe work with them.
|
|
15
|
-
- **Serialization**: Optional support for
|
|
15
|
+
- **Serialization**: Optional support for serde using `features = ["serde"]`; combine with `ndarray` for ndarray serialization support.
|
|
16
16
|
- **python interface** Optional Python interface when building with flag pyo3; also available on pypi
|
|
17
17
|
|
|
18
18
|
## Contribute
|
|
File without changes
|