Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

cimhub_core

Shared foundation for all CIMHub converter packages. Provides the base classes, data model, and utilities that every spoke in the hub-and-spoke architecture depends on.

What's in here

Module Purpose
base.py ABCs: FormatReader, FormatWriter, FormatImporter, FormatExporter
graph_model.py GraphModel — typed in-memory store for LinkML dataclasses
registry.py ConverterRegistry — decorator-based dispatch for import/export functions
scaffold.py Code generator that scaffolds a new converter package from a template
serialization.py Shared serialization helpers (CSV, YAML round-trips)
connectivity/ Topology helpers (bus lookups, connectivity node resolution)
transformations/ CIM-to-CIM geometry transforms (wire spacings, coordinate systems)
get_utils/ get_or_create helpers for common CIM objects (BaseVoltage, Substation, etc.)
mcp/ MCP server tools for LLM-assisted model introspection

Architecture

Every CIMHub converter follows the same four-layer pipeline:

LinkML YAML schemas   →   Generated dataclasses   →   GraphModel   →   FormatReader / FormatWriter
                                                            ↕
                                                    FormatImporter / FormatExporter
                                                    (native ↔ CIM conversion)

cimhub_core owns the bottom two layers (GraphModel + ABCs). Each spoke package owns its own LinkML schema, generated dataclasses, and converter implementations.

GraphModel

The central data container. A sorted dictionary keyed by class then by identifier.

from cimhub_core import GraphModel

model = GraphModel()
model.add_to_graph(obj)

# Retrieve all objects of a class (sorted by identifier)
buses = model.list_by_class(schema.BusRecord)

# Search by attribute value
gen = model.find_by_attribute(schema.GeneratorRecord, "bus_number", 101)

# Counts and membership
model.count(schema.BusRecord)
schema.BusRecord in model
len(model)

Converter ABCs

from cimhub_core import FormatImporter, FormatExporter

class MyImporter(FormatImporter):
    def to_cim(self, source, **kwargs):
        ...

class MyExporter(FormatExporter):
    def to_model(self, network, **opts):
        """Return a GraphModel of native-format objects. No file I/O."""
        ...

See cimhub_core/src/cimhub_core/development/CONVERTER_API.md for the full contract.

Development Docs

The development/ directory contains the canonical references for all converter authors:

Doc What it covers
CONVERTER_API.md Public API every converter must expose
READER_WRITER_GUIDE.md FormatReader / FormatWriter implementation guide
LINKML_TEMPLATE.md How to write LinkML schemas for native formats
UNITS.md CIMUnit usage — never manually multiply by 1e3/1e6
STYLE_GUIDE.md Coding rules (KISS → DRY → Readable → Maintainable)
ARCHITECTURE.md Full sub-package architecture diagram
TEST_FIXTURE_ARCHITECTURE.md 4-tier test strategy
CONDUCTOR_GEOMETRY_ANTI_PATTERNS.md Line/cable geometry export rules

Download files

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

Source Distribution

cimhub_core-2.0.0a2.tar.gz (63.8 kB view details)

Uploaded Source

Built Distribution

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

cimhub_core-2.0.0a2-py3-none-any.whl (74.9 kB view details)

Uploaded Python 3

File details

Details for the file cimhub_core-2.0.0a2.tar.gz.

File metadata

  • Download URL: cimhub_core-2.0.0a2.tar.gz
  • Upload date:
  • Size: 63.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cimhub_core-2.0.0a2.tar.gz
Algorithm Hash digest
SHA256 ab123fa1552911f7c83fa6e91f8dcc008cdc9cccef9a15141aadaa7f223bd3c1
MD5 e00642474239f668467d0eaf40e8d17a
BLAKE2b-256 0e1b934a271b28c17fb52b8460bc976f656c58d1341971e2c5d9f4dfb71c7eb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimhub_core-2.0.0a2.tar.gz:

Publisher: publish-cimhub-core.yml on PNNL-CIM-Tools/CIMHub

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

File details

Details for the file cimhub_core-2.0.0a2-py3-none-any.whl.

File metadata

  • Download URL: cimhub_core-2.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 74.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cimhub_core-2.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 226dc4b55098b75f56642f6e4f14463bc7b4d8c74cc7c4229e0078c18299ece7
MD5 6c8bcc05e5d027179f7f7688f05e0e77
BLAKE2b-256 435375e5ead7c4607fe868428f24f9fe9b553abf0074d4ee62d47c79c90cec58

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimhub_core-2.0.0a2-py3-none-any.whl:

Publisher: publish-cimhub-core.yml on PNNL-CIM-Tools/CIMHub

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

Release history Release notifications | RSS feed

This release

2.0.0a2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page