Skip to content

Commit

Permalink
Merge pull request #31 from NREL/pp/python_3_12
Browse files Browse the repository at this point in the history
Add explicit support for python 3.11 and 3.12
  • Loading branch information
ppinchuk authored Nov 2, 2023
2 parents 40dffcb + 2ea93a8 commit 080f0fc
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/pull_request_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10']
python-version: [3.12]
include:
- os: ubuntu-latest
python-version: 3.11
- os: ubuntu-latest
python-version: '3.10'
- os: ubuntu-latest
python-version: 3.9
- os: ubuntu-latest
Expand Down
8 changes: 7 additions & 1 deletion gaps/hpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,16 @@ def _subprocess_popen(cmd):
stdout = stdout.decode("ascii").rstrip()

if process.returncode != 0:
raise OSError(
msg = (
f"Subprocess submission failed with return code "
f"{process.returncode} and stderr:\n{stderr}"
)
if "Invalid qos specification" in stderr:
msg = (
f"{msg}\n(This error typically occurs if your allocation "
"runs out of AUs)"
)
raise OSError(msg)

return stdout, stderr

Expand Down
7 changes: 3 additions & 4 deletions gaps/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,15 @@ class QOSOption(CaseInsensitiveEnum):
"""Normal QOS."""
HIGH = "high"
"""High QOS."""
STANDBY = "standby"
"""Standby QOS."""
UNSPECIFIED = "unspecified"
"""Unspecified QOS."""

@classmethod
def _new_post_hook(cls, obj, value):
"""Hook for post-processing after __new__"""
if value in {"high"}:
obj.charge_factor = 2
else:
obj.charge_factor = 1
obj.charge_factor = 2 if value in {"high"} else 1
return obj


Expand Down
3 changes: 3 additions & 0 deletions gaps/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def __new__(cls, value):
obj = cls._new_post_hook(obj, value)
return obj

def __format__(self, format_spec):
return str.__format__(self._value_, format_spec)

# pylint: disable=inconsistent-return-statements
@classmethod
def _missing_(cls, value):
Expand Down
2 changes: 1 addition & 1 deletion gaps/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""GAPs Version Number. """

__version__ = "0.6.1"
__version__ = "0.6.2"
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@

DEV_REQUIREMENTS = ["black", "pylint", "jupyter", "pipreqs"]
TEST_REQUIREMENTS = ["pytest", "pytest-cov", "h5py"]
DOC_REQUIREMENTS = [
"make",
"ghp-import",
"numpydoc",
"pandoc"
]
DOC_REQUIREMENTS = ["make", "ghp-import", "numpydoc", "pandoc"]
DESCRIPTION = (
"National Renewable Energy Laboratory's (NREL's) Geospatial Analysis "
"Pipelines (GAPs) framework"
Expand Down Expand Up @@ -53,6 +48,8 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Application Frameworks",
],
test_suite="tests",
Expand Down

0 comments on commit 080f0fc

Please sign in to comment.