Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/nrel/pysam into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dguittet committed Apr 22, 2024
2 parents 6db508d + e76fda4 commit 365b5d5
Show file tree
Hide file tree
Showing 38 changed files with 20,505 additions and 119 deletions.
97 changes: 79 additions & 18 deletions .github/workflows/test_pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Test Package
on: [ push ]

jobs:
build:
build_1:

runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -13,41 +13,102 @@ jobs:

env:
SAMNTDIR: ${{ github.workspace }}/../SAM
NREL_API_KEY: ${{ secrets.NREL_API_KEY }}
NREL_API_EMAIL: ${{ secrets.NREL_API_EMAIL }}

name: ${{ matrix.os }} ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: anaconda, conda-forge
- run: conda --version
- run: which python

- name: Checkout Repo
uses: actions/checkout@v3

- name: Get PySAM Version Unix
if: ${{ matrix.os != 'windows-latest' }}
run: |
VER=$(python -c "from files.version import __version__; print(__version__)")
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Get PySAM Version Windows
if: ${{ matrix.os == 'windows-latest'}}
run: |
$VER=$(python -c "from files.version import __version__; print(__version__)")
echo "VERSION=$VER" >> $env:GITHUB_ENV
- name: Install NREL-PySAM
run: |
pip install -r requirements.txt
pip install -r tests/requirements.txt
conda install -c nrel nrel-pysam==${{ env.VERSION }}
- uses: actions/checkout@v3
- name: Checkout SAM
run: |
cd ..
git config --global url.https://github.com/.insteadOf git://github.com/
git clone https://github.com/NREL/SAM.git
ls
pwd
ls ${{ env.SAMNTDIR }}
ls ${{ env.SAMNTDIR }}/api/api_autogen/library/defaults
- uses: actions/checkout@v3
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: anaconda, conda-forge
- run: conda --version
- run: which python
- name: Unit tests
run: |
pytest tests/test_pysam_all.py
build_2:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]

env:
SAMNTDIR: ${{ github.workspace }}/../SAM
NREL_API_KEY: ${{ secrets.NREL_API_KEY }}
NREL_API_EMAIL: ${{ secrets.NREL_API_EMAIL }}

name: ${{ matrix.os }} ${{ matrix.python-version }}
steps:
- name: Install conda Mac arm64
run: |
mkdir -p ~/miniconda3
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
source /Users/runner/.bash_profile
conda --version
yes | conda create --name pysam_env python=${{ matrix.python-version }}
conda activate pysam_env
which python
- name: Checkout Repo
uses: actions/checkout@v3

- name: Install NREL-PySAM
run: |
source /Users/runner/.bash_profile
conda activate pysam_env
VER=$(python -c "from files.version import __version__; print(__version__)")
echo $VER
pip install -r requirements.txt
pip install -r tests/requirements.txt
conda install -c nrel nrel-pysam
conda install -c nrel nrel-pysam==$VER
- uses: actions/checkout@v3
- name: Checkout SAM
run: |
cd ..
git config --global url.https://github.com/.insteadOf git://github.com/
git clone https://github.com/NREL/SAM.git
- name: Unit tests
run: |
pwd
ls ${{ env.SAMNTDIR }}/api/api_autogen/library/defaults
pytest tests/test_pysam_all.py
source /Users/runner/.bash_profile
conda activate pysam_env
pytest tests
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Release Notes

