-
Notifications
You must be signed in to change notification settings - Fork 3
Infer EnergyPlus Installation directory + modernize (pyproject.toml, add black+isort+mypy) #7
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
base: main
Are you sure you want to change the base?
Changes from all commits
3ce7f76
938941d
b67cc5a
a38a8a4
a3994ab
871e1bb
4ee4ede
7dbf6e7
df5dfd2
67491ad
87930e5
59d882e
22ea904
569f12f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: Lint | ||
|
|
||
| on: [push] | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-20.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
|
|
||
| - name: Check precommit hooks | ||
| uses: pre-commit/action@v3.0.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ name: PyPIRelease | |
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Release workflow builds the wheel for main too |
||
| tags: | ||
| - '*' | ||
|
|
||
|
|
@@ -10,23 +11,24 @@ jobs: | |
| runs-on: ubuntu-20.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v2 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.8 | ||
|
|
||
| - name: Install Pip Dependencies | ||
| shell: bash | ||
| run: pip install -r requirements.txt | ||
| run: pip install --upgrade build | ||
|
|
||
| - name: Build the Wheel | ||
| shell: bash | ||
| run: rm -rf dist/ build/ && python3 setup.py bdist_wheel sdist | ||
| run: rm -rf dist/ build/ && python3 -m build | ||
|
|
||
| - name: Deploy on Test PyPi | ||
| uses: pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f # v1.5.1 | ||
| if: contains(github.ref, 'refs/tags') | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
Comment on lines
29
to
+31
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But only upload to pypi when it's a tag |
||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.PYPIPW }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,4 +164,3 @@ cython_debug/ | |
|
|
||
| .vscode | ||
| *.code-workspace | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.4.0 | ||
| hooks: | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| - repo: https://github.com/psf/black | ||
| rev: 23.9.1 | ||
| hooks: | ||
| - id: black | ||
| - repo: https://github.com/pycqa/isort | ||
| rev: 5.12.0 | ||
| hooks: | ||
| - id: isort | ||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.5.1 | ||
| hooks: | ||
| - id: mypy | ||
| - repo: https://github.com/pycqa/flake8 | ||
| rev: 6.0.0 | ||
| hooks: | ||
| - id: flake8 | ||
| additional_dependencies: [flake8-pyproject] | ||
|
Comment on lines
+1
to
+23
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a pre-commit hook for linting / checking |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,9 @@ | ||
| from pathlib import Path | ||
| from sys import argv | ||
| from energyplus_api_helpers.demos.helper import get_eplus_path_from_argv1 | ||
| from energyplus_api_helpers.import_helper import EPlusAPIHelper | ||
|
|
||
|
|
||
| eplus_path = '/eplus/installs/EnergyPlus-22-2-0' | ||
| if len(argv) > 1: | ||
| eplus_path = argv[1] | ||
|
|
||
| e = EPlusAPIHelper(Path(eplus_path)) | ||
| e = EPlusAPIHelper(get_eplus_path_from_argv1()) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Example usage of the helper in one of the demo files |
||
| api = e.get_api_instance() | ||
| state = api.state_manager.new_state() | ||
| return_value = api.runtime.run_energyplus( | ||
| state, [ | ||
| '-d', | ||
| e.get_temp_run_dir(), | ||
| '-a', | ||
| '-w', | ||
| e.weather_file_path(), | ||
| e.path_to_test_file('5ZoneAirCooled.idf') | ||
| ] | ||
| state, ["-d", e.get_temp_run_dir(), "-a", "-w", e.weather_file_path(), e.path_to_test_file("5ZoneAirCooled.idf")] | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the "flake8" workflow with this one that will run the precommit hook on all files, and as such do flake8, black, isort and mypy