From f3db790ef13cbeaaab5b4b68d3b315d50bd2c8d7 Mon Sep 17 00:00:00 2001 From: Gavin Macaulay Date: Fri, 23 Aug 2024 12:25:05 +1200 Subject: [PATCH] Use external toml package to support Python 3.10 --- pyproject.toml | 1 + src/echosms/referencemodels.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2000bf3..d39a01c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ dependencies = [ "pandas", "mkdocstrings[python]", "xarray", + "toml" ] classifiers = [ diff --git a/src/echosms/referencemodels.py b/src/echosms/referencemodels.py index f9db306..572faef 100644 --- a/src/echosms/referencemodels.py +++ b/src/echosms/referencemodels.py @@ -1,7 +1,7 @@ """Reference model parameters.""" from pathlib import Path -import tomllib +import toml # Could use standard library tomllib once python >=3.11 import pandas as pd pd.options.mode.copy_on_write = True @@ -25,8 +25,8 @@ def __init__(self): self.definitions = [] - with open(self.defs_filename, 'rb') as f: - self.definitions = tomllib.load(f) + with open(self.defs_filename, 'r') as f: + self.definitions = toml.load(f) # Flag duplicate target names pda = pd.Series(self.names())