Skip to content

Commit 62c4843

Browse files
committed
Merge branch 'main' into input-parameters-in-CSV
2 parents a6880ec + 720dc80 commit 62c4843

File tree

9 files changed

+32
-39
lines changed

9 files changed

+32
-39
lines changed

.bumpversion.cfg

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
[bumpversion]
2-
current_version = 3.9.29
2+
current_version = 3.9.31
33
commit = True
44
tag = True
5-
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<prerelease_label>[a-z]+)\.(?P<prerelease>\d+))?
6-
serialize =
7-
{major}.{minor}.{patch}-{prerelease_label}.{prerelease}
8-
{major}.{minor}.{patch}
9-
10-
[bumpversion:part:prerelease]
11-
first_value = 0
12-
13-
[bumpversion:part:prerelease_label]
14-
optional_value = rc
15-
values =
16-
alpha
17-
beta
18-
rc
195

206
[bumpversion:file:setup.py]
217
search = version='{current_version}'
@@ -30,10 +16,8 @@ search = /v{current_version}...main
3016
replace = /v{new_version}...main
3117

3218
[bumpversion:file:docs/conf.py]
33-
search = version = '{current_version}'
34-
release = '{current_version}'
35-
replace = version = '{new_version}'
36-
release = '{new_version}'
19+
search = version = release = '{current_version}'
20+
replace = version = release = '{new_version}'
3721

3822
[bumpversion:file:src/geophires_x/__init__.py]
3923
search = __version__ = '{current_version}'
@@ -42,6 +26,3 @@ replace = __version__ = '{new_version}'
4226
[bumpversion:file:.cookiecutterrc]
4327
search = version: {current_version}
4428
replace = version: {new_version}
45-
46-
[bumpversion:part:release]
47-
# Enables the 'bumpversion release' command to drop pre-release suffixes.

.cookiecutterrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ default_context:
5454
sphinx_doctest: "no"
5555
sphinx_theme: "sphinx-py3doc-enhanced-theme"
5656
test_matrix_separate_coverage: "no"
57-
version: 3.9.29
57+
version: 3.9.31
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

CONTRIBUTING.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,9 @@ Then push both commits and tags to your fork:
278278
Writing objects: 100% (1/1), 205 bytes | 205.00 KiB/s, done.
279279
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
280280
To github.com:softwareengineerprogrammer/python-geophires-x-nrel.git
281-
* [new tag] v3.2.3-alpha.0 -> v3.2.3-alpha.0
281+
* [new tag] v3.2.3 -> v3.2.3
282282
283-
Once the alpha version builds successfully in GitHubActions and you're ready to release it as v3.2.3:
284-
285-
.. code-block::
286-
287-
(venv) ➜ python-geophires-x git:(main) bumpversion release
288-
(venv) ➜ python-geophires-x git:(main) git push && git push fork --tags
289-
290-
Once a version bump is merged into the main repository with a Pull Request, tags must be manually pushed (GitHub `doesn't include tags in PRs <https://stackoverflow.com/questions/12278660/adding-tags-to-a-pull-request>`__):
283+
Once a version bump is merged into the main repository with a Pull Request, tag must be manually pushed (GitHub `doesn't include tags in PRs <https://stackoverflow.com/questions/12278660/adding-tags-to-a-pull-request>`__):
291284

292285
.. code-block::
293286

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ Free software: `MIT license <LICENSE>`__
5858
:alt: Supported implementations
5959
:target: https://pypi.org/project/geophires-x
6060

61-
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.9.29.svg
61+
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.9.31.svg
6262
:alt: Commits since latest release
63-
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.9.29...main
63+
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.9.31...main
6464

6565
.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
6666
:target: https://nrel.github.io/GEOPHIRES-X

docs/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
year = '2025'
1919
author = 'NREL'
2020
copyright = f'{year}, {author}'
21-
version = '3.9.29'
22-
release = '3.9.29'
21+
version = release = '3.9.31'
2322

2423
pygments_style = 'trac'
2524
templates_path = ['./templates']

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def read(*names, **kwargs):
1313

1414
setup(
1515
name='geophires-x',
16-
version='3.9.29',
16+
version='3.9.31',
1717
license='MIT',
1818
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
1919
long_description='{}\n{}'.format(

src/geophires_x/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.9.29'
1+
__version__ = '3.9.31'

src/geophires_x_client/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import atexit
2+
import os
23
import sys
34
import threading
45
from multiprocessing import Manager
56
from multiprocessing import current_process
7+
from pathlib import Path
68

79
# noinspection PyPep8Naming
810
from geophires_x import GEOPHIRESv3 as geophires
@@ -110,6 +112,7 @@ def get_geophires_result(self, input_params: GeophiresInputParameters) -> Geophi
110112

111113
def _run_simulation(self, input_params: GeophiresInputParameters) -> GeophiresXResult:
112114
"""Helper method to encapsulate the actual GEOPHIRES run."""
115+
stash_cwd = Path.cwd()
113116
stash_sys_argv = sys.argv
114117
sys.argv = ['', input_params.as_file_path(), input_params.get_output_file_path()]
115118

@@ -121,6 +124,7 @@ def _run_simulation(self, input_params: GeophiresInputParameters) -> GeophiresXR
121124
raise RuntimeError('GEOPHIRES exited without giving a reason') from None
122125
finally:
123126
sys.argv = stash_sys_argv
127+
os.chdir(stash_cwd)
124128

125129
self._logger.info(f'GEOPHIRES-X output file: {input_params.get_output_file_path()}')
126130
result = GeophiresXResult(input_params.get_output_file_path())

tests/test_geophires_x_client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class GeophiresXClientTestCase(BaseTestCase):
1616
"""
1717
Note that these are tests of the geophires_x_client package only and not of the core geophires_x package.
18-
If a test calls geophires_x_client.GeophiresXClient.get_geophires_result then it belongs in
18+
If a test calls geophires_x_client.GeophiresXClient.get_geophires_result then it generally belongs in
1919
test_geophires_x.GeophiresXTestCase.
2020
"""
2121

@@ -617,6 +617,22 @@ def test_parse_sam_cash_flow_profile(self):
617617
self.assertIsNotNone(cash_flow)
618618
self.assertListEqual([''] + [f'Year {y}' for y in range(21)], cash_flow[0])
619619

620+
def test_stash_cwd(self):
621+
start_cwd = Path.cwd()
622+
GeophiresXClient().get_geophires_result(
623+
GeophiresInputParameters(
624+
{
625+
'End-Use Option': EndUseOption.DIRECT_USE_HEAT.value,
626+
'Reservoir Model': 1,
627+
'Time steps per year': 1,
628+
'Reservoir Depth': 3,
629+
'Gradient 1': 50,
630+
}
631+
)
632+
)
633+
634+
self.assertEqual(start_cwd, Path.cwd())
635+
620636
def test_csv_with_input_parameters(self):
621637
with self.assertRaises(NotImplementedError):
622638
# This should fail because CSV from file path is not implemented.

0 commit comments

Comments
 (0)