Skip to content

Commit 45feeaf

Browse files
elijahbenizzyElijah ben Izzy
andauthored
Drops support for 3.9, adds support for 3.13 (#1411)
* Drops support for 3.9, adds support for 3.13 3.9 is EOL in october. * Removes all 3.8/3.9 references --------- Co-authored-by: Elijah ben Izzy <ebenizzy@salesforce.com>
1 parent a24c94f commit 45feeaf

19 files changed

Lines changed: 42 additions & 140 deletions

.github/workflows/hamilton-lsp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: ['3.9', '3.10', '3.11']
20+
python-version: ['3.10', '3.11', '3.12', '3.13']
2121
defaults:
2222
run:
2323
working-directory: dev_tools/language_server

.github/workflows/hamilton-main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ jobs:
2323
os:
2424
- ubuntu-latest
2525
python-version:
26-
- '3.8'
27-
- '3.9'
2826
- '3.10'
2927
- '3.11'
3028
- '3.12'
29+
- '3.13'
3130
env:
3231
UV_PRERELEASE: "allow"
3332
HAMILTON_TELEMETRY_ENABLED: false

.github/workflows/hamilton-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: ['3.9', '3.10', '3.11']
20+
python-version: ['3.10', '3.11', '3.12', '3.13']
2121
defaults:
2222
run:
2323
working-directory: ui/sdk

hamilton/cli/__main__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@
1919
import json
2020
import logging
2121
import os
22-
import sys
2322
import warnings
2423
from pathlib import Path
2524
from pprint import pprint
26-
from typing import Any, Callable, List, Optional
27-
28-
if sys.version_info < (3, 9):
29-
from typing_extensions import Annotated
30-
else:
31-
from typing import Annotated
25+
from typing import Annotated, Any, Callable, List, Optional
3226

3327
import typer
3428

hamilton/htypes.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@
1818
import inspect
1919
import sys
2020
import typing
21-
from typing import Any, Iterable, Optional, Protocol, Tuple, Type, TypeVar, Union
21+
from typing import Any, Iterable, Literal, Optional, Protocol, Tuple, Type, TypeVar, Union
2222

2323
import typing_inspect
2424

25-
if sys.version_info >= (3, 9):
26-
from typing import Literal
27-
else:
28-
Literal = None
2925
from hamilton.registry import COLUMN_TYPE, DF_TYPE_AND_COLUMN_TYPES
3026

3127
BASE_ARGS_FOR_GENERICS = (typing.T,)

hamilton/node.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ def __init__(
118118
# assume optional values passed
119119
self._default_parameter_values = optional_values if optional_values else {}
120120
else:
121-
# TODO -- remove this when we no longer support 3.8 -- 10/14/2024
122-
type_hint_kwargs = {} if sys.version_info < (3, 9) else {"include_extras": True}
121+
type_hint_kwargs: dict[str, Any] = {"include_extras": True}
122+
if sys.version_info >= (3, 13):
123+
type_hint_kwargs["globalns"] = callabl.__globals__
123124
input_types = typing.get_type_hints(callabl, **type_hint_kwargs)
124125
signature = inspect.signature(callabl)
125126
for key, value in signature.parameters.items():
@@ -291,8 +292,7 @@ def from_fn(fn: Callable, name: str = None) -> "Node":
291292
"""
292293
if name is None:
293294
name = fn.__name__
294-
# TODO -- remove this when we no longer support 3.8 -- 10/14/2024
295-
type_hint_kwargs = {} if sys.version_info < (3, 9) else {"include_extras": True}
295+
type_hint_kwargs = {"include_extras": True}
296296
return_type = typing.get_type_hints(fn, **type_hint_kwargs).get("return")
297297
if return_type is None:
298298
raise ValueError(f"Missing type hint for return value in function {fn.__qualname__}.")

hamilton/plugins/h_spark.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import functools
1919
import inspect
2020
import logging
21-
import sys
2221
from types import CodeType, FunctionType, ModuleType
2322
from typing import Any, Callable, Collection, Dict, List, Optional, Set, Tuple, Type, Union
2423

@@ -229,10 +228,7 @@ def python_to_spark_type(python_type: Type[Union[int, float, bool, str, bytes]])
229228
raise ValueError("Unsupported Python type: " + str(python_type))
230229

231230

232-
if sys.version_info < (3, 9):
233-
_list = (List[int], List[float], List[bool], List[str], List[bytes])
234-
else:
235-
_list = (list[int], list[float], list[bool], list[str], list[bytes])
231+
_list = (list[int], list[float], list[bool], list[str], list[bytes])
236232

237233

238234
def get_spark_type(return_type: Any) -> types.DataType:

plugin_tests/h_spark/test_h_spark.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
import sys
1918

2019
import numpy as np
2120
import pandas as pd
@@ -356,7 +355,6 @@ def test_get_spark_type_basic_types(return_type, expected_spark_type):
356355

357356

358357
# 2. Lists of basic Python types
359-
@pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python 3.9 or higher")
360358
@pytest.mark.parametrize(
361359
"return_type,expected_spark_type",
362360
[

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ version = "1.89.0" # NOTE: keep this in sync with hamilton/version.py
2626
# dynamic = ["version"]
2727
description = "Hamilton, the micro-framework for creating dataframes."
2828
readme = "README.md"
29-
requires-python = ">=3.8.1, <4"
29+
requires-python = ">=3.10.1, <4"
3030
license = {text = "Apache-2.0"}
3131
keywords = ["hamilton"]
3232
authors = [
@@ -39,11 +39,10 @@ classifiers = [
3939
"Natural Language :: English",
4040
"License :: OSI Approved :: Apache Software License",
4141
"Programming Language :: Python :: 3",
42-
"Programming Language :: Python :: 3.8",
43-
"Programming Language :: Python :: 3.9",
4442
"Programming Language :: Python :: 3.10",
4543
"Programming Language :: Python :: 3.11",
4644
"Programming Language :: Python :: 3.12",
45+
"Programming Language :: Python :: 3.13"
4746
]
4847
dependencies = [
4948
"numpy",

tests/function_modifiers/test_adapters.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -711,14 +711,8 @@ def fn(data1: dict, data2: dict) -> dict:
711711
assert len(fg) == 5
712712

713713

714-
import sys
715-
716-
if sys.version_info >= (3, 9):
717-
dict_ = dict
718-
tuple_ = tuple
719-
else:
720-
dict_ = Dict
721-
tuple_ = Tuple
714+
dict_ = dict
715+
tuple_ = tuple
722716

723717

724718
# Mock functions for dataloader & datasaver testing
@@ -770,10 +764,6 @@ def test_dl_validate_incorrect_functions(func):
770764
dl.validate(func)
771765

772766

773-
@pytest.mark.skipif(
774-
sys.version_info < (3, 9, 0),
775-
reason="dataloader not guarenteed to work with subscripted tuples on 3.8",
776-
)
777767
def test_dl_validate_with_correct_function():
778768
dl = dataloader()
779769
try:

0 commit comments

Comments
 (0)