Skip to content

Commit 5ec9544

Browse files
committed
fix: add python 3.13 compatibility
Signed-off-by: develop-cs <[email protected]>
1 parent 001d4e9 commit 5ec9544

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
### Features
1010

11-
* Add a new configuration setting for rules' execution: `rule_activation_mode` (#38).
11+
* Add a new configuration setting for rule execution: `rule_activation_mode` (#38).
1212

1313
### Maintenance
1414

15+
* Compatibility with Python 3.13.
1516
* Use true Pydantic V2 (or Pydantic V1) models (`DeprecationWarning` added about Pydantic V1).
1617

18+
> [!IMPORTANT]
19+
> **Arta** + **Pydantic V1** + **Python 3.13** is not supported because Pydantic V1 is not supported for Python > 3.12 ([issue 9663](https://github.com/pydantic/pydantic/issues/9663)).
20+
1721
### Documentation
1822

19-
* New page: *"Use your business objects".*
23+
* New pages:
24+
* *Use your business objects*
25+
* *Rule activation mode*
2026

2127
### Breaking changes
2228

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ classifiers = [
2828
"Programming Language :: Python :: 3.10",
2929
"Programming Language :: Python :: 3.11",
3030
"Programming Language :: Python :: 3.12",
31+
"Programming Language :: Python :: 3.13",
3132
"License :: OSI Approved :: Apache Software License",
3233
]
3334

@@ -42,12 +43,10 @@ Documentation = "https://maif.github.io/arta/home/"
4243
Repository = "https://github.com/MAIF/arta"
4344

4445
[project.optional-dependencies]
45-
all = ["arta[test,dev,doc,mypy,ruff]"]
46+
all = ["arta[test,dev,doc]"]
4647
test = ["pytest", "tox", "pytest-cov"]
4748
dev = ["mypy", "pre-commit", "ruff"]
4849
doc = ["mkdocs-material", "mkdocstrings[python]"]
49-
mypy = ["mypy"]
50-
ruff = ["ruff"]
5150

5251
[tool.setuptools]
5352
package-dir = {"" = "src"}

src/arta/condition.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,12 @@ def verify(self, input_data: dict[str, Any], parsing_error_strategy: ParsingErro
183183
path_matches: list[str] = re.findall(data_path_patt, unitary_expr)
184184

185185
if len(path_matches) > 0:
186+
locals_ns: dict[str, Any] = {}
187+
186188
# Regular case: we have a data paths
187189
for idx, path in enumerate(path_matches):
188190
# Read data from the path
189-
locals()[f"data_{idx}"] = parse_dynamic_parameter( # noqa
191+
locals_ns[f"data_{idx}"] = parse_dynamic_parameter(
190192
parameter=path, input_data=input_data, parsing_error_strategy=parsing_error_strategy
191193
)
192194

@@ -195,7 +197,7 @@ def verify(self, input_data: dict[str, Any], parsing_error_strategy: ParsingErro
195197

196198
# Evaluate the expression
197199
try:
198-
bool_var = eval(unitary_expr) # noqa
200+
bool_var = eval(unitary_expr, None, locals_ns) # noqa
199201
except TypeError:
200202
# Ignore evaluation --> False
201203
pass

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[tox]
22
min_version = 4.0
33
env_list =
4+
py313
45
py312
56
py311
67
py310

0 commit comments

Comments
 (0)