Skip to content

Commit

Permalink
Drop Python 3.7 and Add Python 3.12 & 3.13 (#495)
Browse files Browse the repository at this point in the history
* drop support for py 3.7, add support for py 3.12 and 3.13

* fix docs build issue

* remove py 3.7 and add py 3.12/3.13 to integration tests

* update Makefile to use target_version variable and update spellbook requirements in examples
  • Loading branch information
bgunnar5 authored Feb 19, 2025
1 parent e1655df commit c08032d
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/push-pr_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,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@v4
Expand Down Expand Up @@ -158,7 +158,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@v4
Expand Down Expand Up @@ -224,7 +224,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@v4
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ python:

mkdocs:
fail_on_warning: false
configuration: mkdocs.yml

formats: [pdf]
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
- Added support for Python 3.12 and 3.13
- Added additional tests for the `merlin run` and `merlin purge` commands
- Aliased types to represent different types of pytest fixtures
- New test condition `StepFinishedFilesCount` to help search for `MERLIN_FINISHED` files in output workspaces
Expand All @@ -14,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `command-tests`, `workflow-tests`, and `integration-tests` to the Makefile

### Changed
- Dropped support for Python 3.7
- Ported all distributed tests of the integration test suite to pytest
- There is now a `commands/` directory and a `workflows/` directory under the integration suite to house these tests
- Removed the "Distributed-tests" GitHub action as these tests will now be run under "Integration-tests"
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ check-flake8:

check-black:
. $(VENV)/bin/activate; \
$(PYTHON) -m black --check --line-length $(MAX_LINE_LENGTH) --target-version py38 $(MRLN); \
$(PYTHON) -m black --check --line-length $(MAX_LINE_LENGTH) --target-version py38 $(TEST); \
$(PYTHON) -m black --check --line-length $(MAX_LINE_LENGTH) --target-version py38 *.py; \
$(PYTHON) -m black --check --line-length $(MAX_LINE_LENGTH) --target-version $(PY_TARGET_VER) $(MRLN); \
$(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:
Expand Down Expand Up @@ -182,9 +182,9 @@ fix-style:
$(PYTHON) -m isort -w $(MAX_LINE_LENGTH) $(MRLN); \
$(PYTHON) -m isort -w $(MAX_LINE_LENGTH) $(TEST); \
$(PYTHON) -m isort -w $(MAX_LINE_LENGTH) *.py; \
$(PYTHON) -m black --target-version py38 -l $(MAX_LINE_LENGTH) $(MRLN); \
$(PYTHON) -m black --target-version py38 -l $(MAX_LINE_LENGTH) $(TEST); \
$(PYTHON) -m black --target-version py38 -l $(MAX_LINE_LENGTH) *.py; \
$(PYTHON) -m black --target-version $(PY_TARGET_VER) -l $(MAX_LINE_LENGTH) $(MRLN); \
$(PYTHON) -m black --target-version $(PY_TARGET_VER) -l $(MAX_LINE_LENGTH) $(TEST); \
$(PYTHON) -m black --target-version $(PY_TARGET_VER) -l $(MAX_LINE_LENGTH) *.py; \


# Increment the Merlin version. USE ONLY ON DEVELOP BEFORE MERGING TO MASTER.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Need help? <[email protected]>

## Quick Start

Note: Merlin supports Python 3.6+.
Note: Merlin supports Python 3.8+.

To install Merlin and its dependencies, run:

Expand Down
1 change: 1 addition & 0 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PYTHON?=python3
PY_TARGET_VER?=py311
PYV=$(shell $(PYTHON) -c "import sys;t='{v[0]}_{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)")
PYVD=$(shell $(PYTHON) -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)")
VENV?=venv_merlin_py_$(PYV)
Expand Down
32 changes: 16 additions & 16 deletions merlin/common/openfilelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@
###############################################################################

"""
OpenFileList
OpenFileList
A synthetic file class that opens a list of files and reads them as if they
were a single file
A synthetic file class that opens a list of files and reads them as if they
were a single file
SYNOPSIS:
SYNOPSIS:
with OpenFileList(["file1.txt","file2.txt",...]) as f :
print f.read();
with OpenFileList(["file1.txt","file2.txt",...]) as f :
print f.read();
reads the concatenation of file1.txt, file2.txt, etc.
reads the concatenation of file1.txt, file2.txt, etc.
file methods supported :
file methods supported :
f.read([bytes])
f.readlines([bytes])
f.readline([bytes])
f.tell()
f.close()
f.__iter__()
f.read([bytes])
f.readlines([bytes])
f.readline([bytes])
f.tell()
f.close()
f.__iter__()
TODO:
implement a seek method
TODO:
implement a seek method
"""

Expand Down
3 changes: 2 additions & 1 deletion merlin/examples/workflows/feature_demo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
scikit-learn
merlin-spellbook
merlin-spellbook; python_version < "3.12"
merlin-spellbook>=0.9.0; python_version >= "3.12"
3 changes: 2 additions & 1 deletion merlin/examples/workflows/optimization/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
merlin-spellbook
merlin-spellbook; python_version < "3.12"
merlin-spellbook>=0.9.0; python_version >= "3.12"
numpy
scikit-learn
matplotlib
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
scikit-learn
merlin-spellbook
merlin-spellbook; python_version < "3.12"
merlin-spellbook>=0.9.0; python_version >= "3.12"
7 changes: 1 addition & 6 deletions merlin/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import logging
import os
import time
from importlib import resources
from typing import Dict, List, Tuple

from merlin.exceptions import NoWorkersException
Expand All @@ -57,12 +58,6 @@
)


try:
from importlib import resources
except ImportError:
import importlib_resources as resources


LOG = logging.getLogger(__name__)

# TODO go through this file and find a way to make a common return format to main.py
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,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",
url="https://github.com/LLNL/merlin",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixture_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
FixtureStr = Annotated[str, pytest.fixture]
FixtureTuple = Annotated[Tuple[K, V], pytest.fixture]
else:
# Fallback for Python 3.7 and 3.8
# Fallback for Python 3.8
class FixtureDict(Generic[K, V], Dict[K, V]):
"""
This class is necessary to allow FixtureDict to be subscriptable
Expand Down

0 comments on commit c08032d

Please sign in to comment.