Skip to content

Commit

Permalink
0.4.0 Release (#30)
Browse files Browse the repository at this point in the history
* Merge main into develop after release (#21)

* Release 0.3.0 (#20)

* precommit

* Fix delete cycle progress key and race condition (#24)

* Release 0.3.0 (#20)

* precommit

* add progress key to delete cycles

* Remove deprecated APIs, fix typos (#23)

* Update README.rst

* update license (#26)

* Updates to support 179d, includes creating property, downloading property reports from ESPM, and updating building search(#22)

* adding create_building and update_building methods
* modify search_buildings to provide appropriate cycle id
* adding client methods for creating extra data columns
* add pass throughs for file downloads
* updates for audit template workflow
* method to download property xlsx
---------

Co-authored-by: Alex Swindler <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>

* prep release

* increase timeout for server start

* increase timeout for server start (#31)

* cleanup before release (#32)

* configure seed to load small EEEJ dataset for integration test (#33)

---------

Co-authored-by: Nicholas Long <[email protected]>
Co-authored-by: Alex Swindler <[email protected]>
Co-authored-by: Nicholas Long <[email protected]>
  • Loading branch information
4 people authored Sep 27, 2023
1 parent 7f0cef9 commit bcb3d89
Show file tree
Hide file tree
Showing 20 changed files with 689 additions and 257 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,19 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-test.txt
- name: Build and run stack
- name: Install more recent docker compose
uses: ndeloof/[email protected]
with:
version: v2.20.0
legacy: true
- name: Print versions
run: |
printenv
docker --version
docker-compose --version
which docker-compose
- name: Build and run stack
run: |
docker volume create --name=pyseed_media
# verify that the stack wasn't cached
docker-compose -f tests/integration/docker-compose.yml stop
Expand All @@ -56,22 +66,27 @@ jobs:
- name: Wait for web server
uses: nev7n/wait_for_response@v1
with:
# Increase the timeout significanlty, the EEEJ census tract
# migration take ~6 minutes to run along.
url: "http://localhost:8000/"
responseCode: 200
timeout: 120000
interval: 2000
timeout: 640000
interval: 5000
- name: Wait another 30s
uses: jakejarvis/wait-action@master
with:
time: "30s"
- name: Dump docker logs before tests
uses: jwalton/gh-docker-logs@v1
uses: jwalton/gh-docker-logs@v2
- 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
docker exec pyseed_web ./manage.py create_test_user_json --username [email protected] --host http://localhost:8000 --pyseed > seed-config.json
- name: Run tests with pytest
env:
SEED_PM_UN: ${{ secrets.SEED_PM_UN }}
SEED_PM_PW: ${{ secrets.SEED_PM_PW }}
run: |
pytest -m "integration" -s
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
uses: jwalton/gh-docker-logs@v2
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ coverage.xml
*,cover
.hypothesis/
coverage-report
tests/output

# Translations
*.mo
Expand Down Expand Up @@ -99,3 +100,6 @@ ENV/

# Seed config files
seed-config*.json

*.DS_Store
*credentials.json
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- id: mixed-line-ending
args: ["--fix=auto"]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
rev: v2.0.4
hooks:
- id: autopep8
args:
Expand All @@ -35,12 +35,12 @@ repos:
"--ignore=E501,E402,W503,W504,E731",
]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.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
rev: v3.0.3
hooks:
- id: prettier
types_or: [css, yaml, markdown, html, scss, javascript]
Expand Down
25 changes: 23 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
Changelog
=========

0.4.0
-----

This release adds multiple helper methods to improve usability with single properties. Added methods for create_building, update_building, get_columns, create_extra_data_column, create_extra_data_column_from_file, retrieve_at_building_and_update, retrieve_portfolio_manager_property, and import_portfolio_manager_property.

What's Changed
**************

* Fix delete cycle progress key and race condition by @nllong in https://github.com/SEED-platform/py-seed/pull/24
* Remove deprecated APIs, fix typos by @axelstudios in https://github.com/SEED-platform/py-seed/pull/23
* Update license dates by @nllong in https://github.com/SEED-platform/py-seed/pull/26
* Add new endpoints to support 179D by @kflemin in https://github.com/SEED-platform/py-seed/pull/22
* Increase timeout for server start by @nllong in https://github.com/SEED-platform/py-seed/pull/31

## New Contributors
* @kflemin made their first contribution in https://github.com/SEED-platform/py-seed/pull/22

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

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
What's Changed
**************

* Add instance info and fix a couple of 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
Expand Down
40 changes: 39 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
MIT License
SEED Platform™, Copyright (c) 2017, 2023 Alliance for Sustainable Energy, LLC, and other contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

(1) Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.

(2) Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.

(3) Neither the name of the copyright holder nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior written
permission.

(4) Other than as required in clauses (1) and (2), distributions in any form of modifications
or other derivative works may not use the "SEED Platform" trademark, "Standard Energy
Efficiency Data Platform", "Standard Energy Efficiency Data", "SEED", or any other confusingly
similar designation without specific prior written permission from the U.S. Department of Energy.

(5) The name of the copyright holder(s), any contributors, the United States Government, the
United States Department of Energy, or any of their employees may not be used to endorse or
promote products derived from this software without specific prior written permission from the
respective party.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED STATES
DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.

---

Copyright (c) 2017 Green Building Registry

Expand Down
27 changes: 24 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@ 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`

Stakeholders
-------------

The following list of stakeholders should be considered when making changes to this module

- 179D Tax Deduction Web Application
- Earth Advantage Green Building Registry
- User scripts for managing building data
- ECAM

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

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

Expand All @@ -24,7 +34,7 @@ Within Python you can use the client like this:
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.
# The seed-config.json file defines the hosting location 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
Expand Down Expand Up @@ -97,11 +107,22 @@ Usage:
# get a single property
seed_client.get(property_pk, endpoint='properties')
Local Testing
-------------

Tests can be run via the `pytest` command.

You will need to export environment variables for a test portfolio manager account to test integration. Environment variables should be named:

..code-block:: bash

SEED_PM_UN
SEED_PM_PW


License
-------
py-SEED is released under the terms of the MIT license. Full details in LICENSE file.
Full details in LICENSE file.

Changelog
---------
Expand Down
33 changes: 33 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": "0.2",
"ignorePaths": [],
"dictionaryDefinitions": [],
"dictionaries": [],
"words": [
"apibase",
"buildingsync",
"codeauthor",
"dname",
"durl",
"ECAM",
"ESPM",
"excpt",
"geocoded",
"greenbuildingregistry",
"JSONAPI",
"Munday",
"officedocument",
"openxmlformats",
"pyseed",
"pytest",
"sdist",
"SEEDO",
"seedrecords",
"spreadsheetml",
"subclassing",
"taxlot",
"taxlots"
],
"ignoreWords": [],
"import": []
}
2 changes: 1 addition & 1 deletion pyseed/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ confidence=
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
Expand Down
24 changes: 12 additions & 12 deletions pyseed/apibase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
copyright (c) 2016 Earth Advantage. All rights reserved.
..codeauthor::Paul Munday <[email protected]>
Functionality for calls to external API's"""
Functionality for calls to external APIs"""

# Imports from Third Party Modules
import re
Expand Down Expand Up @@ -47,24 +47,24 @@ def __init__(self, url=None, use_ssl=True, timeout=None, use_json=False,
# pylint: disable=too-many-arguments
"""Set url,api key, auth usage, ssl usage, timeout etc.
:param url: url to use, http(s)://can be omitted, an error will
will be used if it is supplied and dose not match use_ssl
:param: use_ssl: connect over https, defaults to true
:param url: url to use, http(s):// can be omitted, an error will
be used if it is supplied and does not match `use_ssl`
:param: use_ssl: connect over https, defaults to True
:param use_auth: use authentication
..Note:
if use_auth is True the default is to use http basic
If `use_auth` is True the default is to use http basic
authentication if self.auth is not set. (You will need to
to this by overriding __init__ and setting this before
do this by overriding __init__ and setting this before
calling super.
This requires username and password to be supplied as
keyword arguments. N.B. api keys using basic auth e.g. SEED
keyword arguments. N.B. api keys using basic auth e.g., SEED
should be supplied as password.
To use Digest Authentication set auth_method='digest'
If use_ssl is False and the url you supply starts with https
If `use_ssl` is False and the url you supply starts with https
an error will be thrown.
"""
self.timeout = timeout
Expand All @@ -80,7 +80,7 @@ def __init__(self, url=None, use_ssl=True, timeout=None, use_json=False,
def _construct_payload(self, params):
"""Construct parameters for an api call.
.
:param params: An dictionary of key-value pairs to include
:param params: A dictionary of key-value pairs to include
in the request.
:return: A dictionary of k-v pairs to send to the server
in the request.
Expand Down Expand Up @@ -319,7 +319,7 @@ def _get_auth(self):
def _construct_payload(self, params):
"""Construct parameters for an api call.
.
:param params: An dictionary of key-value pairs to include
:param params: A dictionary of key-value pairs to include
in the request.
:return: A dictionary of k-v pairs to send to the server
in the request.
Expand Down Expand Up @@ -355,8 +355,8 @@ def _get_access_token(self):

def _construct_payload(self, params):
"""Construct parameters for an api call.
.
:param params: An dictionary of key-value pairs to include
:param params: A dictionary of key-value pairs to include
in the request.
:return: A dictionary of k-v pairs to send to the server
in the request.
Expand Down
Loading

0 comments on commit bcb3d89

Please sign in to comment.