UV
Using UV#
The easiest method for developing PBM is to use the tool uv which combines handling of python dependencies, virtual environment, deployment and versioning.
Installing PBM with uv#
uv can be installed using pip:
pip install --user uv
uv venv
pyproject.toml file.
Any changes made within the repository will be picked up by uv whenever the code is run.
Running PBM with uv#
Run the powerbalance command from within the virtual environment by executing:
uv run powerbalance
Troubleshooting#
Troubleshooting#
- If you encounter issues with
numpyas a dependency, this can usually fixed by installing it manually beforehand:uv pip install numpy - Another problem encountered on Windows systems is with the installation of PyTables, the error usually states that HDF5 libraries could not be located and is due to there being no built wheels in the PyPi database for the user's Python version and system architecture (when this is the case Python attempts to build the module itself). A working solution is to download the relevant
pytableswheels for Windows from here, then install them with pip:uv pip install <path-to-wheels-file> -
If you are using uv and the command
uvis not recognised after it has been installed, make sure the location of your uv installation is added to PATH, to find the installation try runningand noting the address given during the initialisation. For example for the case of a prefix ofpython -m uv run which uvC:\Users\<user>\AppData\Local\, uv was found inC:\Users\<user>\AppData\Local\Packages\PythonSoftwareFoundation.<python_version_string>\LocalCache\local-packages\Python<version-num>\Scripts. This location is then added to the PATH variable as described here or temporarilyIn the case of Windows:
for Linux/macOS:set "PATH=%PATH%;<location-of-uv.exe>"export PATH=<location-of-uv>:$PATH -
If the command
powerbalanceis not available after install, you can also run the program via Python as normal:uv run python <path-to-cloned-repo>/power_balance/cli/__init__.py