diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-03-19 22:57:02 -0400 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-03-19 22:57:02 -0400 |
| commit | e81dfaee421b851316fec69cdb126a5d87bb796e (patch) | |
| tree | 60b6b06d60d212e79f3524e08b2c2a033bd7439e /task | |
| parent | Remove '<7' version constraint for psutil (diff) | |
| download | taskipy2-e81dfaee421b851316fec69cdb126a5d87bb796e.zip | |
Replace tomli with tomllib on python 3.11+
Diffstat (limited to '')
| -rw-r--r-- | taskipy/pyproject.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/taskipy/pyproject.py b/taskipy/pyproject.py index 74e7624..f58e9a4 100644 --- a/taskipy/pyproject.py +++ b/taskipy/pyproject.py @@ -1,7 +1,10 @@ from pathlib import Path from typing import Any, Dict, MutableMapping, Optional, Union -import tomli +try: + import tomllib +except ImportError: + import tomli as tomllib from taskipy.exceptions import ( InvalidRunnerTypeError, @@ -92,10 +95,10 @@ class PyProject: file_path = Path(file_path).resolve() with open(file_path, 'rb') as file: - return tomli.load(file) + return tomllib.load(file) except FileNotFoundError: raise MissingPyProjectFileError() - except tomli.TOMLDecodeError as e: + except tomllib.TOMLDecodeError as e: raise MalformedPyProjectError(reason=str(e)) @staticmethod |