diff --git a/poetry.lock b/poetry.lock index eed64854..2113b23a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2575,4 +2575,4 @@ tsconcat = ["ba-tsconcat", "bids2table", "elbow", "imagesize", "nibabel", "numpy [metadata] lock-version = "2.1" python-versions = ">=3.10,<4.0" -content-hash = "780014116856fb94b6e446101486e3326496cbd3d8212e1381cfd1935adce53d" +content-hash = "e28e90e667b21a672cfcdb93cfe3c5fb01d4f5b5c72c9e8f9528cb064dfaed34" diff --git a/pyproject.toml b/pyproject.toml index d375f348..322f6245 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ dependencies = [ "semver", "spython>=0.3.0", "tabulate>=0.8.6", + "tomli; python_version < '3.11'", "tornado", "websocket-client" ] diff --git a/src/cpac/helpers/store_optional_dependencies.py b/src/cpac/helpers/store_optional_dependencies.py index 9501c360..40f3cd9c 100755 --- a/src/cpac/helpers/store_optional_dependencies.py +++ b/src/cpac/helpers/store_optional_dependencies.py @@ -4,11 +4,16 @@ from itertools import chain from pathlib import Path from pickle import dump, load -import tomllib from typing import cast from packaging.requirements import Requirement +try: + import tomllib +except ImportError: + # Python < 3.11 + import tomli as tomllib + PICKLE_PATH = Path(__file__).parents[1] / "optional_dependencies.pkl"