qnty 0.0.7__tar.gz → 0.0.9__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.
- qnty-0.0.9/PKG-INFO +199 -0
- qnty-0.0.9/README.md +167 -0
- {qnty-0.0.7 → qnty-0.0.9}/pyproject.toml +1 -1
- qnty-0.0.9/src/qnty/__init__.py +256 -0
- qnty-0.0.9/src/qnty/_backup/problem_original.py +1251 -0
- qnty-0.0.9/src/qnty/_backup/quantity.py +63 -0
- qnty-0.0.9/src/qnty/codegen/cli.py +125 -0
- qnty-0.0.9/src/qnty/codegen/generators/data/unit_data.json +8807 -0
- qnty-0.0.9/src/qnty/codegen/generators/data_processor.py +345 -0
- qnty-0.0.9/src/qnty/codegen/generators/dimensions_gen.py +434 -0
- qnty-0.0.9/src/qnty/codegen/generators/doc_generator.py +141 -0
- qnty-0.0.9/src/qnty/codegen/generators/out/dimension_mapping.json +974 -0
- qnty-0.0.9/src/qnty/codegen/generators/out/dimension_metadata.json +123 -0
- qnty-0.0.9/src/qnty/codegen/generators/out/units_metadata.json +223 -0
- qnty-0.0.9/src/qnty/codegen/generators/quantities_gen.py +159 -0
- qnty-0.0.9/src/qnty/codegen/generators/setters_gen.py +178 -0
- qnty-0.0.9/src/qnty/codegen/generators/stubs_gen.py +167 -0
- qnty-0.0.9/src/qnty/codegen/generators/units_gen.py +295 -0
- qnty-0.0.9/src/qnty/codegen/generators/utils/__init__.py +0 -0
- qnty-0.0.9/src/qnty/equations/__init__.py +4 -0
- qnty-0.0.9/src/qnty/equations/equation.py +257 -0
- qnty-0.0.9/src/qnty/equations/system.py +127 -0
- qnty-0.0.9/src/qnty/expressions/__init__.py +61 -0
- qnty-0.0.9/src/qnty/expressions/cache.py +94 -0
- qnty-0.0.9/src/qnty/expressions/functions.py +96 -0
- qnty-0.0.9/src/qnty/expressions/nodes.py +546 -0
- qnty-0.0.9/src/qnty/generated/__init__.py +0 -0
- qnty-0.0.9/src/qnty/generated/dimensions.py +514 -0
- qnty-0.0.9/src/qnty/generated/quantities.py +6003 -0
- qnty-0.0.9/src/qnty/generated/quantities.pyi +4192 -0
- qnty-0.0.9/src/qnty/generated/setters.py +12210 -0
- qnty-0.0.9/src/qnty/generated/units.py +9798 -0
- qnty-0.0.9/src/qnty/problem/__init__.py +91 -0
- qnty-0.0.9/src/qnty/problem/base.py +142 -0
- qnty-0.0.9/src/qnty/problem/composition.py +385 -0
- qnty-0.0.9/src/qnty/problem/composition_mixin.py +382 -0
- qnty-0.0.9/src/qnty/problem/equations.py +413 -0
- qnty-0.0.9/src/qnty/problem/metaclass.py +302 -0
- qnty-0.0.9/src/qnty/problem/reconstruction.py +1016 -0
- qnty-0.0.9/src/qnty/problem/solving.py +180 -0
- qnty-0.0.9/src/qnty/problem/validation.py +64 -0
- qnty-0.0.9/src/qnty/problem/variables.py +239 -0
- qnty-0.0.9/src/qnty/quantities/__init__.py +6 -0
- qnty-0.0.9/src/qnty/quantities/expression_quantity.py +314 -0
- qnty-0.0.9/src/qnty/quantities/quantity.py +428 -0
- qnty-0.0.9/src/qnty/quantities/typed_quantity.py +215 -0
- qnty-0.0.9/src/qnty/solving/__init__.py +0 -0
- qnty-0.0.9/src/qnty/solving/manager.py +90 -0
- qnty-0.0.9/src/qnty/solving/order.py +355 -0
- qnty-0.0.9/src/qnty/solving/solvers/__init__.py +20 -0
- qnty-0.0.9/src/qnty/solving/solvers/base.py +92 -0
- qnty-0.0.9/src/qnty/solving/solvers/iterative.py +185 -0
- qnty-0.0.9/src/qnty/solving/solvers/simultaneous.py +547 -0
- qnty-0.0.9/src/qnty/units/__init__.py +0 -0
- {qnty-0.0.7/src/qnty → qnty-0.0.9/src/qnty/units}/prefixes.py +54 -33
- qnty-0.0.7/src/qnty/unit.py → qnty-0.0.9/src/qnty/units/registry.py +73 -32
- qnty-0.0.9/src/qnty/utils/__init__.py +0 -0
- qnty-0.0.9/src/qnty/utils/logging.py +40 -0
- qnty-0.0.9/src/qnty/validation/__init__.py +0 -0
- qnty-0.0.9/src/qnty/validation/registry.py +0 -0
- qnty-0.0.9/src/qnty/validation/rules.py +167 -0
- qnty-0.0.7/PKG-INFO +0 -355
- qnty-0.0.7/README.md +0 -323
- qnty-0.0.7/src/qnty/__init__.py +0 -174
- qnty-0.0.7/src/qnty/dimension.py +0 -186
- qnty-0.0.7/src/qnty/equation.py +0 -216
- qnty-0.0.7/src/qnty/expression.py +0 -492
- qnty-0.0.7/src/qnty/unit_types/base.py +0 -47
- qnty-0.0.7/src/qnty/units.py +0 -8113
- qnty-0.0.7/src/qnty/variable.py +0 -263
- qnty-0.0.7/src/qnty/variable_types/base.py +0 -58
- qnty-0.0.7/src/qnty/variable_types/expression_variable.py +0 -68
- qnty-0.0.7/src/qnty/variable_types/typed_variable.py +0 -87
- qnty-0.0.7/src/qnty/variables.py +0 -2298
- qnty-0.0.7/src/qnty/variables.pyi +0 -6148
- {qnty-0.0.7/src/qnty/unit_types → qnty-0.0.9/src/qnty/codegen}/__init__.py +0 -0
- {qnty-0.0.7/src/qnty/variable_types → qnty-0.0.9/src/qnty/codegen/generators}/__init__.py +0 -0
qnty-0.0.9/PKG-INFO
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: qnty
|
3
|
+
Version: 0.0.9
|
4
|
+
Summary: High-performance unit system library for Python with dimensional safety and fast unit conversions
|
5
|
+
License: Apache-2.0
|
6
|
+
Keywords: units,dimensional analysis,engineering,physics,quantities,measurements
|
7
|
+
Author: tn3wman
|
8
|
+
Requires-Python: >=3.11, <3.14
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
10
|
+
Classifier: Intended Audience :: Developers
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
20
|
+
Provides-Extra: benchmark
|
21
|
+
Provides-Extra: dev
|
22
|
+
Requires-Dist: Pint (>=0.24.4) ; extra == "benchmark"
|
23
|
+
Requires-Dist: numpy (>=2.3.2)
|
24
|
+
Requires-Dist: pytest (>=8.4.1) ; extra == "dev"
|
25
|
+
Requires-Dist: ruff (>=0.1.0) ; extra == "dev"
|
26
|
+
Project-URL: Bug Tracker, https://github.com/tn3wman/qnty/issues
|
27
|
+
Project-URL: Documentation, https://github.com/tn3wman/qnty#readme
|
28
|
+
Project-URL: Homepage, https://github.com/tn3wman/qnty
|
29
|
+
Project-URL: Repository, https://github.com/tn3wman/qnty
|
30
|
+
Description-Content-Type: text/markdown
|
31
|
+
|
32
|
+
# Qnty
|
33
|
+
|
34
|
+
**High-performance unit system library for Python with dimensional safety and fast unit conversions for engineering calculations.**
|
35
|
+
|
36
|
+
[](https://www.python.org/downloads/)
|
37
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
38
|
+
[](https://pypi.org/project/qnty/)
|
39
|
+
|
40
|
+
## ⚠️ Important Disclaimer
|
41
|
+
|
42
|
+
**🚧 Work in Progress**: Qnty is currently in active development and has not been thoroughly vetted for production engineering calculations. While we strive for accuracy, this library should not be used for critical engineering applications without independent verification.
|
43
|
+
|
44
|
+
**📐 Accuracy Notice**: The authors are not responsible or liable for incorrect results, calculation errors, or any consequences arising from the use of this library. Always validate calculations independently using established engineering tools and practices.
|
45
|
+
|
46
|
+
*Use Qnty to help prevent unit errors, but always verify critical calculations through multiple methods.*
|
47
|
+
|
48
|
+
---
|
49
|
+
|
50
|
+
## ✨ Key Features
|
51
|
+
|
52
|
+
- **🚀 Ultra-Fast Performance**: Prime number encoding and pre-computed conversion tables
|
53
|
+
- **🛡️ Type Safety**: Compile-time dimensional analysis prevents unit errors
|
54
|
+
- **⚡ Zero-Cost Abstractions**: Optimized operations with `__slots__` and caching
|
55
|
+
- **🔗 Fluent API**: Intuitive method chaining for readable code
|
56
|
+
- **🧮 Engineering-Focused**: Built for real-world engineering calculations
|
57
|
+
- **🧬 Mathematical System**: Built-in equation solving and expression trees
|
58
|
+
- **📊 Comprehensive Testing**: 187 tests with performance benchmarks
|
59
|
+
|
60
|
+
## 🚀 Quick Start
|
61
|
+
|
62
|
+
### Installation
|
63
|
+
|
64
|
+
```bash
|
65
|
+
pip install qnty
|
66
|
+
```
|
67
|
+
|
68
|
+
### Basic Usage
|
69
|
+
|
70
|
+
```python
|
71
|
+
from qnty import Length, Pressure, Area
|
72
|
+
|
73
|
+
# Create quantities with dimensional safety
|
74
|
+
width = Length(3, "meter", "Width")
|
75
|
+
height = Length(2, "meter", "Height")
|
76
|
+
|
77
|
+
# Solve mathematical expressions
|
78
|
+
area = Area("area", is_known=False)
|
79
|
+
area.solve_from(width * height)
|
80
|
+
print(f"Area: {area}") # Area: 6.0 m²
|
81
|
+
```
|
82
|
+
|
83
|
+
### Engineering Example
|
84
|
+
|
85
|
+
```python
|
86
|
+
from qnty import Problem, Length, Pressure
|
87
|
+
|
88
|
+
class PipeThickness(Problem):
|
89
|
+
"""Calculate pipe wall thickness"""
|
90
|
+
|
91
|
+
# Known parameters
|
92
|
+
pressure = Pressure(150, "pound_force_per_square_inch", "Internal Pressure")
|
93
|
+
diameter = Length(6, "inch", "Pipe Diameter")
|
94
|
+
allowable_stress = Pressure(20000, "pound_force_per_square_inch", "Allowable Stress")
|
95
|
+
|
96
|
+
# Unknown to solve for
|
97
|
+
thickness = Length("thickness", is_known=False)
|
98
|
+
|
99
|
+
# Engineering equation: t = (P × D) / (2 × S)
|
100
|
+
equation = thickness.equals((pressure * diameter) / (2 * allowable_stress))
|
101
|
+
|
102
|
+
# Solve the problem
|
103
|
+
problem = PipeThickness()
|
104
|
+
problem.solve()
|
105
|
+
print(f"Required thickness: {problem.thickness}")
|
106
|
+
```
|
107
|
+
|
108
|
+
### Mathematical Operations
|
109
|
+
|
110
|
+
```python
|
111
|
+
from qnty import Length, sqrt, Area
|
112
|
+
|
113
|
+
# Dimensional analysis with mathematical functions
|
114
|
+
area = Area(25, "square_meter", "Square Area")
|
115
|
+
side = Length("side", is_known=False)
|
116
|
+
side.solve_from(sqrt(area)) # Returns Length, not Area!
|
117
|
+
print(f"Side length: {side}") # Side length: 5.0 m
|
118
|
+
```
|
119
|
+
|
120
|
+
## 📚 Documentation
|
121
|
+
|
122
|
+
- **[📖 Tutorial](docs/TUTORIAL.md)** - Step-by-step learning guide
|
123
|
+
- **[📋 API Reference](docs/API_REFERENCE.md)** - Complete API documentation
|
124
|
+
- **[🏗️ Examples](examples/)** - Real-world engineering examples
|
125
|
+
- **[📁 Full Documentation](docs/)** - Complete documentation index
|
126
|
+
|
127
|
+
## 🚀 Performance
|
128
|
+
|
129
|
+
Qnty significantly outperforms other unit libraries with **18.9x average speedup** over Pint:
|
130
|
+
|
131
|
+
| Operation | Qnty | Pint | **Speedup** |
|
132
|
+
|-----------|------|------|-------------|
|
133
|
+
| Mixed Unit Addition | 0.76 μs | 17.52 μs | **23.1x** |
|
134
|
+
| Complex ASME Equation | 4.07 μs | 106.17 μs | **26.1x** 🚀 |
|
135
|
+
| Type-Safe Variables | 0.98 μs | 9.65 μs | **9.8x** |
|
136
|
+
| **AVERAGE** | **1.89 μs** | **35.83 μs** | **18.9x** 🏆 |
|
137
|
+
|
138
|
+
*Run `pytest tests/test_benchmark.py -v -s` to verify on your system.*
|
139
|
+
|
140
|
+
## 🧮 100+ Engineering Quantities
|
141
|
+
|
142
|
+
Qnty provides comprehensive coverage of engineering domains:
|
143
|
+
|
144
|
+
```python
|
145
|
+
from qnty import (
|
146
|
+
# Mechanical
|
147
|
+
Length, Area, Volume, Mass, Force, Pressure, Temperature,
|
148
|
+
# Electrical
|
149
|
+
ElectricPotential, ElectricCurrentIntensity, ElectricResistance,
|
150
|
+
# Thermal
|
151
|
+
ThermalConductivity, HeatTransferCoefficient,
|
152
|
+
# Fluid Dynamics
|
153
|
+
ViscosityDynamic, MassFlowRate, VolumetricFlowRate,
|
154
|
+
# And 80+ more...
|
155
|
+
)
|
156
|
+
```
|
157
|
+
|
158
|
+
## 🔧 Development
|
159
|
+
|
160
|
+
```bash
|
161
|
+
# Install dependencies
|
162
|
+
pip install -r requirements.txt
|
163
|
+
|
164
|
+
# Run tests
|
165
|
+
pytest
|
166
|
+
|
167
|
+
# Run specific test
|
168
|
+
pytest tests/test_dimension.py -v
|
169
|
+
|
170
|
+
# Run benchmarks
|
171
|
+
python tests/test_benchmark.py
|
172
|
+
|
173
|
+
# Lint code
|
174
|
+
ruff check src/ tests/
|
175
|
+
ruff format src/ tests/
|
176
|
+
```
|
177
|
+
|
178
|
+
## 📄 License
|
179
|
+
|
180
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
181
|
+
|
182
|
+
## 🤝 Contributing
|
183
|
+
|
184
|
+
We welcome contributions! Please see [CLAUDE.md](CLAUDE.md) for development guidelines and:
|
185
|
+
|
186
|
+
1. Fork the repository
|
187
|
+
2. Create a feature branch
|
188
|
+
3. Add tests for new functionality
|
189
|
+
4. Ensure all tests pass: `pytest`
|
190
|
+
5. Submit a pull request
|
191
|
+
|
192
|
+
---
|
193
|
+
|
194
|
+
**Ready to supercharge your engineering calculations?** 🚀
|
195
|
+
|
196
|
+
- Start with the **[Tutorial](docs/TUTORIAL.md)**
|
197
|
+
- Browse the **[API Reference](docs/API_REFERENCE.md)**
|
198
|
+
- Try the **[Examples](examples/)**
|
199
|
+
|
qnty-0.0.9/README.md
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
# Qnty
|
2
|
+
|
3
|
+
**High-performance unit system library for Python with dimensional safety and fast unit conversions for engineering calculations.**
|
4
|
+
|
5
|
+
[](https://www.python.org/downloads/)
|
6
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
7
|
+
[](https://pypi.org/project/qnty/)
|
8
|
+
|
9
|
+
## ⚠️ Important Disclaimer
|
10
|
+
|
11
|
+
**🚧 Work in Progress**: Qnty is currently in active development and has not been thoroughly vetted for production engineering calculations. While we strive for accuracy, this library should not be used for critical engineering applications without independent verification.
|
12
|
+
|
13
|
+
**📐 Accuracy Notice**: The authors are not responsible or liable for incorrect results, calculation errors, or any consequences arising from the use of this library. Always validate calculations independently using established engineering tools and practices.
|
14
|
+
|
15
|
+
*Use Qnty to help prevent unit errors, but always verify critical calculations through multiple methods.*
|
16
|
+
|
17
|
+
---
|
18
|
+
|
19
|
+
## ✨ Key Features
|
20
|
+
|
21
|
+
- **🚀 Ultra-Fast Performance**: Prime number encoding and pre-computed conversion tables
|
22
|
+
- **🛡️ Type Safety**: Compile-time dimensional analysis prevents unit errors
|
23
|
+
- **⚡ Zero-Cost Abstractions**: Optimized operations with `__slots__` and caching
|
24
|
+
- **🔗 Fluent API**: Intuitive method chaining for readable code
|
25
|
+
- **🧮 Engineering-Focused**: Built for real-world engineering calculations
|
26
|
+
- **🧬 Mathematical System**: Built-in equation solving and expression trees
|
27
|
+
- **📊 Comprehensive Testing**: 187 tests with performance benchmarks
|
28
|
+
|
29
|
+
## 🚀 Quick Start
|
30
|
+
|
31
|
+
### Installation
|
32
|
+
|
33
|
+
```bash
|
34
|
+
pip install qnty
|
35
|
+
```
|
36
|
+
|
37
|
+
### Basic Usage
|
38
|
+
|
39
|
+
```python
|
40
|
+
from qnty import Length, Pressure, Area
|
41
|
+
|
42
|
+
# Create quantities with dimensional safety
|
43
|
+
width = Length(3, "meter", "Width")
|
44
|
+
height = Length(2, "meter", "Height")
|
45
|
+
|
46
|
+
# Solve mathematical expressions
|
47
|
+
area = Area("area", is_known=False)
|
48
|
+
area.solve_from(width * height)
|
49
|
+
print(f"Area: {area}") # Area: 6.0 m²
|
50
|
+
```
|
51
|
+
|
52
|
+
### Engineering Example
|
53
|
+
|
54
|
+
```python
|
55
|
+
from qnty import Problem, Length, Pressure
|
56
|
+
|
57
|
+
class PipeThickness(Problem):
|
58
|
+
"""Calculate pipe wall thickness"""
|
59
|
+
|
60
|
+
# Known parameters
|
61
|
+
pressure = Pressure(150, "pound_force_per_square_inch", "Internal Pressure")
|
62
|
+
diameter = Length(6, "inch", "Pipe Diameter")
|
63
|
+
allowable_stress = Pressure(20000, "pound_force_per_square_inch", "Allowable Stress")
|
64
|
+
|
65
|
+
# Unknown to solve for
|
66
|
+
thickness = Length("thickness", is_known=False)
|
67
|
+
|
68
|
+
# Engineering equation: t = (P × D) / (2 × S)
|
69
|
+
equation = thickness.equals((pressure * diameter) / (2 * allowable_stress))
|
70
|
+
|
71
|
+
# Solve the problem
|
72
|
+
problem = PipeThickness()
|
73
|
+
problem.solve()
|
74
|
+
print(f"Required thickness: {problem.thickness}")
|
75
|
+
```
|
76
|
+
|
77
|
+
### Mathematical Operations
|
78
|
+
|
79
|
+
```python
|
80
|
+
from qnty import Length, sqrt, Area
|
81
|
+
|
82
|
+
# Dimensional analysis with mathematical functions
|
83
|
+
area = Area(25, "square_meter", "Square Area")
|
84
|
+
side = Length("side", is_known=False)
|
85
|
+
side.solve_from(sqrt(area)) # Returns Length, not Area!
|
86
|
+
print(f"Side length: {side}") # Side length: 5.0 m
|
87
|
+
```
|
88
|
+
|
89
|
+
## 📚 Documentation
|
90
|
+
|
91
|
+
- **[📖 Tutorial](docs/TUTORIAL.md)** - Step-by-step learning guide
|
92
|
+
- **[📋 API Reference](docs/API_REFERENCE.md)** - Complete API documentation
|
93
|
+
- **[🏗️ Examples](examples/)** - Real-world engineering examples
|
94
|
+
- **[📁 Full Documentation](docs/)** - Complete documentation index
|
95
|
+
|
96
|
+
## 🚀 Performance
|
97
|
+
|
98
|
+
Qnty significantly outperforms other unit libraries with **18.9x average speedup** over Pint:
|
99
|
+
|
100
|
+
| Operation | Qnty | Pint | **Speedup** |
|
101
|
+
|-----------|------|------|-------------|
|
102
|
+
| Mixed Unit Addition | 0.76 μs | 17.52 μs | **23.1x** |
|
103
|
+
| Complex ASME Equation | 4.07 μs | 106.17 μs | **26.1x** 🚀 |
|
104
|
+
| Type-Safe Variables | 0.98 μs | 9.65 μs | **9.8x** |
|
105
|
+
| **AVERAGE** | **1.89 μs** | **35.83 μs** | **18.9x** 🏆 |
|
106
|
+
|
107
|
+
*Run `pytest tests/test_benchmark.py -v -s` to verify on your system.*
|
108
|
+
|
109
|
+
## 🧮 100+ Engineering Quantities
|
110
|
+
|
111
|
+
Qnty provides comprehensive coverage of engineering domains:
|
112
|
+
|
113
|
+
```python
|
114
|
+
from qnty import (
|
115
|
+
# Mechanical
|
116
|
+
Length, Area, Volume, Mass, Force, Pressure, Temperature,
|
117
|
+
# Electrical
|
118
|
+
ElectricPotential, ElectricCurrentIntensity, ElectricResistance,
|
119
|
+
# Thermal
|
120
|
+
ThermalConductivity, HeatTransferCoefficient,
|
121
|
+
# Fluid Dynamics
|
122
|
+
ViscosityDynamic, MassFlowRate, VolumetricFlowRate,
|
123
|
+
# And 80+ more...
|
124
|
+
)
|
125
|
+
```
|
126
|
+
|
127
|
+
## 🔧 Development
|
128
|
+
|
129
|
+
```bash
|
130
|
+
# Install dependencies
|
131
|
+
pip install -r requirements.txt
|
132
|
+
|
133
|
+
# Run tests
|
134
|
+
pytest
|
135
|
+
|
136
|
+
# Run specific test
|
137
|
+
pytest tests/test_dimension.py -v
|
138
|
+
|
139
|
+
# Run benchmarks
|
140
|
+
python tests/test_benchmark.py
|
141
|
+
|
142
|
+
# Lint code
|
143
|
+
ruff check src/ tests/
|
144
|
+
ruff format src/ tests/
|
145
|
+
```
|
146
|
+
|
147
|
+
## 📄 License
|
148
|
+
|
149
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
150
|
+
|
151
|
+
## 🤝 Contributing
|
152
|
+
|
153
|
+
We welcome contributions! Please see [CLAUDE.md](CLAUDE.md) for development guidelines and:
|
154
|
+
|
155
|
+
1. Fork the repository
|
156
|
+
2. Create a feature branch
|
157
|
+
3. Add tests for new functionality
|
158
|
+
4. Ensure all tests pass: `pytest`
|
159
|
+
5. Submit a pull request
|
160
|
+
|
161
|
+
---
|
162
|
+
|
163
|
+
**Ready to supercharge your engineering calculations?** 🚀
|
164
|
+
|
165
|
+
- Start with the **[Tutorial](docs/TUTORIAL.md)**
|
166
|
+
- Browse the **[API Reference](docs/API_REFERENCE.md)**
|
167
|
+
- Try the **[Examples](examples/)**
|
@@ -0,0 +1,256 @@
|
|
1
|
+
"""
|
2
|
+
Qnty - High-Performance Unit System for Engineering
|
3
|
+
====================================================
|
4
|
+
|
5
|
+
A fast, type-safe unit system library for Python with dimensional safety and optimized unit conversions for engineering calculations.
|
6
|
+
"""
|
7
|
+
|
8
|
+
# from . import (quantity, expressions)
|
9
|
+
|
10
|
+
from .expressions import (
|
11
|
+
abs_expr,
|
12
|
+
cond_expr,
|
13
|
+
cos,
|
14
|
+
exp,
|
15
|
+
ln,
|
16
|
+
log10,
|
17
|
+
max_expr,
|
18
|
+
min_expr,
|
19
|
+
sin,
|
20
|
+
sqrt,
|
21
|
+
tan,
|
22
|
+
)
|
23
|
+
from .generated.quantities import (
|
24
|
+
AbsorbedDose,
|
25
|
+
Acceleration,
|
26
|
+
ActivationEnergy,
|
27
|
+
AmountOfSubstance,
|
28
|
+
AnglePlane,
|
29
|
+
AngleSolid,
|
30
|
+
AngularAcceleration,
|
31
|
+
AngularMomentum,
|
32
|
+
Area,
|
33
|
+
AreaPerUnitVolume,
|
34
|
+
AtomicWeight,
|
35
|
+
Concentration,
|
36
|
+
Dimensionless,
|
37
|
+
DynamicFluidity,
|
38
|
+
ElectricalConductance,
|
39
|
+
ElectricalPermittivity,
|
40
|
+
ElectricalResistivity,
|
41
|
+
ElectricCapacitance,
|
42
|
+
ElectricCharge,
|
43
|
+
ElectricCurrentIntensity,
|
44
|
+
ElectricDipoleMoment,
|
45
|
+
ElectricFieldStrength,
|
46
|
+
ElectricInductance,
|
47
|
+
ElectricPotential,
|
48
|
+
ElectricResistance,
|
49
|
+
EnergyFlux,
|
50
|
+
EnergyHeatWork,
|
51
|
+
EnergyPerUnitArea,
|
52
|
+
Force,
|
53
|
+
ForceBody,
|
54
|
+
ForcePerUnitMass,
|
55
|
+
FrequencyVoltageRatio,
|
56
|
+
FuelConsumption,
|
57
|
+
HeatOfCombustion,
|
58
|
+
HeatOfFusion,
|
59
|
+
HeatOfVaporization,
|
60
|
+
HeatTransferCoefficient,
|
61
|
+
Illuminance,
|
62
|
+
KineticEnergyOfTurbulence,
|
63
|
+
Length,
|
64
|
+
LinearMassDensity,
|
65
|
+
LinearMomentum,
|
66
|
+
LuminanceSelf,
|
67
|
+
LuminousFlux,
|
68
|
+
LuminousIntensity,
|
69
|
+
MagneticField,
|
70
|
+
MagneticFlux,
|
71
|
+
MagneticInductionFieldStrength,
|
72
|
+
MagneticMoment,
|
73
|
+
MagneticPermeability,
|
74
|
+
MagnetomotiveForce,
|
75
|
+
Mass,
|
76
|
+
MassDensity,
|
77
|
+
MassFlowRate,
|
78
|
+
MassFlux,
|
79
|
+
MassFractionOfI,
|
80
|
+
MassTransferCoefficient,
|
81
|
+
MolalityOfSoluteI,
|
82
|
+
MolarConcentrationByMass,
|
83
|
+
MolarFlowRate,
|
84
|
+
MolarFlux,
|
85
|
+
MolarHeatCapacity,
|
86
|
+
MolarityOfI,
|
87
|
+
MoleFractionOfI,
|
88
|
+
MomentOfInertia,
|
89
|
+
MomentumFlowRate,
|
90
|
+
MomentumFlux,
|
91
|
+
NormalityOfSolution,
|
92
|
+
ParticleDensity,
|
93
|
+
Percent,
|
94
|
+
Permeability,
|
95
|
+
PhotonEmissionRate,
|
96
|
+
PowerPerUnitMass,
|
97
|
+
PowerPerUnitVolume,
|
98
|
+
PowerThermalDuty,
|
99
|
+
Pressure,
|
100
|
+
RadiationDoseEquivalent,
|
101
|
+
RadiationExposure,
|
102
|
+
Radioactivity,
|
103
|
+
SecondMomentOfArea,
|
104
|
+
SecondRadiationConstantPlanck,
|
105
|
+
SpecificEnthalpy,
|
106
|
+
SpecificGravity,
|
107
|
+
SpecificHeatCapacityConstantPressure,
|
108
|
+
SpecificLength,
|
109
|
+
SpecificSurface,
|
110
|
+
SpecificVolume,
|
111
|
+
Stress,
|
112
|
+
SurfaceMassDensity,
|
113
|
+
SurfaceTension,
|
114
|
+
Temperature,
|
115
|
+
ThermalConductivity,
|
116
|
+
Time,
|
117
|
+
Torque,
|
118
|
+
TurbulenceEnergyDissipationRate,
|
119
|
+
VelocityAngular,
|
120
|
+
VelocityLinear,
|
121
|
+
ViscosityDynamic,
|
122
|
+
ViscosityKinematic,
|
123
|
+
Volume,
|
124
|
+
VolumeFractionOfI,
|
125
|
+
VolumetricCalorificHeatingValue,
|
126
|
+
VolumetricCoefficientOfExpansion,
|
127
|
+
VolumetricFlowRate,
|
128
|
+
VolumetricFlux,
|
129
|
+
VolumetricMassFlowRate,
|
130
|
+
Wavenumber,
|
131
|
+
)
|
132
|
+
from .problem import Problem
|
133
|
+
|
134
|
+
# Define public API
|
135
|
+
__all__ = [
|
136
|
+
"abs_expr",
|
137
|
+
"min_expr",
|
138
|
+
"max_expr",
|
139
|
+
"cond_expr",
|
140
|
+
"sin",
|
141
|
+
"cos",
|
142
|
+
"tan",
|
143
|
+
"sqrt",
|
144
|
+
"ln",
|
145
|
+
"log10",
|
146
|
+
"exp",
|
147
|
+
"Problem",
|
148
|
+
"AbsorbedDose",
|
149
|
+
"Acceleration",
|
150
|
+
"ActivationEnergy",
|
151
|
+
"AmountOfSubstance",
|
152
|
+
"AnglePlane",
|
153
|
+
"AngleSolid",
|
154
|
+
"AngularAcceleration",
|
155
|
+
"AngularMomentum",
|
156
|
+
"Area",
|
157
|
+
"AreaPerUnitVolume",
|
158
|
+
"AtomicWeight",
|
159
|
+
"Concentration",
|
160
|
+
"Dimensionless",
|
161
|
+
"DynamicFluidity",
|
162
|
+
"ElectricalConductance",
|
163
|
+
"ElectricalPermittivity",
|
164
|
+
"ElectricalResistivity",
|
165
|
+
"ElectricCapacitance",
|
166
|
+
"ElectricCharge",
|
167
|
+
"ElectricCurrentIntensity",
|
168
|
+
"ElectricDipoleMoment",
|
169
|
+
"ElectricFieldStrength",
|
170
|
+
"ElectricInductance",
|
171
|
+
"ElectricPotential",
|
172
|
+
"ElectricResistance",
|
173
|
+
"EnergyFlux",
|
174
|
+
"EnergyHeatWork",
|
175
|
+
"EnergyPerUnitArea",
|
176
|
+
"Force",
|
177
|
+
"ForceBody",
|
178
|
+
"ForcePerUnitMass",
|
179
|
+
"FrequencyVoltageRatio",
|
180
|
+
"FuelConsumption",
|
181
|
+
"HeatOfCombustion",
|
182
|
+
"HeatOfFusion",
|
183
|
+
"HeatOfVaporization",
|
184
|
+
"HeatTransferCoefficient",
|
185
|
+
"Illuminance",
|
186
|
+
"KineticEnergyOfTurbulence",
|
187
|
+
"Length",
|
188
|
+
"LinearMassDensity",
|
189
|
+
"LinearMomentum",
|
190
|
+
"LuminanceSelf",
|
191
|
+
"LuminousFlux",
|
192
|
+
"LuminousIntensity",
|
193
|
+
"MagneticField",
|
194
|
+
"MagneticFlux",
|
195
|
+
"MagneticInductionFieldStrength",
|
196
|
+
"MagneticMoment",
|
197
|
+
"MagneticPermeability",
|
198
|
+
"MagnetomotiveForce",
|
199
|
+
"Mass",
|
200
|
+
"MassDensity",
|
201
|
+
"MassFlowRate",
|
202
|
+
"MassFlux",
|
203
|
+
"MassFractionOfI",
|
204
|
+
"MassTransferCoefficient",
|
205
|
+
"MolalityOfSoluteI",
|
206
|
+
"MolarConcentrationByMass",
|
207
|
+
"MolarFlowRate",
|
208
|
+
"MolarFlux",
|
209
|
+
"MolarHeatCapacity",
|
210
|
+
"MolarityOfI",
|
211
|
+
"MoleFractionOfI",
|
212
|
+
"MomentOfInertia",
|
213
|
+
"MomentumFlowRate",
|
214
|
+
"MomentumFlux",
|
215
|
+
"NormalityOfSolution",
|
216
|
+
"ParticleDensity",
|
217
|
+
"Percent",
|
218
|
+
"Permeability",
|
219
|
+
"PhotonEmissionRate",
|
220
|
+
"PowerPerUnitMass",
|
221
|
+
"PowerPerUnitVolume",
|
222
|
+
"PowerThermalDuty",
|
223
|
+
"Pressure",
|
224
|
+
"RadiationDoseEquivalent",
|
225
|
+
"RadiationExposure",
|
226
|
+
"Radioactivity",
|
227
|
+
"SecondMomentOfArea",
|
228
|
+
"SecondRadiationConstantPlanck",
|
229
|
+
"SpecificEnthalpy",
|
230
|
+
"SpecificGravity",
|
231
|
+
"SpecificHeatCapacityConstantPressure",
|
232
|
+
"SpecificLength",
|
233
|
+
"SpecificSurface",
|
234
|
+
"SpecificVolume",
|
235
|
+
"Stress",
|
236
|
+
"SurfaceMassDensity",
|
237
|
+
"SurfaceTension",
|
238
|
+
"Temperature",
|
239
|
+
"ThermalConductivity",
|
240
|
+
"Time",
|
241
|
+
"Torque",
|
242
|
+
"TurbulenceEnergyDissipationRate",
|
243
|
+
"VelocityAngular",
|
244
|
+
"VelocityLinear",
|
245
|
+
"ViscosityDynamic",
|
246
|
+
"ViscosityKinematic",
|
247
|
+
"Volume",
|
248
|
+
"VolumeFractionOfI",
|
249
|
+
"VolumetricCalorificHeatingValue",
|
250
|
+
"VolumetricCoefficientOfExpansion",
|
251
|
+
"VolumetricFlowRate",
|
252
|
+
"VolumetricFlux",
|
253
|
+
"VolumetricMassFlowRate",
|
254
|
+
"Wavenumber",
|
255
|
+
]
|
256
|
+
|