Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests #48

Merged
merged 50 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
29c074c
new empty test files
vtnate Mar 23, 2023
1879685
new empty github actions ci config file
vtnate Mar 23, 2023
3b8ea69
update release instructions for new package style
vtnate Mar 23, 2023
bbba444
add .ruff_cache to gitignore
vtnate Mar 28, 2023
864b633
add newline at end of changelog file
vtnate Mar 28, 2023
9cfaf26
add rnm output for testing
vtnate Apr 4, 2023
d6b8d56
tiny word change in readme
vtnate Apr 4, 2023
de01092
remove license from dynamic section in pyproject.toml
vtnate Apr 4, 2023
076088c
remove example/test output from git cache/tracking
vtnate Apr 4, 2023
c606616
different path for example/test output in gitignore file
vtnate Apr 4, 2023
0d21c1c
remove example/test transformers from git cache/tracking
vtnate Apr 4, 2023
d2d4660
Revert "remove example/test transformers from git cache/tracking"
vtnate Apr 4, 2023
c82311d
allow command line flags to override config file
vtnate Apr 4, 2023
b5cfe57
adjust line-length to 90 characters
vtnate Apr 4, 2023
916833d
fix typo in cli help text
vtnate Apr 4, 2023
9412966
remove unnecessary test file
vtnate Apr 4, 2023
d08a351
rename test file
vtnate Apr 4, 2023
3243016
comment why reopt test is commented out
vtnate Apr 5, 2023
d6fa98b
set up github actions for ci
vtnate Apr 18, 2023
7275c75
set python >= 3.8 in ci. needed for pre-commitv3
vtnate Apr 18, 2023
0f15387
set python >= 3.8 in repo
vtnate Apr 18, 2023
bc1b24e
Merge branch 'run-pre-commit' into tests
vtnate Aug 21, 2023
91aad37
restore license file accidentally deleted
vtnate Aug 22, 2023
d3c6fbc
fix local import statement to match some historical refactor
vtnate Aug 22, 2023
2d746d8
change line-length to 120 chars to not have so many line-breaks
vtnate Aug 22, 2023
d7364ba
raise SystemExit cleanly for elegant warning to user
vtnate Aug 22, 2023
adcccf5
allow user args to override json config appropriately
vtnate Aug 22, 2023
26b4186
ignore a few more lint checks in the test suite
vtnate Aug 22, 2023
caa7464
add subprocess check to test calls
vtnate Aug 22, 2023
4a6ffd0
remove test output from git
vtnate Aug 22, 2023
3508797
run ci weeknights and on PR review request
vtnate Aug 22, 2023
541fdab
bump ditto-reader to v0.6.0 and black/pre-commit versions
vtnate Aug 22, 2023
d45592b
use opendssdirect.py v0.8
vtnate Aug 22, 2023
fca69d9
make cli error message an f-string like it is supposed to be
vtnate Aug 22, 2023
92b0973
slightly better way of confirming rnm workflow ran correctly
vtnate Aug 22, 2023
9141148
update ruff to 0.1.0
vtnate Oct 19, 2023
e3dc21f
use correct min Python version in readme
vtnate Oct 19, 2023
835d62f
update linting dependencies in pre-commit
vtnate Oct 19, 2023
820866a
update checkout action version in CI, and add detail to step names
vtnate Oct 19, 2023
4be73e2
use traitlets <5.10 due to breaking change found in ditto.py
vtnate Oct 19, 2023
b48fec8
declare support for Python3.12
vtnate Oct 19, 2023
fdb6952
Merge branch 'run-pre-commit' into tests
vtnate Oct 27, 2023
4fd25e4
rounding outputs to 5 decimal places
tareknrel Nov 1, 2023
2f4fec2
run CI on push instead of schedule
vtnate Nov 1, 2023
1504e62
`black` formatting
vtnate Nov 1, 2023
50675e6
autoupdate pre-commit hook versions
vtnate Nov 1, 2023
e867fce
un-ignore opendss files
vtnate Nov 1, 2023
8e221d6
regenerate example opendss files by running the test suite
vtnate Nov 1, 2023
b9a0c3d
use 2 hour timestep in test
vtnate Nov 2, 2023
6ab99d5
regen opendss files at 2 hour timestep
vtnate Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: ci
on:
push:
# schedule:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# 5:20 am UTC (11:20pm MDT the day before) every weekday night in MDT
# - cron: '20 5 * * 2-6'
# pull_request:
# types: [review_requested]

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install ditto-reader
run: pip install .[dev]
- name: Run pre-commit to confirm linting and formatting
# https://github.com/pre-commit/action
uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files
- name: Run unit tests
run: python -Wonce::DeprecationWarning -Im pytest -vv
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ venv.bak/

