diff --git a/poetry.lock b/poetry.lock index 4ca37da0..029f3ed4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -984,4 +984,4 @@ test = ["flake8 (>=2.4.0)", "isort (>=4.2.2)", "pytest (>=2.2.3)"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "556ad95b5c952596849c82b210f6e24a0b02f9d5e1461cbc0c564910e2d7e947" +content-hash = "ac5bd99d673cdfcd48512b6f97ab6cf729a39ba89760c33dc7851749f26a7965" diff --git a/pyproject.toml b/pyproject.toml index 1fc1f7d8..d65df5dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,9 +9,9 @@ repository = "https://github.com/greenbone/troubadix" homepage = "https://github.com/greenbone/troubadix" # Full list: https://pypi.org/pypi?%3Aaction=list_classifiers -classifiers=[ +classifiers = [ "Development Status :: 4 - Beta", - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", # pylint: disable=line-too-long + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", # pylint: disable=line-too-long "Environment :: Console", "Intended Audience :: Developers", "Programming Language :: Python :: 3.9", @@ -21,10 +21,7 @@ classifiers=[ "Topic :: Software Development :: Libraries :: Python Modules", ] -packages = [ - { include = "troubadix"}, - { include = "tests", format = "sdist" }, -] +packages = [{ include = "troubadix" }, { include = "tests", format = "sdist" }] [tool.poetry.dependencies] python = "^3.9" @@ -35,7 +32,7 @@ chardet = ">=4,<6" validators = "0.20.0" gitpython = "^3.1.31" charset-normalizer = "^3.2.0" -tomli = "^2.0.1" +tomli = { version = "^2.0.1", python = "<3.11" } [tool.poetry.dev-dependencies] autohooks = ">=21.7.0" diff --git a/troubadix/troubadix.py b/troubadix/troubadix.py index 2e56c817..de0abed0 100644 --- a/troubadix/troubadix.py +++ b/troubadix/troubadix.py @@ -21,7 +21,6 @@ from pathlib import Path from typing import Iterable, List, Tuple -import tomli from pontos.terminal import Terminal from pontos.terminal.terminal import ConsoleTerminal @@ -31,6 +30,11 @@ from troubadix.reporter import Reporter from troubadix.runner import Runner +try: + import tomllib +except ImportError: + import tomli as tomllib + def generate_file_list( dirs: Iterable[Path], @@ -167,7 +171,7 @@ def main(args=None): # Get the plugins configurations from the external toml file try: with open(parsed_args.plugins_config_file, "rb") as file: - plugins_config = tomli.load(file) + plugins_config = tomllib.load(file) except FileNotFoundError: term.warning( f"Config file '{parsed_args.plugins_config_file}' does not exist"