hdhelpers is a package designed for and included in the standard installation of the hetida designer.
Currently, the package provides functions to retrieve metadata from Pandas objects (stored in the attr of the Pandas object). Pandas objects are the standard for processing time series data in the hetida designer. Additionally, a function is provided to handle time zone information. In the future, the package is planned to be expanded, for example by providing functions to facilitate visualization.
The documentation of the package is a GitHub page, on which the functions of the package are described and some tips for getting started with using the package are given.
Since version >0.13.10 the hetida designer runtime comes with an installed version of hdhelpers. To start the hetida designer we recommend following the hetida designer setup guide.
An example is given in GitHub page of how to use functionalities of hdhelpers inside a hetida designer component. Furthermore the base component Single Time Series Plot uses hdhelpers to demonstrate the usage (since version >0.13.10).
For dependency management and venv setup, building and publishing, uv is used.
- Create a virtual environment with
uv venv. This will create a hidden.venvdirectory. - Activate the virtual environment via
source .venv/bin/activate - Run
uv syncto install all dependencies given in pyproject.toml. - In case you need to add a new dependency, do so via
uv add <new_dependency>. That way, uv finds versions of all dependencies that are compatible with each other. - In case you need a new requirement for development purposes please use
uv add --dev <new_dependency>
Note: To install hdhelpers in editable mode in your venv please run uv pip install -e .
To test designer images with current hdhelpers version please save a copy of docker-compose.yml from the hetida designer repository.
Then write a Dockerfile to install the current hdhelpers version in the required designer backend.
FROM hetida/designer-backend:<<hd_version>>
USER root
RUN pip install .
USER hd_app
CMD ["bash", "/app/start.sh"]Then modify the docker-compose.yml to work with the backend version defined by the modified Dockerfile.
...
hetida-designer-backend:
build:
context: .
dockerfile: Dockerfile
...use docker-compose.yaml, e.g. via
docker compose -f 'docker-compose.yaml' up -d --build. This compose setup loads the current
hetida designer images and installs the hdhelpers package in the runtime. Thus, you can use functions of hdhelpers
writing component code.
Once you are done writing your code, including unit tests, use ./run check to see if your code quality is sufficient.
Fr documentation we use the tool sphinx. Please apply ./run build_docs to create the current state of documentation. It will be stored in docs. You can open the documentation by opening docs/index.html, e.g. with your browser.
The first step for publishing a new package version is creating and merging a pull request from develop to main. In detail the following steps should be executed beforehand:
- Please execute
./run build_package <version_nr>where version number should follow semantic versioning. This will:
- Runs
uv sync --frozento upgrade dependencies. - Update version in pyproject.toml
- Update __version__ in __init__.py
- Builds wheels of hdhelpers in ./dist
- Ensure that listed
classifiersinpyproject.tomlare up to date. If not
- Update
pyproject.tomlaccordingly - Update
./run test-py-versionsaccordingly for local testing using uv - Update
check_pull_request.ymlaccordingly for automated pipeline execution of checks - Update badge in this file for Python versions above
- Update CHANGELOG.md manually following Keep a Changelog
When the PR is accepted, the package can be published in a second step.
To publish the build from the dist subdirectory to PyPI,
-
tag your main branch with the specified package version
-
use
uv publish --index testpypi --token <API-token>. You need a (Test-)PyPI account with a token and you need maintainer/owner access to the hdhelpers (Test-)PyPI project. -
After publishing please communicate to the hetida designer team so upgrade there dependencies. The hetida designer docker compose setup installs hdhelpers from PyPI as it does with any dependency listed in
runtime/requirements.in.
- Please ensure that dependencies specified for hdhelpers do work in current designer versions.
- If you want to upgrade dependencies please run
uv lock --upgrade - to install hdhelpers from testpypi you can use:
uv pip install --extra-index-url https://test.pypi.org/simple/ --index-url https://pypi.org/simple --refresh --index-strategy unsafe-best-match hdhelpers