Skip to main content

Notebook-friendly Python client for luminus-mcp

Project description

luminus-py

A notebook-friendly Python client for luminus-mcp.

This package starts the existing Node MCP server under the hood, calls tools over stdio, and returns Python-native result objects with optional pandas helpers.

Any MCP tool exposed by luminus-mcp is callable directly as a Python method, so the SDK does not need a hand-written wrapper for every tool.

The SDK also includes geospatial helpers for notebook workflows: to_geojson() for lightweight mapping and to_geodataframe() for GeoPandas users.

Roadmap: see ../docs/python-sdk-roadmap.md.

Install

pip install luminus-py[notebook]

For GIS notebook work:

pip install luminus-py[all]

You also need luminus-mcp itself available on your machine, because the Python SDK starts the existing Node MCP server under the hood.

npm install -g luminus-mcp@0.2.0

API keys

Keyed tools use the same auth model as the Node server. Resolution order is:

  1. environment variables like ENTSOE_API_KEY
  2. ~/.luminus/keys.json

Example ~/.luminus/keys.json:

{
  "ENTSOE_API_KEY": "...",
  "GIE_API_KEY": "...",
  "FINGRID_API_KEY": "..."
}

Per-notebook overrides are also supported:

lum = Luminus(profile="trader", env={"ENTSOE_API_KEY": "..."})

Quick start

from luminus import Luminus

with Luminus(profile="trader") as lum:
    prices = lum.get_day_ahead_prices(zone="DE")
    df = prices.to_pandas()

    # Any MCP tool can be called directly
    flows = lum.get_cross_border_flows(from_zone="DE", to_zone="NL")
    site = lum.compare_sites(sites=[
        {"name": "A", "lat": 52.1, "lon": 0.1},
        {"name": "B", "lat": 52.2, "lon": 0.2},
    ], country="GB")

    # GIS-friendly exports
    geojson = site.to_geojson(data_key="rankings")

    # Batch several calls into one DataFrame
    multi_zone = lum.call_many_to_pandas(
        "get_day_ahead_prices",
        [{"zone": "DE"}, {"zone": "FR"}, {"zone": "NL"}],
        parallel=True,
    )

    # One-shot export helpers
    prices_df = lum.call_tool_to_pandas("get_day_ahead_prices", {"zone": "DE"})
    rankings_geojson = lum.call_tool_to_geojson("compare_sites", {
        "country": "GB",
        "sites": [
            {"label": "A", "lat": 52.1, "lon": 0.1},
            {"label": "B", "lat": 52.2, "lon": 0.2},
        ],
    }, data_key="rankings")

Notebook demos

Polished notebook demos live in examples/:

Notebook-first helpers

The Python SDK now ships a few opinionated helpers for high-usage analyst flows:

  • lum.get_outages_frame(...)
  • lum.get_cross_border_flows_many([...])
  • lum.get_grid_proximity_substations(...)
  • lum.get_grid_proximity_lines(...)
  • lum.get_grid_proximity_snapshot(...)
  • lum.get_grid_connection_queue_projects(...)
  • lum.get_grid_connection_queue_sites(...)
  • lum.get_grid_connection_queue_snapshot(...)
  • lum.estimate_site_revenue_frame(...)
  • lum.estimate_site_revenue_estimate(...)

Example:

from luminus import GridProximitySnapshot, Luminus, SiteRevenueEstimate

with Luminus(profile="gis") as lum:
    outages = lum.get_outages_frame(zone="DE", type="generation")
    flows = lum.get_cross_border_flows_many([("DE", "NL"), ("FR", "DE")])
    substations = lum.get_grid_proximity_substations(lat=52.0, lon=0.1)
    queue = lum.get_grid_connection_queue_projects(connection_site_query="Berkswell")
    revenue = lum.estimate_site_revenue_frame(
        lat=52.0,
        lon=0.1,
        zone="GB",
        technology="bess",
        capacity_mw=20,
    )

    proximity: GridProximitySnapshot = lum.get_grid_proximity_snapshot(lat=52.0, lon=0.1)
    estimate: SiteRevenueEstimate = lum.estimate_site_revenue_estimate(
        lat=52.0,
        lon=0.1,
        zone="GB",
        technology="bess",
    )

Errors and typed models

  • Startup failures now raise LuminusStartupError.
  • Tool-side configuration failures raise LuminusConfigurationError.
  • Tool-side upstream/data-source failures raise LuminusUpstreamError.
  • Dynamic whole-surface access still works through LuminusResult, and common GIS/revenue flows also expose opt-in typed models.

Notes

  • Use lum.list_tools() to see the live tool surface for the active profile.

  • Use lum.describe_tool("tool_name") to inspect the MCP description/schema metadata.

  • Use lum.call_many() / lum.call_many_to_pandas() for generic multi-zone or multi-site notebook pulls.

  • Use parallel=True on batch helpers when you want the SDK to fan out across multiple MCP subprocesses.

  • Use lum.get_day_ahead_prices_many() and lum.get_generation_mix_many() for common analyst workflows.

  • Use lum.compare_sites_rankings() together with lum.compare_sites_rankings_geojson() and lum.compare_sites_rankings_geodataframe() for ranked siting output.

  • Use the typed snapshots only when they help notebook readability; the raw dynamic MCP surface is still available.

  • Notebook demos live in examples/.

  • Use to_geojson() for lightweight mapping and to_geodataframe() when GeoPandas is installed.

  • Requires luminus-mcp to be available on PATH, unless you pass an explicit command.

  • By default the client starts luminus-mcp --profile <profile>.

  • For local repo development you can point it at the built server directly:

lum = Luminus(command=["node", r"C:\Users\skf_s\luminus\dist\index.js"], profile="gis")

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

luminus_py-0.2.2.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

luminus_py-0.2.2-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file luminus_py-0.2.2.tar.gz.

File metadata

  • Download URL: luminus_py-0.2.2.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for luminus_py-0.2.2.tar.gz
Algorithm Hash digest
SHA256 dbed2381a79d35d534a21d2159f1150490b27ff04531e3b807600db1b43ab6c3
MD5 264f79baf603e860b59327f906bfe593
BLAKE2b-256 a569fa194c03253a225d5c223563679c315be3147c33b0a922eff03258f43a47

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminus_py-0.2.2.tar.gz:

Publisher: release.yml on kitfunso/luminus

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

File details

Details for the file luminus_py-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: luminus_py-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for luminus_py-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fad75bad0c84849835587bc2a1b7eddeeefc292489a93325801c14995e030aa9
MD5 2f1cf3f0901a3e464d068d1e4421678a
BLAKE2b-256 4b895fe5d495643e832c65c7bd63b8c683fbb4e7c48e9f6b4fc452ed9ba8b4e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminus_py-0.2.2-py3-none-any.whl:

Publisher: release.yml on kitfunso/luminus

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