diff --git a/.github/workflows/push-pr_workflow.yml b/.github/workflows/push-pr_workflow.yml index a3c6eb4..8ced825 100644 --- a/.github/workflows/push-pr_workflow.yml +++ b/.github/workflows/push-pr_workflow.yml @@ -75,7 +75,7 @@ jobs: strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 83708e9..5542922 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to Merlin Spellbook will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.0] + +### Added +- Added support for python 3.12 and python 3.13 + +### Changed +- Dropped support for python 3.7 and older +- Updated Makefile to use newer check-style targets + ## [0.8.1] ### Fixed diff --git a/Makefile b/Makefile index 2ffec3b..3b534bb 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,19 @@ VER?=1.0.0 VSTRING=[0-9]\+\.[0-9]\+\.[0-9]\+ +PYTHON?=python3 +PY_TARGET_VER?=py311 # At the time this is added (2/19/25) black only supports up to py311 PROJ=spellbook TEST=tests +# check setup.cfg exists +ifeq (,$(wildcard setup.cfg)) + MAX_LINE_LENGTH=127 +else + MAX_LINE_LENGTH=$(shell grep 'max-line-length' setup.cfg | cut -d ' ' -f3) +endif + unit-tests: python3 -m pytest $(TEST)/ @@ -35,15 +44,39 @@ clean: -rm -rf build fix-style: - python3 -m isort --line-length 88 $(PROJ) - python3 -m isort --line-length 88 $(TEST) - python3 -m isort --line-length 88 *.py - python3 -m black --line-length 88 --target-version py36 $(PROJ) - python3 -m black --line-length 88 --target-version py36 $(TEST) - python3 -m black --line-length 88 --target-version py36 *.py - -check-style: - python3 -m black --check --line-length 88 --target-version py36 $(PROJ) - python3 -m black --check --line-length 88 --target-version py36 $(TEST) - python3 -m pylint $(PROJ) --rcfile=setup.cfg --exit-zero - python3 -m pylint *.py --rcfile=setup.cfg --exit-zero + python3 -m isort --line-length $(MAX_LINE_LENGTH) $(PROJ) + python3 -m isort --line-length $(MAX_LINE_LENGTH) $(TEST) + python3 -m isort --line-length $(MAX_LINE_LENGTH) *.py + python3 -m black --line-length $(MAX_LINE_LENGTH) --target-version $(PY_TARGET_VER) $(PROJ) + python3 -m black --line-length $(MAX_LINE_LENGTH) --target-version $(PY_TARGET_VER) $(TEST) + python3 -m black --line-length $(MAX_LINE_LENGTH) --target-version $(PY_TARGET_VER) *.py + + +check-flake8: + echo "Flake8 linting for invalid source (bad syntax, undefined variables)..."; \ + $(PYTHON) -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics; \ + echo "Flake8 linting failure for CI..."; \ + $(PYTHON) -m flake8 . --count --max-complexity=15 --statistics --max-line-length=127; \ + + +check-black: + $(PYTHON) -m black --check --line-length $(MAX_LINE_LENGTH) --target-version $(PY_TARGET_VER) $(PROJ); \ + $(PYTHON) -m black --check --line-length $(MAX_LINE_LENGTH) --target-version $(PY_TARGET_VER) $(TEST); \ + $(PYTHON) -m black --check --line-length $(MAX_LINE_LENGTH) --target-version $(PY_TARGET_VER) *.py; \ + + +check-isort: + $(PYTHON) -m isort --check --line-length $(MAX_LINE_LENGTH) $(PROJ); \ + $(PYTHON) -m isort --check --line-length $(MAX_LINE_LENGTH) $(TEST); \ + $(PYTHON) -m isort --check --line-length $(MAX_LINE_LENGTH) *.py; \ + + +check-pylint: + echo "PyLinting spellbook source..."; \ + $(PYTHON) -m pylint $(PROJ) --rcfile=setup.cfg --disable=logging-fstring-interpolation; \ + $(PYTHON) -m pylint *.py --rcfile=setup.cfg --exit-zero + echo "PyLinting spellbook tests..."; \ + $(PYTHON) -m pylint $(TEST) --rcfile=setup.cfg; \ + + +check-style: check-flake8 check-black check-isort check-pylint diff --git a/requirements/dev.txt b/requirements/dev.txt index a0ea543..120fe70 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,6 +1,6 @@ # Development dependencies. pylint -black==22.8.0 +black dep-license flake8 isort diff --git a/requirements/release.txt b/requirements/release.txt index 5f00828..95ede58 100644 --- a/requirements/release.txt +++ b/requirements/release.txt @@ -2,6 +2,6 @@ importlib_resources; python_version < '3.7' coloredlogs click numpy -pyDOE2 +pyDOE3 scipy scikit-learn diff --git a/setup.py b/setup.py index 78adf53..153e041 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ # # LLNL-CODE-797170 # All rights reserved. -# This file is part of Merlin-Spellbook, Version: 0.8.1. +# This file is part of Merlin-Spellbook, Version: 0.9.0. # # For details, see https://github.com/LLNL/merlin-spellbook. # @@ -98,11 +98,12 @@ def extras_require(): long_description=readme(), long_description_content_type="text/markdown", classifiers=[ - "Programming Language :: Python :: 3.7", "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", + "Programming Language :: Python :: 3.13", ], keywords="machine learning workflow utilities", url="https://github.com/LLNL/merlin-spellbook", diff --git a/spellbook/__init__.py b/spellbook/__init__.py index 5a38c0b..413b451 100644 --- a/spellbook/__init__.py +++ b/spellbook/__init__.py @@ -1,3 +1,3 @@ -__version__ = "0.8.1" +__version__ = "0.9.0" VERSION = __version__ diff --git a/spellbook/data_formatting/conduit/python/conduit_bundler.py b/spellbook/data_formatting/conduit/python/conduit_bundler.py index 6793fef..9693e9f 100644 --- a/spellbook/data_formatting/conduit/python/conduit_bundler.py +++ b/spellbook/data_formatting/conduit/python/conduit_bundler.py @@ -6,7 +6,7 @@ # # LLNL-CODE- # All rights reserved. -# This file is part of merlin-spellbook, Version: 0.8.1. +# This file is part of merlin-spellbook, Version: 0.9.0. # # For details, see https://github.com/LLNL/merlin-spellbook. # diff --git a/spellbook/data_formatting/conduit/python/translator.py b/spellbook/data_formatting/conduit/python/translator.py index 91f09ff..93cbd92 100644 --- a/spellbook/data_formatting/conduit/python/translator.py +++ b/spellbook/data_formatting/conduit/python/translator.py @@ -86,9 +86,9 @@ def run(_input, output, schema): if data_loader.has_path(sample_path): data_loader.read(filtered_node[path], sample_path) else: - filtered_node[ - sample_path - ] = np.nan # if a value is missing, that could be a problem + filtered_node[sample_path] = ( + np.nan + ) # if a value is missing, that could be a problem make_data_array_dict(all_dict, filtered_node) for dat in all_dict.keys(): diff --git a/spellbook/log_formatter.py b/spellbook/log_formatter.py index 395e4ba..5af11ac 100644 --- a/spellbook/log_formatter.py +++ b/spellbook/log_formatter.py @@ -6,7 +6,7 @@ # # LLNL-CODE-797170 # All rights reserved. -# This file is part of Merlin Spellbook, Version: 0.8.1. +# This file is part of Merlin Spellbook, Version: 0.9.0. # # For details, see https://github.com/LLNL/merlin. # diff --git a/spellbook/sampling/make_samples.py b/spellbook/sampling/make_samples.py index 12c6d51..e899a67 100644 --- a/spellbook/sampling/make_samples.py +++ b/spellbook/sampling/make_samples.py @@ -1,7 +1,7 @@ import ast import numpy as np -import pyDOE2 as doe +import pyDOE3 as doe from scipy.stats.distributions import norm from spellbook.commands import CliCommand diff --git a/tests/command_line_tests.py b/tests/command_line_tests.py index 6e3e231..227b39e 100644 --- a/tests/command_line_tests.py +++ b/tests/command_line_tests.py @@ -46,7 +46,7 @@ def run_single_test(name, test, test_label="", buffer_length=50): dot_length = buffer_length - len(name) - len(str(test_label)) - print(f"TEST {test_label}: {name}{'.'*dot_length}", end="") + print(f"TEST {test_label}: {name}{'.' * dot_length}", end="") command = test[0] conditions = test[1] if not isinstance(conditions, list):