Skip to content

Commit

Permalink
Merge pull request #498 from Breakthrough-Energy/develop
Browse files Browse the repository at this point in the history
chore: merge develop into master for v0.4.2 release
  • Loading branch information
danielolsen authored Jun 14, 2021
2 parents d707839 + 122516d commit f8c15dd
Show file tree
Hide file tree
Showing 67 changed files with 1,950 additions and 1,348 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
branch = True
omit =
**/test_*.py
**/__init__.py

4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ build
**/__pycache__
.ipynb_checkpoints
**/.ropeproject
.env
.venv
.dockerignore
config.ini
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Feature request
about: Suggest an idea for this project
title: Feature request
labels: feature request
assignees: ahurli, BainanXia, danielolsen, jon-hagg, rouille

---

# :rocket:

- [ ] Is your feature request essential for your project?


### Describe the workflow you want to enable
A clear and concise description of what can be enhanced, e.g., "I wish I could do [...]"

### Describe your proposed implementation
This should provide a description of the feature request, e.g.:
* "The class `Foo` should have a new method `bar` that allows to [...]"
* "Function `foo` needs a new arguments `bar` to set [...]"
* "Create a new function `foo` to calculate [...]"

If applicable, try to write a docstring for the desired feature. To illustrate, if you would like to add a new function in a module, provide:
* the name of the function
* a description of the task accomplished by the function
* a list of the input and output parameters together with their types (e.g., `int`,
`str`, `pandas.DataFrame`, etc.) and a short description of its/their meaning

### Describe alternatives you've considered, if relevant
This should provide a description of any alternative solutions or features you've
considered.

### Additional context
Add any other context or screenshots in this section, e.g., a plot from an article you
believe would clearly communicate results.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8]
python-version: [3.7, 3.8, 3.9]

name: Python ${{ matrix.python-version }}
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This is specific to this package
powersimdata/utility/.server_user
config.ini

# The remainder of this file taken from github/gitignore
# https://github.com/github/gitignore/blob/master/Python.gitignore
Expand Down
7 changes: 5 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ verify_ssl = true

[dev-packages]
black = "*"
pytest = "*"
coverage = "*"
pytest-cov = "*"

[packages]
networkx = "~=2.5"
numpy = "~=1.20"
pandas = "~=1.2"
paramiko = "==2.7.2"
pytest = "==5.4.3"
psycopg2 = "~=2.8.5"
scipy = "~=1.5"
tqdm = "==4.29.1"
psycopg2 = "~=2.8.5"
requests = "~=2.25"
478 changes: 276 additions & 202 deletions Pipfile.lock

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@

![logo](https://raw.githubusercontent.com/Breakthrough-Energy/docs/master/source/_static/img/BE_Sciences_RGB_Horizontal_Color.svg)

[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![Tests](https://github.com/Breakthrough-Energy/PowerSimData/workflows/Pytest/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Documentation](https://github.com/Breakthrough-Energy/docs/actions/workflows/publish.yml/badge.svg)](https://breakthrough-energy.github.io/docs/)
![GitHub contributors](https://img.shields.io/github/contributors/Breakthrough-Energy/PowerSimData?logo=GitHub)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Breakthrough-Energy/PowerSimData?logo=GitHub)
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/Breakthrough-Energy/PowerSimData/develop?logo=GitHub)
![GitHub pull requests](https://img.shields.io/github/issues-pr/Breakthrough-Energy/PowerSimData?logo=GitHub)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code of Conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat)](https://breakthrough-energy.github.io/docs/communication/code_of_conduct.html)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4538590.svg)](https://doi.org/10.5281/zenodo.4538590)


Expand Down
1 change: 1 addition & 0 deletions optional-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ fiona~=1.8.14
matplotlib==3.2.1
rtree~=0.9.4
shapely==1.7.1
psycopg2~=2.8.5
19 changes: 18 additions & 1 deletion powersimdata/data_access/context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from powersimdata.data_access.data_access import LocalDataAccess, SSHDataAccess
from powersimdata.data_access.launcher import HttpLauncher, NativeLauncher, SSHLauncher
from powersimdata.utility import server_setup
from powersimdata.utility.server_setup import DeploymentMode, get_deployment_mode
from powersimdata.utility.config import DeploymentMode, get_deployment_mode


class Context:
Expand All @@ -13,6 +14,8 @@ def get_data_access(data_loc=None):
:param str data_loc: pass "disk" if using data from backup disk,
otherwise leave the default.
:return: (:class:`powersimdata.data_access.data_access.DataAccess`) -- a data access
instance
"""
if data_loc == "disk":
root = server_setup.BACKUP_DATA_ROOT_DIR
Expand All @@ -23,3 +26,17 @@ def get_data_access(data_loc=None):
if mode == DeploymentMode.Server:
return SSHDataAccess(root)
return LocalDataAccess(root)

@staticmethod
def get_launcher(scenario):
"""Return instance for interaction with simulation engine
:param powersimdata.scenario.scenario.Scenario scenario: a scenario object
:return: (:class:`powersimdata.data_access.launcher.Launcher`) -- a launcher instance
"""
mode = get_deployment_mode()
if mode == DeploymentMode.Server:
return SSHLauncher(scenario)
elif mode == DeploymentMode.Container:
return HttpLauncher(scenario)
return NativeLauncher(scenario)
Loading

0 comments on commit f8c15dd

Please sign in to comment.