Skip to main content

Streamlines metadata & timezone handling, and plotting in hetida designer components

Project description

Welcome to hdhelpers

Maintenance build python PyPI version PyPI - License Downloads

What is hdhelpers?

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.

Getting Started with hdhelpers

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).

Developing for hdhelpers

For dependency management and venv setup, building and publishing, uv is used.

Setting up a Development Environment

Python environment

  1. Create a virtual environment with uv venv. This will create a hidden .venv directory.
  2. Activate the virtual environment via source .venv/bin/activate
  3. Run uv sync to install all dependencies given in pyproject.toml.
  4. 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.
  5. 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 .

hetida designer with hdhelpers

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.

Code Quality

Once you are done writing your code, including unit tests, use ./run check to see if your code quality is sufficient.

Documentation

For 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.

Build, Release and Publish

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:

  1. Please execute ./run build_package <version_nr> where version number should follow semantic versioning. This will:
  • Runs uv sync --frozen to upgrade dependencies.
  • Update version in pyproject.toml
  • Update __version__ in __init__.py
  • Builds wheels of hdhelpers in ./dist
  1. Ensure that listed classifiers in pyproject.tomlare up to date. If not
  • Update pyproject.toml accordingly
  • Update ./run test-py-versions accordingly for local testing using uv
  • Update check_pull_request.yml accordingly for automated pipeline execution of checks
  • Update badge in this file for Python versions above
  1. 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,

  1. tag your main branch with the specified package version

  2. 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.

  3. verifiy that package can be installed by using:

uv run --with 'hdhelpers==<version>'
     --refresh-package hdhelpers
     --default-index https://test.pypi.org/simple/
     --index https://test.pypi.org/simple/
     --no-project
     -- python -c "import hdhelpers; print(hdhelpers.__version__)"
  1. use uv publish dist/* to upload the package on hdhelpers PyPI project.

  2. 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.

Notes

  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hdhelpers-0.0.3.tar.gz (82.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hdhelpers-0.0.3-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file hdhelpers-0.0.3.tar.gz.

File metadata

  • Download URL: hdhelpers-0.0.3.tar.gz
  • Upload date:
  • Size: 82.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hdhelpers-0.0.3.tar.gz
Algorithm Hash digest
SHA256 6ef9033b89e27809ece3b045e32c36322e2162e75f8a234e9d65f2daa54d5987
MD5 bcff113d0d7c948341a988c339a0807f
BLAKE2b-256 1ffaa7e0245dc2ff6a705ba326df02e797ea52f45e123ebe7eb6394cf90f0082

See more details on using hashes here.

File details

Details for the file hdhelpers-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: hdhelpers-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hdhelpers-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8c2937ce9a1961da2d08a5828a9f76197096edb7784b3a9c3d4fcd5fe11bb6a0
MD5 c7f3504fff2d7660fc85aabeab553520
BLAKE2b-256 8631d1edfc9af5ae28bbe0cff46706e6bfe365e8eb29b42e300f2bbe4aa5645c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page