Skip to main content

A python client for Egeria

Project description

Egeria Logo

GitHub

pyegeria: a python client for Egeria

A lightweight Python 3.12+ client and CLI for the Egeria open metadata and governance platform. It helps you configure and operate Egeria services and work with metadata (assets, glossaries, lineage, etc.) from Python, with examples, tests, and documented report formats.

This is a package for easily using the Egeria open metadata environment from python. Details about the open source Egeria project can be found at Egeria Project.

This package is in active development. There is initial support for many of Egeria's services including configuration and operation. This client depends on This release supports Egeria 6.0 - although most of the functions may work on earlier versions of Egeria as well.

The code is organized to mimic the existing Egeria Java Client structure.

The commands folder holds the Egeria Command Line Interface and corresponding commands to visualize and use Egeria. The commands also serve as useful examples.

An examples folder holds some useful examples showing different facets of using pyegeria.

For detailed guidance on report formats (selection and migration from columns→attributes), see:

  • examples/doc_samples/report_formats.md

Report specs: families and filtering

Report specs (aka format sets) can be tagged with an optional family string to help organize and discover related specs.

  • Show names with family and sort by family, then name:
from pyegeria.view.base_report_formats import report_spec_list

names = report_spec_list(show_family=True, sort_by_family=True)
for n in names:
  print(n)
  • Filter specs by family programmatically:
from pyegeria.view.base_report_formats import report_specs

# Exact family match (case-insensitive)
security_specs = report_specs.filter_by_family("Security")
# Specs with no family assigned
no_family_specs = report_specs.filter_by_family("")

WARNING: files that start with "X" are in-progress placeholders that are not meant to be used..they will mature and evolve.

All feedback is welcome. Please engage via our community, team calls, or via github issues in this repo. If interested in contributing, you can engage via the community or directly reach out to dan.wolfson@pdr-associates.com.

This is a learning experience.

Configuration

pyegeria uses a simple, predictable precedence for configuration:

  1. Built-in defaults (Pydantic models in pyegeria.config)
  2. Config file (JSON) if found
  3. Environment variables (OS env and optional .env)
  4. Explicit env file passed to get_app_config/load_app_config

Environment always overrides config file, which overrides defaults.

Where to put your configuration

  • Config file: A JSON file named config.json. The loader looks in this order:

    • If PYEGERIA_CONFIG_DIRECTORY is set: $PYEGERIA_CONFIG_DIRECTORY/$PYEGERIA_CONFIG_FILE
    • Else if PYEGERIA_ROOT_PATH is set: $PYEGERIA_ROOT_PATH/$PYEGERIA_CONFIG_FILE
    • Else: ./config.json (the current working directory)
  • .env file: Optional. If present in the current working directory (.env), variables from it will be loaded. You can also pass a specific env file path to get_app_config(env_file=...) or load_app_config(env_file=...). For sample variables, see config/env in this repo.

Common environment variables

  • PYEGERIA_CONFIG_DIRECTORY: directory containing your config.json
  • PYEGERIA_ROOT_PATH: root folder used to resolve config.json when CONFIG_DIRECTORY is not set
  • PYEGERIA_CONFIG_FILE: filename of the configuration JSON (default: config.json)
  • PYEGERIA_CONSOLE_WIDTH: integer console width (e.g., 200 or 280)
  • EGERIA_PLATFORM_URL, EGERIA_VIEW_SERVER_URL, EGERIA_ENGINE_HOST_URL: URLs for your Egeria servers
  • EGERIA_USER, EGERIA_USER_PASSWORD: credentials used by some clients
  • Logging related: PYEGERIA_ENABLE_LOGGING, PYEGERIA_LOG_DIRECTORY, PYEGERIA_CONSOLE_LOG_LVL, PYEGERIA_FILE_LOG_LVL, etc.

See config/env for more variables and defaults.

Example .env

PYEGERIA_CONFIG_DIRECTORY=/path/to/configs

