Installation¶
From PyPI¶
The easiest way to install Physities is from PyPI:
pip install physities
This will install pre-built wheels for most platforms.
From Source¶
Physities uses a hybrid Python/Rust architecture. To build from source, you’ll need both Python and Rust toolchains.
Prerequisites¶
Python 3.11+
Rust toolchain: Install from https://rustup.rs/
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
maturin: Python/Rust build tool
pip install maturin
Building¶
Clone the repository and build:
git clone https://github.com/CenturyBoys/physities.git
cd physities
maturin develop --release
For development with editable install:
pip install -e ".[dev]"
maturin develop
Optional Dependencies¶
Physities has optional dependency groups:
# Development dependencies (testing, linting)
pip install physities[dev]
# Benchmark dependencies
pip install physities[benchmark]
# Documentation dependencies
pip install physities[docs]
# All optional dependencies
pip install physities[all]
Verifying Installation¶
Test your installation:
from physities.src.unit import Meter, Second
# Create a velocity
velocity = (Meter / Second)(10)
print(velocity) # 10 (L¹ / t¹)
# Convert to km/h
from physities.src.unit import Kilometer, Hour
kmh = velocity.convert(Kilometer / Hour)
print(kmh.value) # 36.0