feat: adding support for units

With `pint` as the unit package, the user can now define Quantities as
attributes of their DataService class. This will be rendered as a float
in the frontend application with the unit as an additional field
appended to the form.
This commit is contained in:
Mose Müller
2023-08-07 14:03:59 +02:00
parent 90869f07a7
commit eed309590e
17 changed files with 243 additions and 23 deletions

30
poetry.lock generated
View File

@ -104,7 +104,6 @@ packaging = ">=22.0"
pathspec = ">=0.9.0"
platformdirs = ">=2"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}
[package.extras]
colorama = ["colorama (>=0.4.3)"]
@ -551,6 +550,30 @@ files = [
{file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"},
]
[[package]]
name = "pint"
version = "0.22"
description = "Physical quantities module"
optional = false
python-versions = ">=3.9"
files = [
{file = "Pint-0.22-py3-none-any.whl", hash = "sha256:6e2b3c5c2b4d9b516608bc860a417a39d66eb99c958f36540cf931d2c2e9f80f"},
{file = "Pint-0.22.tar.gz", hash = "sha256:2d139f6abbcf3016cad7d3cec05707fe908ac4f99cf59aedfd6ee667b7a64433"},
]
[package.dependencies]
typing-extensions = "*"
[package.extras]
babel = ["babel (<=2.8)"]
dask = ["dask"]
mip = ["mip (>=1.13)"]
numpy = ["numpy (>=1.19.5)"]
pandas = ["pint-pandas (>=0.3)"]
test = ["pytest", "pytest-cov", "pytest-mpl", "pytest-subtests"]
uncertainties = ["uncertainties (>=3.1.6)"]
xarray = ["xarray"]
[[package]]
name = "platformdirs"
version = "3.10.0"
@ -969,7 +992,6 @@ files = [
[package.dependencies]
anyio = ">=3.4.0,<5"
typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\""}
[package.extras]
full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart", "pyyaml"]
@ -1149,5 +1171,5 @@ dev = ["black (>=19.3b0)", "pytest (>=4.6.2)"]
[metadata]
lock-version = "2.0"
python-versions = "^3.9"
content-hash = "408c82ee6f4c1b35f33294edb6e86764560dc5140f04cd5ff438e617981555e1"
python-versions = "^3.10"
content-hash = "083c3e13b4c314c5012daa87c94566a985631385629a3ff695ffcfc22efa0f09"