PYEGERIA_ROOT_PATH=/path/to/project

PYEGERIA_CONFIG_FILE=config.json

EGERIA_PLATFORM_URL=https://localhost:9443

EGERIA_VIEW_SERVER=qs-view-server

EGERIA_VIEW_SERVER_URL=https://localhost:9443

EGERIA_USER=myuser

EGERIA_USER_PASSWORD=mypassword

PYEGERIA_CONSOLE_WIDTH=280

Lines starting with # are comments. Quotes are optional; python-dotenv/pydantic-settings handle both.

Example config.json (minimal)

{ "Environment": { "Pyegeria Root": ".", "Egeria Platform URL": "https://localhost:9443" }, "User Profile": { "Egeria Home Collection": "MyHome" } }

Programmatic usage

from pyegeria import get_app_config cfg = get_app_config() # uses OS env and ./.env

or with explicit env file

cfg = get_app_config(env_file="/path/to/dev.env")

Access values via Pydantic models

print(cfg.Environment.egeria_platform_url) print(cfg.Logging.enable_logging)

CLI quick checks

  • Validate your env file: python scripts/validate_env.py --env config/env python scripts/validate_env.py # auto-detects ./config/env or ./.env

Testing

By default, running pytest executes unit tests that use monkeypatching/fakes and do not contact a live Egeria.

  • Run unit tests (recommended default): poetry install poetry run pytest -v

You can also run tests live against a local Egeria instance. Enable live mode with either a CLI flag or an environment variable. In live mode, tests marked as unit are skipped and live tests run using a real Client2 connection.

  • Enable live mode via CLI: poetry run pytest -q --live-egeria

  • Or enable via environment variable: PYEG_LIVE_EGERIA=1 poetry run pytest -q

Default live connection parameters (can be overridden via env):

  • server_name = "qs-view-server" (override with PYEG_SERVER_NAME)
  • platform_url = "https://localhost:9443" (override with PYEG_PLATFORM_URL)
  • user_id = "peterprofile" (override with PYEG_USER_ID)
  • user_pwd = "secret" (override with PYEG_USER_PWD)

Notes:

  • SSL verification is controlled by pyegeria._globals.enable_ssl_check, which defaults to False in this repo to support localhost/self-signed certs.
  • See tests/conftest.py for the live test fixtures and switches.

Troubleshooting

Troubleshooting

  • If your env doesn’t seem to apply, confirm which config.json is used (the loader checks PYEGERIA_CONFIG_DIRECTORY first, then PYEGERIA_ROOT_PATH, then ./config.json).
  • .env files are optional. Missing .env is not an error.
  • You can always override values with OS environment variables (they take precedence over config.json).

License: CC BY 4.0, Copyright Contributors to the ODPi Egeria project.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pyegeria-5.5.3.10.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

pyegeria-5.5.3.10-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file pyegeria-5.5.3.10.tar.gz.

File metadata

  • Download URL: pyegeria-5.5.3.10.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pyegeria-5.5.3.10.tar.gz
Algorithm Hash digest
SHA256 5ebca00fe404aac3181fc6f9b7c3edad94a2bb6f5b16518bfa0c7206811161d0
MD5 d27f51f66687ee6c7ac6e1ff7d81fd6f
BLAKE2b-256 9b5b2d3ed755865ab2a351202746e6c7cfdcad94356227d767627069192914cd

See more details on using hashes here.

File details

Details for the file pyegeria-5.5.3.10-py3-none-any.whl.

File metadata

  • Download URL: pyegeria-5.5.3.10-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pyegeria-5.5.3.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4be345a30ea22460da63a7b286f2589ad4116867e732547be401e9258c8985ec
MD5 9bc28937a4a1d797617423b9f7129ac8
BLAKE2b-256 0dc090aa82ffb79b377991a31c50aaf2829f5872c0494735a42ead833519f5ad

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