Skip to content

Commit 59e409b

Browse files
authored
compatibility with python 3.14 (#2647)
fixes #2640
1 parent ade0b99 commit 59e409b

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.github/workflows/test-stubs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-22.04]
21-
ver: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
21+
ver: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
2222
include:
23+
- os: macos-latest
24+
ver: "3.14"
2325
- os: macos-latest
2426
ver: "3.13"
2527
- os: macos-latest

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
os: [ubuntu-22.04]
28-
ver: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
28+
ver: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
2929
include:
30+
- os: macos-latest
31+
ver: "3.14"
3032
- os: macos-latest
3133
ver: "3.13"
3234
- os: macos-latest

metaflow/graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _parse_switch_dict(self, dict_node):
9494
case_key = None
9595

9696
# handle string literals
97-
if isinstance(key, ast.Str):
97+
if hasattr(ast, "Str") and isinstance(key, ast.Str):
9898
case_key = key.s
9999
elif isinstance(key, ast.Constant):
100100
case_key = key.value
@@ -171,7 +171,7 @@ def _parse(self, func_ast, lineno):
171171
# Get condition parameter
172172
for keyword in tail.value.keywords:
173173
if keyword.arg == "condition":
174-
if isinstance(keyword.value, ast.Str):
174+
if hasattr(ast, "Str") and isinstance(keyword.value, ast.Str):
175175
condition_name = keyword.value.s
176176
elif isinstance(keyword.value, ast.Constant) and isinstance(
177177
keyword.value.value, str

metaflow/runner/click_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ def getattr_wrapper(_self, name):
351351
class_dict = {
352352
"__module__": "metaflow",
353353
"_API_NAME": flow_file,
354-
"_internal_getattr": functools.partial(
355-
_lazy_load_command, cli_collection, "_compute_flow_parameters"
354+
"_internal_getattr": staticmethod(
355+
functools.partial(
356+
_lazy_load_command, cli_collection, "_compute_flow_parameters"
357+
)
356358
),
357359
"__getattr__": getattr_wrapper,
358360
}

0 commit comments

Comments
 (0)