Skip to content

Commit

Permalink
Merge pull request #534 from Breakthrough-Energy/develop
Browse files Browse the repository at this point in the history
chore: merge develop into master for v0.4.4 release
  • Loading branch information
rouille authored Sep 1, 2021
2 parents f8c2347 + 09d18a4 commit 2fa9fb9
Show file tree
Hide file tree
Showing 42 changed files with 973 additions and 1,155 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Python 🐍 package 📦 to PyPI and TestPyPI
on:
workflow_dispatch:
push:
tags:
- v*.*.*

jobs:
release:
name: Publish python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: python -m pip install --upgrade build
- run: python -m build

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ WORKDIR /PowerSimData
COPY Pipfile .
COPY Pipfile.lock .
RUN pip install -U pip pipenv ipython; \
pipenv sync --dev --system; \
pip install jedi==0.17.2
pipenv sync --dev --system;

COPY . .
RUN pip install .
Expand Down
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ psycopg2 = "~=2.8.5"
scipy = "~=1.5"
tqdm = "==4.29.1"
requests = "~=2.25"
fs = "*"
"fs.sshfs" = "*"
599 changes: 310 additions & 289 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/grid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ A ``Grid`` object can be created as follows:

.. code-block:: python
from powersimdata.input.grid import Grid
from powersimdata import Grid
usa = Grid("USA")
- Western interconnection

.. code-block:: python
from powersimdata.input.grid import Grid
from powersimdata import Grid
western = Grid("Western")
- combination of two interconnections

.. code-block:: python
from powersimdata.input.grid import Grid
from powersimdata import Grid
eastern_western = Grid(["Eastern", "Western"])
texas_western = Grid(["Texas", "Western"])
Expand Down
18 changes: 9 additions & 9 deletions docs/scenario.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ A scenario can be created using few lines of code. This is illustrated below:

.. code-block:: python
from powersimdata.scenario.scenario import Scenario
from powersimdata import Scenario
scenario = Scenario()
# print name of Scenario object state
Expand Down Expand Up @@ -111,7 +111,7 @@ A scenario can be created using few lines of code. This is illustrated below:
# add a new bus, and a new one-way DC line connected to this bus
scenario.change_table.add_bus(
[{"lat": 48, "lon": -125, "zone_id": 201, "baseKV": 138}])
scenario.state.builder.change_table.add_dcline(
scenario.change_table.add_dcline(
[{"from_bus_id": 2090023, "to_bus_id": 2090024, "Pmin": 0, "Pmax": 200}])
# get grid used in scenario
Expand All @@ -130,13 +130,13 @@ previous scenario. These can be called as:

.. code-block:: python
scenario.state.builder.change_table.scale_renewable_stubs()
scenario.change_table.scale_renewable_stubs()
or

.. code-block:: python
scenario.state.builder.change_table.scale_congested_mesh_branches(ref_scenario)
scenario.change_table.scale_congested_mesh_branches(ref_scenario)
where ``ref_scenario`` is a ``Scenario`` object in **analyze** state.

Expand Down Expand Up @@ -172,7 +172,7 @@ The **execute** state accomplishes the three following tasks:

.. code-block:: python
from powersimdata.scenario.scenario import Scenario
from powersimdata import Scenario
scenario = Scenario("dummy")
# print scenario information
Expand All @@ -195,7 +195,7 @@ specified using for example:

.. code-block:: python
process_run = scenario.state.launch_simulation(threads=8)
process_run = scenario.launch_simulation(threads=8)
Extracting data from the simulation engine outputs can be a memory intensive process. If
there are resource constraints where the engine resides, it is possible to pause the
Expand All @@ -220,7 +220,7 @@ to do so:

.. code-block:: python
from powersimdata.scenario.scenario import Scenario
from powersimdata import Scenario
scenario = Scenario(600)
# print name of Scenario object state
Expand Down Expand Up @@ -279,7 +279,7 @@ monitoring files will be removed. The **delete** state is only accessible from t

.. code-block::python
from powersimdata.scenario.scenario import Scenario
from powersimdata import Scenario
from powersimdata.scenario.delete import Delete
scenario = Scenario("dummy")
Expand All @@ -303,7 +303,7 @@ A scenario can be move to a backup disk. The **move** state is only accessible f

.. code-block:: python
from powersimdata.scenario.scenario import Scenario
from powersimdata import Scenario
from powersimdata.scenario.move import Move
scenario = Scenario("dummy")
Expand Down
7 changes: 3 additions & 4 deletions powersimdata/data_access/context.py
Original file line number Diff line number Diff line change
@@ -1,7 +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.config import DeploymentMode, get_deployment_mode
from powersimdata.utility.config import DeploymentMode


class Context:
Expand All @@ -22,8 +22,7 @@ def get_data_access(data_loc=None):
else:
root = server_setup.DATA_ROOT_DIR

mode = get_deployment_mode()
if mode == DeploymentMode.Server:
if server_setup.DEPLOYMENT_MODE == DeploymentMode.Server:
return SSHDataAccess(root)
return LocalDataAccess(root)

Expand All @@ -34,7 +33,7 @@ def get_launcher(scenario):
:param powersimdata.scenario.scenario.Scenario scenario: a scenario object
:return: (:class:`powersimdata.data_access.launcher.Launcher`) -- a launcher instance
"""
mode = get_deployment_mode()
mode = server_setup.DEPLOYMENT_MODE
if mode == DeploymentMode.Server:
return SSHLauncher(scenario)
elif mode == DeploymentMode.Container:
Expand Down
Loading

0 comments on commit 2fa9fb9

Please sign in to comment.