Skip to content

Commit

Permalink
merge conf
Browse files Browse the repository at this point in the history
  • Loading branch information
samgdotson committed Sep 15, 2024
2 parents c90d512 + 5431735 commit 052ed3c
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 149 deletions.
51 changes: 36 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,19 @@ permissions:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
- macos-latest
- windows-latest

defaults:
run:
Expand All @@ -36,27 +48,36 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pyomo==6.4.1
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install flake8
run: |
python -m pip install flake8
- name: Install CBC
if: matrix.os != 'windows-latest'
run: |
mamba install coincbc
- name: Lint with flake8
mamba install coin-or-cbc coincbc
- name: install CBC (Windows)
if: matrix.os == 'windows-latest'
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install osier package
curl -L https://github.com/coin-or/Cbc/releases/download/releases%2F2.10.10/Cbc-releases.2.10.10-w64-msvc17-md.zip -o cbc.zip
unzip cbc.zip -d ${HOME}/cbc
echo "${HOME}/cbc/bin" >> $GITHUB_PATH
- name: Install osier package (macos)
if: matrix.os == 'macos-latest'
run: |
pip install .
- name : Install recent unyt update
pip install -e .'[doc]'
- name: Install osier package
if: matrix.os != 'macos-latest'
run: |
python3 -m pip install -e git+https://github.com/yt-project/unyt.git#egg=unyt
pip install -e .[doc]
- name: Test with pytest
run: |
pytest tests/
- name: Open Journals PDF Generator
uses: openjournals/[email protected]

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
7 changes: 2 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
version: 2

build:
os: "ubuntu-20.04"
os: "ubuntu-22.04"
tools:
python: "3.9"
jobs:
post_install:
- pip install pyomo==6.4.1
python: "3.12"

sphinx:
configuration: docs/source/conf.py
Expand Down
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/ˈōZHər/ <br>
Open source multi-objective energy system framework

[![status](https://joss.theoj.org/papers/183a04edba2d4952fa1e30c419a844b3/status.svg)](https://joss.theoj.org/papers/183a04edba2d4952fa1e30c419a844b3)
[![Build Status](https://github.com/arfc/osier/actions/workflows/CI.yml/badge.svg)](https://github.com/arfc/osier/actions/workflows/CI.yml)
[![Documentation Status](https://readthedocs.org/projects/osier/badge/?version=latest)](https://osier.readthedocs.io/en/latest/?badge=latest)

Expand All @@ -11,7 +12,7 @@ Open source multi-objective energy system framework

`osier` is available through [PyPI](https://pypi.org/project/osier/). It may be installed with
```bash
python -m pip install osier pyomo==6.4.1
python -m pip install osier
```
or by cloning this repository and building from source:

Expand All @@ -24,19 +25,9 @@ cd osier
pip install .
# to also install the documentation dependencies
pip install .[doc]

# followed by
pip install pyomo==6.4.1
```


```{note}
Although `pyomo` is a dependency, the current version of `pyomo` (6.7.1, as of 2/29/24) has a bug
that prints erroneous errors during an `osier` simulation. Therefore, users are recommended to
install a specific version of `pyomo` after the main installation of `osier`. There is an open issue [#50](https://github.com/arfc/osier/issues/50)
related to this concern.
```

## Documentation
The documentation for `osier` can be viewed [here](https://osier.readthedocs.io/en/latest/).
You can also build the docs locally with:
Expand All @@ -53,6 +44,11 @@ python -m http.server
`osier`'s tests can be run by executing `pytest` in the top-level directory
of `osier`.

```{note}
The test package assumes the user has `coin-or-cbc` installed as the default solver. For Windows machines,
this may require some additional steps to install the solver. [Here](https://stackoverflow.com/questions/58868054/how-to-install-coincbc-using-conda-in-windows) is a helpful place to start.
```


## Contributing

Expand Down
2 changes: 1 addition & 1 deletion osier/models/capacity_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self,
curtailment=True,
allow_blackout=False,
verbosity=50,
solver='cplex',
solver='cbc',
**kwargs):
self.technology_list = deepcopy(technology_list)
self.demand = demand
Expand Down
6 changes: 3 additions & 3 deletions osier/models/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def __init__(self,
technology_list,
net_demand,
time_delta=None,
solver='cplex',
solver='cbc',
lower_bound=0.0,
oversupply=0.0,
undersupply=0.0,
Expand Down Expand Up @@ -248,8 +248,8 @@ def __init__(self,
unit_power=self.power_units,
unit_time=self.time_delta.units)


logging.getLogger('pyomo.core').setLevel(verbosity)
logging.basicConfig(level=verbosity, format='%(message)s')


@property
def time_delta(self):
Expand Down
69 changes: 69 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[build-system]
requires = ["setuptools >= 64.0"]
build-backend = "setuptools.build_meta"

[project]
name="osier"
version = "0.3.0"
description = "osier: A justice oriented energy system optimization tool"
readme = "README.md"
keywords = ["energy systems", "optimization", "multi-objective", "justice", "multi-criteria decision"]

license = { file = "LICENSE" }

requires-python = ">= 3.9"

dependencies = [
'numpy',
'pandas',
'matplotlib',
'pytest',
'dill',
'openpyxl',
'nrelpy',
'unyt',
'pymoo',
'pyentrp',
'deap',
'pyomo'
]

authors = [
{name = "Sam Dotson", email = "[email protected]"},
]
maintainers = [
{name = "Sam Dotson", email = "[email protected]"}
]

classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Environment :: Console",
"Natural Language :: English",
"Operating System :: OS Independent"
]

[project.urls]
Homepage = "https://osier.readthedocs.io"
Repository = "https://github.com/arfc/osier"
Issues = "https://github.com/arfc/osier/issues"

[project.optional-dependencies]
doc = [
'sphinx>=5.1',
'sphinx-autobuild',
'myst-parser',
"sphinx_design",
"sphinx-autodoc-typehints",
'numpydoc',
'pydata_sphinx_theme',
'nbsphinx',
'pandoc'
]

[tool.setuptools.packages.find]
include = ['osier']
112 changes: 0 additions & 112 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import functools

if "win32" in sys.platform:
solver = 'cplex'
solver = 'cbc'
elif "linux" in sys.platform:
solver = "cbc"
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys

if "win32" in sys.platform:
solver = 'cplex'
solver = 'cbc'
elif "linux" in sys.platform:
solver = "cbc"
else:
Expand Down

0 comments on commit 052ed3c

Please sign in to comment.