Skip to content

Commit

Permalink
Release 0.3.0 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
nllong authored Feb 21, 2023
1 parent 10a40ec commit c0968f8
Show file tree
Hide file tree
Showing 28 changed files with 2,665 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ omit =
;sort = Cover
sort = Name
skip_covered = True
show_missing = True
show_missing = True
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on:
pull_request:
push:
branches:
- "develop"
- "main"

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.9, 3.10.9]
test_env: [python, precommit, mypy]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Display system info
run: |
python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox -e ${{ matrix.test_env }}
integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-test.txt
- name: Build and run stack
run: |
printenv
docker volume create --name=pyseed_media
# verify that the stack wasn't cached
docker-compose -f tests/integration/docker-compose.yml stop
docker-compose -f tests/integration/docker-compose.yml rm -f
docker-compose -f tests/integration/docker-compose.yml up -d
- name: Wait for web server
uses: nev7n/wait_for_response@v1
with:
url: "http://localhost:8000/"
responseCode: 200
timeout: 120000
interval: 2000
- name: Wait another 30s
uses: jakejarvis/wait-action@master
with:
time: "30s"
- name: Dump docker logs before tests
uses: jwalton/gh-docker-logs@v1
- name: Extract API credentials from SEED docker instance
run: |
docker exec seed_web ./manage.py create_test_user_json --username [email protected] --host http://localhost:8000 --pyseed > seed-config.json
- name: Run tests with pytest
run: |
pytest -m "integration" -s
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@ ENV/
*.bak
*.old
.pytest_cache/
.idea
.vscode

# Seed config files
seed-config*.json
51 changes: 51 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
exclude: |
(?x)(
^docs/conf.py|
^docs/license.rst
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
args: ["--maxkb=50000"]
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ["--fix=auto"]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
hooks:
- id: autopep8
args:
[
"--in-place",
"--aggressive",
"--aggressive",
"--recursive",
"--max-line-length=100",
"--ignore=E501,E402,W503,W504,E731",
]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--ignore=E501,E402,W503,W504,E731,F401"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
hooks:
- id: prettier
types_or: [css, yaml, markdown, html, scss, javascript]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
args: ["-m=VERTICAL_HANGING_INDENT"] # vertical hanging
17 changes: 16 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Changelog
=========

0.3.0
-----

## What's Changed
* Add instance info and fix a couple bugs by @nllong in https://github.com/SEED-platform/py-seed/pull/16
* Fix building list and client information by @nllong in https://github.com/SEED-platform/py-seed/pull/17
* get and create meters and meter readings by @nllong in https://github.com/SEED-platform/py-seed/pull/18
* Add GeoJSON Area Calc by @nllong in https://github.com/SEED-platform/py-seed/pull/19

**Full Changelog**: https://github.com/SEED-platform/py-seed/commits/v0.3.0

0.2.0
-----
* Unknown updates

0.1.0 [2018-02-16]
------------------
* OpenSource release
* OpenSource release
57 changes: 50 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,54 @@
Py-SEED
=======

A python API client for the SEED Platform
.. image:: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg?branch=develop
:target: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg

.. image:: https://badge.fury.io/py/py-seed.svg
:target: https://pypi.python.org/pypi/py-seed/

A python API client for the SEED Platform. This is an updated version of the Client. It is compatible with the latest version of the SEED Platform (>2.17.4). This client still has access to the previous format of generating a lower level API client by accessing `seed_client_base.SEEDOAuthReadOnlyClient`, `seed_client_base.SEEDOAuthReadWriteClient`, `seed_client_base.SEEDReadOnlyClient`, and `seed_client_base.SEEDReadWriteClient`. This lower level API is documented below under the `Low-Level Documentation`

Documentation
-------------
The SEED client is a read-write client. To install the client run:

.. code-block:: bash
pip install pyseed
Within Python you can use the client like this:

.. code-block:: python
from pathlib import Path
from pyseed.seed_client import SeedClient
# The seed-config.json file defines the hosting locaiton and credentials for your SEED instance.
# If running SEED locally for testing, then you can run the following from your SEED root directory:
# ./manage.py create_test_user_json --username [email protected] --host http://localhost:8000 --file ./seed-config.json --pyseed
config_file = Path('seed-config.json')
organization_id = 1
seed_client = SeedClient(organization_id, connection_config_filepath=config_file)
# Get/create the new cycle and upload the data. Make sure to set the cycle ID so that the
# data end up in the correct cycle
cycle = seed_client.get_or_create_cycle(
'pyseed-api-test', date(2021, 6, 1), date(2022, 6, 1), set_cycle_id=True
)
seed_client.upload_and_match_datafile(
'pyseed-properties-test',
'tests/data/test-seed-data.xlsx',
'Single Step Column Mappings',
'tests/data/test-seed-data-mappings.csv'
)
# See the projects unit tests for more examples.
Low-Level Documentation
-----------------------
This provides two user authentication based Python clients and two OAuth2 authentication based Python clients for interacting with the SEED Platform Api::


Expand All @@ -15,14 +58,17 @@ This provides two user authentication based Python clients and two OAuth2 authen
SEEDReadWriteClient



(The OAuthMixin is constructed around the the JWTGrantClient found in jwt-oauth2lib. see https://github.com/GreenBuildingRegistry/jwt_oauth2)

SEED (Standard Energy Efficiency Data Platform™) is an open source "web-based application that helps organizations easily manage data on the energy performance of large groups of buildings" funded by the United States Department of Energy.

More information can be found here:

* https://energy.gov/eere/buildings/standard-energy-efficiency-data-platform
* http://seedinfo.lbl.gov/
* https://seed-platform.org
* https://github.com/SEED-platform
* https://buildingdata.energy.gov/#/seed


Note the clients do not provide per api-call methods, but does provide the standard CRUD methods: get, list, put, post, patch, delete
Expand Down Expand Up @@ -52,16 +98,13 @@ Usage:
seed_client.get(property_pk, endpoint='properties')
Contributing
------------
License
-------
py-SEED is released under the terms of the MIT license. Full details in LICENSE file.

Changelog
---------
py-SEED was developed for use in the greenbuildingregistry project.
For a full changelog see `CHANGELOG.rst <https://github.com/GreenBuildingRegistry/py-seed/blob/master/CHANGELOG.rst>`_.
py-SEED was developed for use in the greenbuildingregistry project but has been extended for various uses, including Salesforce data transfer and SEED data analysis.

N.B. this client is undergoing development and should be considered experimental.
For a full changelog see `CHANGELOG.rst <https://github.com/seed-platform/py-seed/blob/master/CHANGELOG.rst>`_.
2 changes: 1 addition & 1 deletion pyseed/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Local Imports
from pyseed.seedclient import (
from pyseed.seed_client_base import ( # noqa
SEEDOAuthReadOnlyClient,
SEEDOAuthReadWriteClient,
SEEDReadOnlyClient,
Expand Down
Loading

0 comments on commit c0968f8

Please sign in to comment.