## Version 5.1.0, Mar 13, 2023 - SAM 2023.12.17, Revision 1, SSC Version 290
* [SAM Release updates for Version 2023.12.17 Revision 1](https://nrel.github.io/SAM/doc/releasenotes.html)
## Version 5.1.0, Mar 13, 2024 - SAM 2024.12.17, Revision 1, SSC Version 290
* [SAM Release updates for Version 2024.12.17 Revision 1](https://nrel.github.io/SAM/doc/releasenotes.html)
* Enable Hybrids in PySAM (#162)

## Version 5.0.0, Dec 13, 2023 - SAM 2023.12.17, SSC Version 288
Expand Down
2 changes: 1 addition & 1 deletion build_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd /io/build_linux_ssc
rm -rf *
cmake ${SSCDIR} -DCMAKE_BUILD_TYPE=Release -DSAM_SKIP_TOOLS=1 -DSAMAPI_EXPORT=1 -DSAM_SKIP_TESTS=1 ../ssc || exit
cmake --build . --target shared -j 6 || exit
cmake --build . --target ssc -j 1 || exit
cmake --build . --target ssc -j 6 || exit

mkdir -p /io/build_linux_sam
cd /io/build_linux_sam
Expand Down
19 changes: 6 additions & 13 deletions build_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,20 @@ if [ "$(python3 -c "import platform; print(platform.processor())")" = "arm" ]
then
docker pull quay.io/pypa/manylinux2014_aarch64
# docker run --rm -dit -v $(pwd):/io quay.io/pypa/manylinux2010_x86_64 /bin/bash
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux2014_aarch64 /io/pysam/build_manylinux.sh

rename -s linux manylinux2014 $PYSAMDIR/dist/*-linux_*

docker pull continuumio/anaconda3
docker run --rm --env PYSAMDIR=/io/pysam -v $(pwd):/io continuumio/anaconda3 /io/pysam/build_conda.sh
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux2014_aarch64 /io/pysam/build_manylinux.sh || exit
else
docker pull quay.io/pypa/manylinux2014_x86_64
# docker run --rm -dit -v $(pwd):/io quay.io/pypa/manylinux2014_x86_64 /bin/bash
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux2014_x86_64 /io/pysam/build_manylinux.sh || exit

rename -s linux manylinux2014 $PYSAMDIR/dist/*-linux_*

docker pull continuumio/anaconda
docker run --rm --env PYSAMDIR=/io/pysam -v $(pwd):/io continuumio/anaconda /io/pysam/build_conda.sh
fi

rename -s linux manylinux2014 $PYSAMDIR/dist/*-linux_*
docker pull continuumio/anaconda3
docker run --rm --env PYSAMDIR=/io/pysam -v $(pwd):/io continuumio/anaconda /io/pysam/build_conda.sh


twine upload $PYSAMDIR/dist/*.whl
anaconda upload -u nrel $PYSAMDIR/dist/osx-64/*.tar.bz2
anaconda upload -u nrel $PYSAMDIR/dist/linux-64/*.tar.bz2

# only upload to PyPi after Github Actions test of new package passes
# twine upload $PYSAMDIR/dist/*.whl

4 changes: 3 additions & 1 deletion build_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ FOR %%i IN (pysam_build_3.8 pysam_build_3.9 pysam_build_3.10 pysam_build_3.11, p
)
python setup.py bdist_wheel
)
REM twine upload dist/*.whl
REM %bash% build_conda.sh
REM anaconda upload -u nrel dist/*.tar.bz2

REM only upload to PyPi after Github Actions test of new package passes
REM twine upload dist/*.whl

REM rmdir %SSCDIR%\..\build_pysam /s
3 changes: 3 additions & 0 deletions docs/PySSC.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Working Directly with PySSC

PySSC is a wrapper for the `SAM Simulation Core (SSC) API <https://github.com/NREL/ssc/blob/develop/ssc/sscapi.h>`_ PySSC is part of the `SAM Software Development Kit (SDK) <https://sam.nrel.gov/sdk>`_. The PySAM package is built on PySSC.

.. note::
PySSC was the original method for running SSC from Python before PySAM was developed. Unless you are very familiar with SSC, we recommend using PySAM instead of PySSC because PySAM provides tools for creating models and accessing variables that are not available with PySSC.

The `SSC Guide <https://sam.nrel.gov/images/web_page_files/ssc_guide.pdf>`_ is a reference to SSC.

To use PySSC, import it with:
Expand Down
7 changes: 7 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Fix for horizontal stacking weirdness in the RTD theme with Python properties:
https://github.com/readthedocs/sphinx_rtd_theme/issues/1301
*/
.py.property {
display: block !important;
}
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@
}

html_sidebars = { '**': [ 'about.html', 'navigation.html', 'searchbox.html' ]}

html_static_path = ['_static']

html_css_files = ["custom.css"]
Loading

0 comments on commit 365b5d5

Please sign in to comment.