# IDE settings
.vscode/
.ruff_cache

# Spyder project settings
.spyderproject
Expand All @@ -134,8 +135,5 @@ dmypy.json
# DS_Store
.DS_Store

# opendss files
./example/run/baseline_scenario/opendss/

# ditto local checkout
ditto/
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-ast
- id: check-added-large-files
args: ['--maxkb=2000']
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml
Expand All @@ -24,13 +26,13 @@ repos:
# - id: check-hooks-apply # Fails if a hook doesn't apply to any file
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.285
rev: v0.1.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, pyi, jupyter]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.10.1
hooks:
- id: black-jupyter
default_language_version:
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Enhancement of URBANopt™ GeoJSON that can be consumed by DiTTo reader \
More detailed documentation is available on the [URBANopt documentation page](https://docs.urbanopt.net/opendss/opendss.html)

# Installation Pre-requisites
- Python >=3.7
- Python >=3.8
- Requires Python 3.10 if using via the URBANopt CLI.

# Installation
Expand Down Expand Up @@ -64,15 +64,17 @@ If either start_time and end_time are invalid or set to None, the simulation wil
- Create & activate your favorite venv in the repo (I prefer pyenv for [mac/linux](https://github.com/pyenv/pyenv#installation) or [windows](https://github.com/pyenv-win/pyenv-win#installation), and the [virtualenv plugin](https://github.com/pyenv/pyenv-virtualenv))
- Activate pre-commit (only once, after making a new venv): `pre-commit install`
- Runs automatically on your staged changes before every commit
- Update pip and setuptools: `pip install -U pip setuptools .`
- Update pip and setuptools: `pip install -U pip setuptools`
- Install the respository with developer dependencies: `pip install -e .[dev]`
- To check all files, run `pre-commit run --all-files`
- To check the whole repo, run `pre-commit run --all-files`
- Settings and documentation links for pre-commit and ruff are in .pre-commit-config.yaml and pyproject.toml

## Publish Package
# Releasing
Follow the [PyPA guidance](https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives) as of April 2, 2022

- update version in setup.py
Roughly:
- update version in pyproject.toml
- make a release on GitHub
- make the package: `python setup.py sdist`
- make the package: `python -m build`
- install twine `pip install twine`
- upload to pypi: `twine upload dist/*`
26 changes: 13 additions & 13 deletions example/run/baseline_scenario/opendss/dss_files/LoadShapes.dss
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
New Loadshape.feature_1 npts= 8759 interval=1.0 mult = (file=..\profiles\load_1_pu.csv)
New Loadshape.feature_1 npts= 8759 interval=1.0 mult = (file=../profiles/load_1_pu.csv)

New Loadshape.feature_2 npts= 8759 interval=1.0 mult = (file=..\profiles\load_2_pu.csv)
New Loadshape.feature_2 npts= 8759 interval=1.0 mult = (file=../profiles/load_2_pu.csv)

New Loadshape.feature_3 npts= 8759 interval=1.0 mult = (file=..\profiles\load_3_pu.csv)
New Loadshape.feature_3 npts= 8759 interval=1.0 mult = (file=../profiles/load_3_pu.csv)

New Loadshape.feature_4 npts= 8759 interval=1.0 mult = (file=..\profiles\load_4_pu.csv)
New Loadshape.feature_4 npts= 8759 interval=1.0 mult = (file=../profiles/load_4_pu.csv)

New Loadshape.feature_5 npts= 8759 interval=1.0 mult = (file=..\profiles\load_5_pu.csv)
New Loadshape.feature_5 npts= 8759 interval=1.0 mult = (file=../profiles/load_5_pu.csv)

New Loadshape.feature_6 npts= 8759 interval=1.0 mult = (file=..\profiles\load_6_pu.csv)
New Loadshape.feature_6 npts= 8759 interval=1.0 mult = (file=../profiles/load_6_pu.csv)

New Loadshape.feature_7 npts= 8759 interval=1.0 mult = (file=..\profiles\load_7_pu.csv)
New Loadshape.feature_7 npts= 8759 interval=1.0 mult = (file=../profiles/load_7_pu.csv)

New Loadshape.feature_8 npts= 8759 interval=1.0 mult = (file=..\profiles\load_8_pu.csv)
New Loadshape.feature_8 npts= 8759 interval=1.0 mult = (file=../profiles/load_8_pu.csv)

New Loadshape.feature_9 npts= 8759 interval=1.0 mult = (file=..\profiles\load_9_pu.csv)
New Loadshape.feature_9 npts= 8759 interval=1.0 mult = (file=../profiles/load_9_pu.csv)

New Loadshape.feature_10 npts= 8759 interval=1.0 mult = (file=..\profiles\load_10_pu.csv)
New Loadshape.feature_10 npts= 8759 interval=1.0 mult = (file=../profiles/load_10_pu.csv)

New Loadshape.feature_11 npts= 8759 interval=1.0 mult = (file=..\profiles\load_11_pu.csv)
New Loadshape.feature_11 npts= 8759 interval=1.0 mult = (file=../profiles/load_11_pu.csv)

New Loadshape.feature_12 npts= 8759 interval=1.0 mult = (file=..\profiles\load_12_pu.csv)
New Loadshape.feature_12 npts= 8759 interval=1.0 mult = (file=../profiles/load_12_pu.csv)

New Loadshape.feature_13 npts= 8759 interval=1.0 mult = (file=..\profiles\load_13_pu.csv)
New Loadshape.feature_13 npts= 8759 interval=1.0 mult = (file=../profiles/load_13_pu.csv)
4 changes: 2 additions & 2 deletions example/run/baseline_scenario/opendss/dss_files/Loads.dss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
New Load.1 bus1=e4bcf9d6-e0b7-421c-91d4-554d06c69364.1.2.3 kV=12.47 model=1 kW=4961.147721461635 kvar=1138.1653453593858 Phases=3 yearly=feature_1

New Load.2 bus1=53c917d8-b04d-4110-bdd9-cbf044e6a1fa.1.2.3 kV=0.48 model=1 kW=226.26934267290764 kvar=51.909747301714695 Phases=3 yearly=feature_2
New Load.2 bus1=53c917d8-b04d-4110-bdd9-cbf044e6a1fa.1.2.3 kV=0.48 model=1 kW=226.26934267290758 kvar=51.90974730171469 Phases=3 yearly=feature_2

New Load.3 bus1=67b07fac-6666-4954-98b8-3e08b0896646.1.2.3 kV=12.47 model=1 kW=1277.8064698880355 kvar=293.1489090339154 Phases=3 yearly=feature_3

Expand All @@ -10,7 +10,7 @@ New Load.5 bus1=3d1aa47d-69dd-4200-ab34-9b6244ad82d7.1.2.3 kV=0.48 model=1 kW=12

New Load.6 bus1=db52eea7-f395-4fb1-999d-47c82333a4a7.1.2.3 kV=0.48 model=1 kW=15.74178000285817 kvar=3.6114120117846387 Phases=3 yearly=feature_6

New Load.7 bus1=9d037967-7ac1-4296-8f87-2d4a842d7a87.1.2.3 kV=0.48 model=1 kW=1010.9459946369252 kvar=231.9269172631351 Phases=3 yearly=feature_7
New Load.7 bus1=9d037967-7ac1-4296-8f87-2d4a842d7a87.1.2.3 kV=0.48 model=1 kW=1010.9459946369254 kvar=231.92691726313512 Phases=3 yearly=feature_7

New Load.8 bus1=18fe5a25-2547-4c32-a225-8bd455e93c9b.1.2.3 kV=12.47 model=1 kW=2185.323191585642 kvar=501.347523741978 Phases=3 yearly=feature_8

Expand Down
Loading