ewx-public
The ewx-public package provides the public Python API for writing custom rules on the Energyworx platform. Installing it locally gives you type hints, IDE autocompletion, and the ability to develop and unit-test rules outside the platform before uploading them.
For the API reference (base classes, factories, assertion helpers, etc.), see ewx-public Package. For an end-to-end walkthrough including writing rules and unit-testing them, see Local Rule Development.
First-time usage
Accessing the package from Artifact Registry
The package is hosted in our Artifact Registry, alongside the other shareable packages. To access it, you need a Google Account with access to the ewx-global Artifact Registry project. If you do not have access, ask Service Desk to grant the required permissions.
Prerequisites
- Python 3.11
- gcloud CLI
- Access to Artifact Registry project
ewx-global
Authenticate with gcloud
gcloud auth application-default login
Installation with pip
- macOS / Linux
- Windows (PowerShell)
mkdir my_ewx_rules
cd my_ewx_rules
python3.11 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install keyring keyrings.google-artifactregistry-auth
pip install --index-url https://europe-west1-python.pkg.dev/ewx-global/python-shared/simple/ --extra-index-url https://pypi.org/simple/ ewx-public==26.3.0
mkdir my_ewx_rules
cd my_ewx_rules
py -3.11 -m venv .venv
.venv\Scripts\Activate.ps1
pip install --upgrade pip
pip install keyring keyrings.google-artifactregistry-auth
pip install --index-url https://europe-west1-python.pkg.dev/ewx-global/python-shared/simple/ --extra-index-url https://pypi.org/simple/ ewx-public==26.3.0
If Activate.ps1 is blocked by execution policy, run Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned once and reopen PowerShell.
Pin ewx-public to the version that matches the platform release you are working against — for platform release YY.MM the package version is YY.M.0. See Versioning for details. The example above targets platform release 26.03; replace the version to match your target release.
Installation with uv
Use this pyproject.toml as a starting point:
[project]
name = "my-ewx-rules"
version = "0.1.0"
description = "Local rule development project for Energyworx."
requires-python = ">=3.11,<3.12"
dependencies = [
"ewx-public==26.3.0",
]
[dependency-groups]
dev = [
"pytest>=7.1.3",
]
[tool.uv]
package = false
[[tool.uv.index]]
name = "ewx-global"
url = "https://europe-west1-python.pkg.dev/ewx-global/python-shared/simple/"
explicit = true
[tool.uv.sources]
ewx-public = { index = "ewx-global" }
Then run:
- macOS / Linux
- Windows (PowerShell)
gcloud auth application-default login
export UV_INDEX_EWX_GLOBAL_USERNAME=oauth2accesstoken
export UV_INDEX_EWX_GLOBAL_PASSWORD="$(gcloud auth print-access-token)"
uv sync --python 3.11
gcloud auth application-default login
$env:UV_INDEX_EWX_GLOBAL_USERNAME = "oauth2accesstoken"
$env:UV_INDEX_EWX_GLOBAL_PASSWORD = (gcloud auth print-access-token)
uv sync --python 3.11
Note: the access token expires. Re-run the UV_INDEX_EWX_GLOBAL_PASSWORD assignment when needed.
Verify the installation
python -c "import ewx_public; print(ewx_public.__name__)"
The command should print ewx_public without error.
Next steps
- Write your first rule and test it locally: Local Rule Development
- Browse the available base classes, factories, and assertion helpers: ewx-public Package reference
- Upload tested rules to the platform via the UI or ewx-cli