Skip to main content

Python package providing an interface to the Gantner Instruments Data API

Project description

pygidata

This repository provides one Python package, pygidata, for Gantner Instruments data access.

Inside pygidata, the ginsutility module is included for expert/local Highspeedport access via GInsUtility.dll. The logic remains separated by module scope (gi_data for API access, ginsutility for local DLL workflows).

Choose the right package

  • Use pygidata/gi_data for standard backend/API integrations and GI.cloud workflows.
  • Use ginsutility only for local expert scenarios that require the Highspeedport DLL.
  • Do not use ginsutility as GI.cloud-only integration path.

Usage

Install pygidata from PyPI

pip install pygidata

Install with local expert module dependencies

Use this only if you need local Highspeedport access.

Required for ginsutility examples

All examples in src/ginsutility/examples require:

  1. pygidata installed with extras: pip install "pygidata[ginsutility]"
  2. local access to GInsUtility.dll or on Linux libGInsUtility.so (typically installed with GI.bench / Q.core).
pip install "pygidata[ginsutility]"

Editable install from this repository:

pip install -e .[ginsutility]

Quick check after installation:

python -c "import ginsutility; print('ginsutility import OK')"

If this import fails, run the examples only after fixing the ginsutility installation and DLL availability.

Import module in python script and call functions.

A detailed description of pygidata can be found under docs/ or in the Gantner Documentation.

from gi_data.dataclient import GIDataClient
import os

PROFILES = {
    "qstation": {
        "base": os.getenv("GI_QSTATION_BASE", "http://10.1.50.36:8090"),
        "auth": {"username": os.getenv("GI_QSTATION_USER", "admin"),
                 "password": os.getenv("GI_QSTATION_PASS", "admin")},
    },
    "cloud": {
        "base": os.getenv("GI_CLOUD_BASE", "https://demo.gi-cloud.io"),
        "auth": {"access_token": os.getenv("GI_CLOUD_TOKEN", "")},
    },
}

ACTIVE_PROFILE = os.getenv("GI_PROFILE", "qstation")

def get_client(profile: str = ACTIVE_PROFILE) -> GIDataClient:
    cfg = PROFILES[profile]
    if cfg["auth"].get("access_token"):
        return GIDataClient(cfg["base"], access_token=cfg["auth"]["access_token"]) 
    return GIDataClient(cfg["base"],
                        username=cfg["auth"].get("username"),
                        password=cfg["auth"].get("password"))

client = get_client()

Development

Used as submodule in

  • gi-sphinx
  • gi-jupyterlab
  • gi-analytics-examples

Information on how to manually distribute this package can be found here

https://packaging.python.org/en/latest/tutorials/packaging-projects/

Hint: If you are debugging the source code with a jupyter notebook, run this code in the first cell to enable autoreloading source code changes.

%load_ext autoreload
%autoreload 2

Distribute with CI / CD

Edit pyproject.toml version number and create a release. -> Creating a release will trigger the workflow to push the package to PyPi

Tests

run tests locally:

pipenv run test -v

or

pytest

Generate loose requirements

Do this in a bash shell using the lowest version you want to support!

Install uv to easily install all needed python versions (coss-platform)

pip install uv
python -m pip install -U pip tox
python -m pip install pip-tools
python -m pip install pipreqs

To ensure we support multiple python versions we don't want to pin every dependency. Instead, we pin everything on the lowest version (that we support) and make it loose for every version above.

from root package dir (/gimodules-python)

./gen-requirements.sh

Ensure python-package version compatibility

uv python install 3.10 3.11 3.12 3.13 3.14

Now run for all envs

tox

of for a specific version only -> look what you defined in pyproject.toml

tox -e py310

NOTE: Remove the old gimodules version from requirements.txt before pushing (dependency conflict).


Documentation

Build docs from repository root.

nbsphinx requires a local Pandoc installation.

Install Pandoc

Windows (winget):

winget install --id JohnMacFarlane.Pandoc -e

Linux (Debian/Ubuntu):

sudo apt update
sudo apt install -y pandoc

Windows (PowerShell)

python -m pip install -r .\docs\requirements.txt
Set-Location .\docs
.\make.bat html

HTML output is written to docs\_build\html.

Linux/macOS

python -m pip install -r ./docs/requirements.txt
make -C docs html

HTML output is written to docs/_build/html.

Linting / Type hints

This project follows the codestyle PEP8 and uses the linter flake8 (with line length = 100).

You can format and check the code using lint.sh:

./lint.sh [directory/]

Type hints are highly recommended. Type hints in Python specify the expected data types of variables, function arguments, and return values, improving code readability, catching errors early, and aiding in IDE autocompletion.

To include type hints in the check:

mpypy=true ./lint.sh [directory])

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

pygidata-0.5.1.tar.gz (61.8 kB view details)

Uploaded Source

Built Distribution

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

pygidata-0.5.1-py3-none-any.whl (79.8 kB view details)

Uploaded Python 3

File details

Details for the file pygidata-0.5.1.tar.gz.

File metadata

  • Download URL: pygidata-0.5.1.tar.gz
  • Upload date:
  • Size: 61.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pygidata-0.5.1.tar.gz
Algorithm Hash digest
SHA256 024bdb72248dff3553824dc972e3542519fe36625d9812a0799946d786202129
MD5 94dcb053395a2a64473773ba477a9238
BLAKE2b-256 2a688d2b25e89ac97d08de9ccc707c2058d0e424c9c9400e7406f2a85f250bbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygidata-0.5.1.tar.gz:

Publisher: publish.yml on gantnerinstruments/pygidata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygidata-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pygidata-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 79.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pygidata-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 387cc4731a41ce3e32b13d0c4ad27b39f573f1c70ed4b059e585c53c67ceb75d
MD5 4cc876632c3b4a4b2f964ee9dc009777
BLAKE2b-256 4b641540157f9704b2d26b3547288132860d9748dcb73d77d0043cdb8d562977

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygidata-0.5.1-py3-none-any.whl:

Publisher: publish.yml on gantnerinstruments/pygidata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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