From 4e14272786b735e3dfca233af772daa2c2330ee3 Mon Sep 17 00:00:00 2001 From: George Vauter Date: Tue, 20 Aug 2024 14:18:57 -0400 Subject: [PATCH] fix: use importlib_resources backport for compatability with older python versions Signed-off-by: George Vauter --- poetry.lock | 12 ++++++------ pyproject.toml | 1 + trestlebot/entrypoints/init.py | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index dd9fbe91..c11c0445 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1029,21 +1029,21 @@ test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "p [[package]] name = "importlib-resources" -version = "6.4.0" +version = "6.4.3" description = "Read resources from Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "importlib_resources-6.4.0-py3-none-any.whl", hash = "sha256:50d10f043df931902d4194ea07ec57960f66a80449ff867bfe782b4c486ba78c"}, - {file = "importlib_resources-6.4.0.tar.gz", hash = "sha256:cdb2b453b8046ca4e3798eb1d84f3cce1446a0e8e7b5ef4efb600f19fc398145"}, + {file = "importlib_resources-6.4.3-py3-none-any.whl", hash = "sha256:2d6dfe3b9e055f72495c2085890837fc8c758984e209115c8792bddcb762cd93"}, + {file = "importlib_resources-6.4.3.tar.gz", hash = "sha256:4a202b9b9d38563b46da59221d77bb73862ab5d79d461307bcb826d725448b98"}, ] [package.dependencies] zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["jaraco.test (>=5.4)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +test = ["jaraco.test (>=5.4)", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"] [[package]] name = "inflect" @@ -2585,4 +2585,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "d5854f47625b746127786a796976bd9ff4b0648108074e1b9ee8e9918b1ae86b" +content-hash = "4a8eea1af39dae299c2000af88cfd50760a2a762498816238c5a0b8287fb7e78" diff --git a/pyproject.toml b/pyproject.toml index 44edb4a8..ee5ab3f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ github3-py = "^4.0.1" python-gitlab = "^4.2.0" ruamel-yaml = "^0.18.5" pydantic = "^2.0.0" +importlib-resources = "^6.4.3" [tool.poetry.group.dev.dependencies] flake8 = "^7.0.0" diff --git a/trestlebot/entrypoints/init.py b/trestlebot/entrypoints/init.py index f7dcc205..990b493f 100644 --- a/trestlebot/entrypoints/init.py +++ b/trestlebot/entrypoints/init.py @@ -14,13 +14,13 @@ """ import argparse -import importlib.resources import logging import pathlib import shutil import sys import traceback +import importlib_resources from trestle.common import file_utils from trestle.core.commands.init import InitCmd @@ -151,7 +151,7 @@ def _copy_provider_files(self, args: argparse.Namespace) -> None: ) provider_dir.mkdir(parents=True, exist_ok=True) - templates_dir = importlib.resources.files( + templates_dir = importlib_resources.files( f"{self.TEMPLATES_MODULE}.{args.provider}" ) for template_file in self.PROVIDER_TEMPLATES[args.provider][args.oscal_model]: