Skip to content

Commit

Permalink
Merge 825ff94 into 6382334
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar committed Oct 20, 2020
2 parents 6382334 + 825ff94 commit 6feae4c
Show file tree
Hide file tree
Showing 40 changed files with 2,394 additions and 2,642 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,14 @@ epregressions/tests/diffs/results.json
.DS_Store
results.json
.eggs
build
dist
/epregressions/tests/resources/epmacro.spec
/epregressions/tests/resources/expandobjects.spec
/epregressions/tests/resources/parametric.spec
/epregressions/tests/resources/readvars.spec
/epregressions/tests/resources/slab.spec
/epregressions/tests/resources/energyplus.spec
/epregressions/tests/resources/basement.spec
deploy
eplus_regression_runner.spec
110 changes: 76 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,78 @@
os: linux
language: python
virtualenv:
system_site_packages: true

addons:
apt:
packages:
- xvfb
- python-gi
- python-gi-cairo
- python3-gi
- python3-gi-cairo
- gir1.2-gtk-3.0

install:
- pip install --upgrade pip
- pip install -r requirements.txt

matrix:
jobs:
include:
- name: "Python 2 Unit Test"
python: 2.7
env: TEST_COMMAND=test
- name: "Python 3 Unit Tests"
python: 3.5
env: TEST_COMMAND=test
- name: "Python 3 Code Quality"
python: 3.5
env: TEST_COMMAND=flake8

script:
- xvfb-run coverage run setup.py $TEST_COMMAND
- os: linux
name: Ubuntu 18.04 Tests
env: BUILD=UBUNTU18
dist: bionic
language: python
python: 3.6
before_script: pip3 install -r requirements.txt
script: nosetests
before_deploy: ./build.sh Ubuntu18
- os: linux
name: Ubuntu 20.04 Tests
env: BUILD=UBUNTU20
dist: focal
language: python
python: 3.6
before_script: pip3 install -r requirements.txt
script: nosetests
before_deploy: ./build.sh Ubuntu20
after_success: coveralls
- os: osx
name: Mac 10.15 Tests
env: BUILD=MAC
osx_image: xcode11.4
before_script: pip3 install --user -r requirements.txt
script: "/Users/travis/Library/Python/3.7/bin/nosetests"
before_deploy: ./build.sh Mac
- os: windows
name: Windows Tests
env: BUILD=WINDOWS PATH=/c/Python36:/c/Python36/Scripts:$PATH
language: cpp
before_script:
- choco install 7zip
- choco install python --version 3.6.8
- pip3 install -r requirements.txt
script: nosetests
before_deploy: ./build.sh Windows
- os: linux
name: Flake8
env: BUILD=FLAKE8
dist: bionic
language: python
python: 3.6
before_script: pip3 install -r requirements.txt
script: flake8 epregressions
- os: linux
name: PyPi Packaging
dist: focal
env: BUILD=PYPI
language: python
python: 3.6
before_script: pip3 install -r requirements.txt
script: python3 setup.py bdist_wheel sdist

after_success:
- test $TEST_COMMAND = "test" && coveralls
deploy:
- provider: releases
api_key:
secure: dtm5qvOwBnYI37k0X5bQ1tJweOs5UTV65vv1vGa+TaU8eAE1KHmTIhNedZg7aRWYSpLRz/hdhGPjVBxid7VIvtIqFI4HX6wJ9Mf6aFL6uoFM5mUhtBrBo7TkcYG+oSQ5eftCDVO0449iKi0mzXgfl5szNXns1/VthK15+MGBQr12hNu+l0aWG3gWyweUnpJ3x4nORXU01v3yLTl+4J/UNOBzJvziXNub/7idF+v//hsoesLJuwKUjUBRmCackTFEiO/t9Atr4fMbI9Fksd+8TBaYplwz6ZwqKKtI1itrAe9af2PRTic7ZWmLI36U5KrGkH6yERFY2MAOgwHmirlkKfPknW1zLxaBMtgimdMhM9iVhNShC6+D1OpwFxiQEleQvS7ASFGLHeBuK2YK5QTH/4e9j1hGcaIrBg/J3JCPr9EYcqS2shUu0DxOyfQzI/M5vWDcY/suwZb0hijqXYDg9T+qIxdmlzV7RFwj6cSsVKvpLJSoAgZmoEAruze+iCp4jKdP/mEyvslbcLYt4MeGv8BydcX6jaLTgqMFYg3cZuWKATT6KVc6DaaL+Ptc5kIhw7GHMfkFyVe9lRAKiDDvvV1VIrnSyYcJ1m+i5XdSe5/IeCMuj0aTx1iTa0gi4CoKLIdWYvAbbGGjj9s8VT7nxH4c4WPosKabPyM1pt7MDPk=
file_glob: true
file: deploy/*
skip_cleanup: true
overwrite: true
on:
tags: true
repo: NREL/EnergyPlusRegressionTool
condition: $BUILD != PYPI
- provider: pypi
skip_cleanup: true
skip_upload_docs: true
username: Myoldmopar
password:
secure: "OuBZMCgJ3LZerXhE/Zvp3Qy6adpkyRo0GKR+ZSt28ggna3T3Ejd2y+GNdeJxqx05UCPfSJVuH4bqs0ILDXf8TzwyAWCRhQvZNZOR/vhWMha/zvx5czGrqUEgm+YdmxUsCTIUBIoFdn5He1C4e5qQ49Epn5o0EK6OrBfYoTu/hT5sP054WByX3u2VPL31gtQ9wyOOG85bBY2obl7tA0M/rdP2Xg28PyxhdSQLbfIz28r7ud/8+jfuFoDD2MWYrr97lPD4vVuf7tUWfSnRf5sVS+i0brOQI0g48nTuKd7WLYEqRj0jEDxAAaBwt3ZS90EH4Y7164TIjT2GwfmTB65Ev6QNeKlLX9JjyVSjOdjglKXFrcDPXqgvVxCJ36ds37q2iUaqIqIKFePamWp5cfHV/7VT4hEasc28G9HM6KXtLIjm+85fRn+v2/5+R7l4Pv6En+b9BkrTKu5GU/DvV7/BMMhS/4I5CBar1B7oeFQh6XmWtSWv3oglwb5nGzp1j9HHy0Uhda0FXLlHEOdvToeabpHnCoOMLK4Un+QPBwjrve+DOVUkD1Iy9a4CpE4cV3v5C+JYiKYOPRtt08CVAot7/gTZUAzARJZDFOd4IjvT7fhxU+OhDpxzh3IA5iXijqaqm/4geWzzS3cJrnASUuarE9TpysispFRQW7GEVE20GXw="
on:
tags: true
distributions: sdist bdist_wheel
repo: NREL/EnergyPlusRegressionTool
condition: $BUILD = PYPI
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include epregressions *.config
106 changes: 16 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Overview

This library is provides tools for performing regressions between EnergyPlus builds.
This library provides tools for performing regressions between EnergyPlus builds.
Developers often propose changes to EnergyPlus for:

- New feature development
Expand All @@ -17,101 +17,28 @@ Developers often propose changes to EnergyPlus for:
When a developer proposes these changes, they must be tested.
The continuous integration system over on EnergyPlus handles this, and provides results, but there can be a long time delay waiting on those results, depending on how busy CI is at that moment.
This tool provides a way to run these regressions locally.
In addition, because this tool isn't intermingled with the CI structure, enhancements to the regression analysis can be added quickly to this tool to provide developers with more information.
These can be rolled upstream into the CI code, but must be done with much more care to avoid breaking CI.

## Platform Support

This tool is written to be functional on all three major platforms, but Windows and Mac have known issues.
On Windows the multiprocessing code does not work, causing the runs to be executed serially, which means a long testing time.
On Mac there are a number of theme icons missing, causing the results tab to appear to be empty after a run, when in fact the icons are there just not rendered.

In general, this tool works amazingly well on Ubuntu 18.04.
And it is super easy to set up an EnergyPlus build development environment on Ubuntu.
So if at all possible, use this platform, in a VM or whatever, to use this tool.
I'll keep pushing on the tool on all these platforms, but my focus will always be on Ubuntu for the time being.
This tool is written to be functional on all three major platforms.
Travis is testing the underlying code on all the platforms, and the developer regularly tests the graphical engine on all three as well.
Packages are provided for two LTS versions of Ubuntu (18.04 and 20.04) as well as Windows and Mac.

## Installation

For setting up a development environment to actually _work_ on this tool, see the next section.
If you are not interested in _developing_ this tool, and only looking to _use_ it for your EnergyPlus work, read on here.

For this case, the dependencies for this tool are typically installed into the _system_ Python 3 installation, and this _system_ Python 3 is used to execute the program.
Instructions for this are actually really simple, and follow a few steps for each platform:
- Install Python
- Install GTK/PyGTK
- Clone the regression repo
- Install regression dependencies
- Run the regression tool

### Ubuntu

These are based on a fresh new installation of Ubuntu 18.04.
If you are on a different distribution or version, or you are installing into a system that already has other dependencies installed, your mileage will vary.

So, starting with Ubuntu 18.04:

- Follow the [PyGObject install instructions page](https://pygobject.readthedocs.io/en/latest/getting_started.html) and install the GObject dependencies:
- `sudo apt-get install python-gi python-gi-cairo python3-gi python3-gi-cairo gir1.2-gtk-3.0`
- Optionally test this: run `python3` and try to execute `import gi`. It should just do it without error. Press `ctrl-d` to exit.
- Install a couple other dependencies that we'll use in the next steps:
- `sudo apt-get install git python3-pip`
- Download the regression tool and install python dependencies:
- `git clone https://github.com/NREL/EnergyPlusRegressionTool`
- `cd EnergyPlusRegressionTool`
- `pip3 install -r requirements.txt`
- Optionally test this: run `python3 eplus_regression_runner`. It should run the GUI. Close it.
- Install the program into your applications:
- `python3 epregressions/install_desktop`

You should now be able to press the "Windows key" on your keyboard, start typing EnergyPl.., and it will find the tool and you can press enter, as shown here:

![ActivitiesSearchImage](/media/activities_search.png?raw=true "ActivitiesSearchImage")

You can then right click on the icon in the taskbar and save it as a favorite to reopen anytime.

![AddToFavorites](/media/add_to_favorites.png?raw=true "AddToFavorites")

Then to get an update to the program, then only thing you have to do is update your clone:

- `cd EnergyPlusRegressionTool`
- `git pull`

In the rare event that a dependency has changed, you may have to re-run the `pip` install command, but specific instructions will be offered if that happens.

### Windows

This was tested on Windows 7, and thanks to the PyGI packaging, it's not too hard.
You just need to make sure you have a valid version of Python and then install PyGI into it.

- Download and install a **valid** Python version from Python.org:
- **Valid Versions**: Up to 3.4, not newer, 32-or-64-bit)
- https://www.python.org/downloads/windows/
- Then grab the PyGI installer from here:
- https://sourceforge.net/projects/pygobjectwin32/
- During that install:
- Select your Python 3.4 installation folder
- Select the GTK+ entry in the first list
- That Python version will now have PyGTK in it.
- Next you need to get the regression tool.
- The easiest way to do this is to get it using Git, which is also convenient because you'll be able to pull down updates using a Git Pull.
- Find a place to clone it on your machine, and do it:
- `git clone https://github.com/NREL/EnergyPlusRegressionTool`
- Change into that directory:
- `cd EnergyPlusRegressionTool`
- Install the dependencies for the Regression tool using Pip:
- `C:\Python34\Scripts\pip3.exe install -r requirements.txt`
- Run the tool!
- `C:\Python34\python.exe eplus_regression_runner`
Ultimately there will be two ways to install this tool:
- Downloading a pre-built (by Travis) binary package through a Github release page, and
- Installing the library into an existing Python install using Pip.

Right now the Pip implementation is not yet done, so the core method will be to download the binary.
You should not need any outside tools to run the downloaded package, not even Python.

## Development

For the case of developing this tool, you should start by installing the dependencies listed in the installation section.
Then you will generally set up a separate Python environment to install the dependencies so you don't mess with the _system_ Python.
This gets a bit trickier than usual though because of the interplay between the system level dependencies installed with apt and the virtual environment isolation.
The instructions over on GObject's website are perfect.
I was skeptical because I have struggled with this in the past, but in this case, they work great.
So follow the instructions here: https://pygobject.readthedocs.io/en/latest/devguide/dev_environ.html#devenv
For setting up a development environment to actually _work_ on this tool, the steps are pretty minimal:
- Install Python, if needed
- Clone this repository (`git clone https://github.com/NREL/EnergyPlusRegressionTool`)
- Install dependencies (`pip3 install -r requirements.txt`)

## Documentation

Expand All @@ -120,7 +47,6 @@ This documentation is written using RST with Sphinx, and published on [ReadTheDo

## Testing

Exhaustive unit tests have been added to the codebase.
The "underneath the hood" code, like the functions that calculate diffs and run builds, are fully tested.
A major chunk of the GUI code itself has been unit tested, but that's difficult to do, so it's not so exhaustive.
Exhaustive unit tests have been added to the "underneath the hood" code, like the functions that calculate diffs and run builds.
GUI code is not unit tested, but tested manually on all platforms periodically.
The unit tests are run by [Travis](https://travis-ci.org/NREL/EnergyPlusRegressionTool).
43 changes: 43 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash -e

BUILD_CONFIG=$1

VERSION_STRING=$(grep VERSION epregressions/__init__.py | cut -d= -f2 | xargs)

rm -rf deploy

case ${BUILD_CONFIG} in

Ubuntu20)
python3 setup.py sdist bdist_wheel --dist-dir dist_pypi
pyinstaller --onefile --add-data "epregressions/diffs/math_diff.config:epregressions/diffs" epregressions/runner.py
mkdir deploy
tar -zcvf deploy/EnergyPlusRegressionTool-"${VERSION_STRING}"-Ubuntu20.04.tar.gz -C dist runner
;;

Ubuntu18)
python3 setup.py sdist bdist_wheel --dist-dir dist_pypi
pyinstaller --onefile --add-data "epregressions/diffs/math_diff.config:epregressions/diffs" epregressions/runner.py
mkdir deploy
tar -zcvf deploy/EnergyPlusRegressionTool-"${VERSION_STRING}"-Ubuntu18.04.tar.gz -C dist runner
;;

Mac)
python3 setup.py sdist bdist_wheel --dist-dir dist_pypi
/Users/travis/Library/Python/3.7/bin/pyinstaller --onefile --add-data "epregressions/diffs/math_diff.config:epregressions/diffs" epregressions/runner.py
mkdir deploy
tar -zcvf deploy/EnergyPlusRegressionTool-"${VERSION_STRING}"-Mac.tar.gz -C dist runner
;;

Windows)
python.exe setup.py sdist bdist_wheel --dist-dir dist_pypi
pyinstaller --onefile --add-data "epregressions/diffs/math_diff.config;epregressions/diffs" epregressions/runner.py
mkdir deploy
/C/Program\ Files/7-zip/7z.exe a deploy/EnergyPlusRegressionTool-"${VERSION_STRING}"-Windows.zip ./dist/*
;;

*)
echo "Unknown config passed to packaging script!"
;;

esac
Loading

0 comments on commit 6feae4c

Please sign in to comment.