Skip to content

Commit

Permalink
use uv and mkdocs, add dependencies to pyproject.toml, restructured s…
Browse files Browse the repository at this point in the history
…ource, added stub
  • Loading branch information
g-bauer committed Dec 13, 2024
1 parent bc9a097 commit 642fbff
Show file tree
Hide file tree
Showing 26 changed files with 845 additions and 428 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ Cargo.lock
*.so
si-units/docs/_build
si-units/docs/generated
/venv
.ipynb_checkpoints
*.ipynb
__pycache__
test_readme.py
test_readme.py
*.lock

# venv
/venv
.venv
17 changes: 15 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
[workspace]
resolver = "2"
members = ["si-units", "example/extend_quantity"]

[workspace.package]
version = "0.10.0"
authors = [
"Philipp Rehner <[email protected]>",
"Gernot Bauer <[email protected]>",
]
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/itt-ustutt/quantity"


[package]
name = "quantity"
version = "0.10.0"
Expand All @@ -20,8 +35,6 @@ exclude = ["/.github/*", "*.ipynb", "/docs"]
features = ["python_numpy", "num-dual", "approx"]
rustdoc-args = ["--html-in-header", "./src/docs-header.html"]

[workspace]
members = ["si-units", "example/extend_quantity"]

[dependencies]
typenum = "1.17"
Expand Down
7 changes: 0 additions & 7 deletions pyproject.toml

This file was deleted.

1 change: 1 addition & 0 deletions si-units/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
59 changes: 28 additions & 31 deletions si-units/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
[package]
name = "si-units"
version = "0.10.0"
authors = [
"Philipp Rehner <[email protected]>",
"Gernot Bauer <[email protected]>",
]
rust-version = "1.81"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Representation of SI unit valued scalars and arrays."
homepage = "https://github.com/itt-ustutt/quantity/tree/master/si-units"
readme = "README.md"
repository = "https://github.com/itt-ustutt/quantity"
keywords = ["physics", "units", "SI"]
categories = ["data-structures", "science"]
exclude = ["*.ipynb", "/docs"]

[lib]
name = "si_units"
crate-type = ["cdylib"]

[dependencies]
ndarray = "0.16"
numpy = "0.23"
thiserror = "2.0"
regex = "1.10"

[dependencies.pyo3]
version = "0.23"
features = ["extension-module", "abi3", "abi3-py37"]
[package]
name = "si-units"
version = "0.10.0"
authors = [
"Philipp Rehner <[email protected]>",
"Gernot Bauer <[email protected]>",
]
rust-version = "1.81"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Representation of SI unit valued scalars and arrays."
homepage = "https://github.com/itt-ustutt/quantity/tree/master/si-units"
readme = "README.md"
repository = "https://github.com/itt-ustutt/quantity"
keywords = ["physics", "units", "SI"]
categories = ["data-structures", "science"]
exclude = ["*.ipynb", "/docs"]

[lib]
name = "_core"
crate-type = ["cdylib"]

[dependencies]
ndarray = "0.16"
numpy = "0.23"
pyo3 = { version = "0.23", features = ["extension-module", "abi3-py39"] }
regex = "1.11"
thiserror = "2.0"
4 changes: 2 additions & 2 deletions si-units/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![documentation](https://img.shields.io/badge/docs-github--pages-blue)](https://itt-ustutt.github.io/quantity/index.html)
[![PyPI version](https://badge.fury.io/py/si_units.svg)](https://badge.fury.io/py/si_units)

Representation of quantities with SI units.
Representation of quantities with SI units.

The package is written with flexibility in mind and is able to represent arbitrarily complex units.
In addition to simple scalar quantities, it can be used to decorate any complex data type (numpy arrays, PyTorch tensors) to provide unit checks.
Expand Down Expand Up @@ -47,4 +47,4 @@ print(sqms) # [4, 9, 16] m²

## Documentation

For the documentation, see [here](https://itt-ustutt.github.io/quantity/index.html).
For the documentation, see [here](https://itt-ustutt.github.io/quantity/index.html).
20 changes: 0 additions & 20 deletions si-units/docs/Makefile

This file was deleted.

25 changes: 25 additions & 0 deletions si-units/docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# API

::: si_units._core.SIObject
options:
show_symbol_type_heading: true
members:
- __init__
- cbrt
- sqrt
- has_unit
summary:
attributes: false
functions: true

::: si_units._core.SIArray1
options:
show_symbol_type_heading: true
members:
- __call__
- linspace
- logspace
summary:
attributes: false
functions: true

109 changes: 0 additions & 109 deletions si-units/docs/api.rst

This file was deleted.

26 changes: 26 additions & 0 deletions si-units/docs/base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SI Base Units and Associated Constants (AC)

All capitalized entries in the `Unit` and `AC` (associated constants) columns from the table below can be imported:


| Unit | Symbol | Quantity | AC | AC Name | AC value |
| -------- | ------------ | ------------------------- | ------ | ----------------------------------------------- | -------------------------------------------------------------- |
| SECOND | $\text{s}$ | time | DVCS | Hyperfine transition frequency of Cs | $\Delta\nu_\text{Cs}=9192631770~\text{Hz}$ |
| METER | $\text{m}$ | length | CLIGHT | Speed of light | $c=299792458~\frac{\text{m}}{\text{s}}$ |
| KILOGRAM | $\text{kg}$ | mass | PLANCK | Planck constant | $h=6.62607015\times 10^{-34}~\text{J}\cdot\text{s}$ |
| AMPERE | $\text{A}$ | electric current | QE | Elementary charge | $e=1.602176634\times 10^{-19}~\text{C}$ |
| KELVIN | $\text{K}$ | thermodynamic temperature | KB | Boltzmann constant | $k_\text{B}=1.380649\times 10^{-23}~\frac{\text{J}}{\text{K}}$ |
| MOL | $\text{mol}$ | amount of substance | NAV | Avogadro constant | $N_\text{A}=6.02214076\times 10^{23}~\text{mol}^{-1}$ |
| CANDELA | $\text{cd}$ | luminous intensity | KCD | Luminous efficacy of $540~\text{THz}$ radiation | $K_\text{cd}=683~\frac{\text{lm}}{\text{W}}$ |

## Example

```py linenums="1"
from si_units import SECOND, DVCS
print(SECOND)
print(DVCS)
```
```
1 s
9.19263177 GHz
```
65 changes: 0 additions & 65 deletions si-units/docs/conf.py

This file was deleted.

Loading

0 comments on commit 642fbff

Please sign in to comment.