Skip to main content

OpenNEM Australian Energy Data Python Client

Project description

OpenNEM Energy Market Data Access

PyPI Tests PyPI - License

The OpenNEM project aims to make the wealth of public National Electricity Market (NEM) data more accessible to a wider audience.

This client library for Python enables accessing the Opennem API and data sets.

Project homepage at https://opennem.org.au

Developer documentation at https://developers.opennem.org.au/

Currently supporting the following energy networks:

1. Requirements

  • Python 3.8+ (see .python-version with pyenv)
  • Docker and docker-compose if you want to run the local dev stack

2. Quickstart

$ pip install opennem
>>> import opennem

3. Development

3.1 Auto setup and install

For contributions and development of this repository you need to install all the requirements. There are some helper scripts in the scripts/ folder.

$ ./scripts/init.sh

By default the venv is installed in the user local cache folder and not in the project path. To link the venv so that it can be found automatically by the shell or editors run the helper script

$ ./scripts/link_venv.sh
Created .venv

3.2 Manual Setup

3.2.1 Prerequisites

For MacOS and Linux require pyenv and poetry

3.2.2 Initialize python

We use pyenv for python versioning as it allows a system to run multiple version of python. The version for this project is specified in the .python-version file in the root of the repository.

To install the locally required python version

$ pyenv install `cat .python-version`

To initialize and use the local python version

$ pyenv version local
3.9.6 (set by /Users/user/Projects/Opennem/opennempy/.python-version)

To test the install is correct

 python -V
Python 3.9.6
❯ which python
/Users/n/.pyenv/shims/python

3.2.3 Install with poetry

To manually setup the local development environment, simply create the virtual environment, link it and setup the PYTHONPATH

$ poetry install
$ ln -s `poetry env info -p` .venv
$ source .venv/bin/activate
$ pwd > .venv/lib/python3.9/site-packages/local.pth

Alternatively to actiavate the virtual environment poetry has a shell command:

$ poetry shell
Spawning shell within /Users/n/Library/Caches/pypoetry/virtualenvs/opennem-pFt2SfpM-py3.9
$ which python
/Users/n/Library/Caches/pypoetry/virtualenvs/opennem-pFt2SfpM-py3.9/bin/python

3.2.4 Install with venv

Alternatively if you do not wish to use poetry you can setup a simple venv in the local folder and activate it.

$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt

3.3 Test Install

You should be able to run a Python REPL (like iPython) and import the opennem module

$ ipython
Python 3.9.6 (default, Jun 28 2021, 19:24:41)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.23.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import opennem

In [2]:

Project details


Release history Release notifications | RSS feed

This version

3.8.0

Download files

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

Source Distribution

opennem-3.8.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

opennem-3.8.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file opennem-3.8.0.tar.gz.

File metadata

  • Download URL: opennem-3.8.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0

File hashes

Hashes for opennem-3.8.0.tar.gz
Algorithm Hash digest
SHA256 a0d8fbcff7c6371c9bbba669fac171916dcff6786db927af5352417088e048cb
MD5 1dfbfdd597a8a94d5453415a59fef520
BLAKE2b-256 5a6586dafd0f52993687809a61b31573ed20ed89b60b6b64f16078775786e805

See more details on using hashes here.

File details

Details for the file opennem-3.8.0-py3-none-any.whl.

File metadata

  • Download URL: opennem-3.8.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0

File hashes

Hashes for opennem-3.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 330b3201b149947c3d3bbf98d6482d9a04f74d76d18186607915941faf8c1bbe
MD5 3d3125aaa2389f9b39dfd2468172d9d0
BLAKE2b-256 74f1a69310b4e88116a7ef2e2a0b4d0719f03e11a543e91fb8fc80989341f858

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page