From 8e6806f6e8c7a26001f68583e60b24bc3541b8b2 Mon Sep 17 00:00:00 2001 From: Pedro Brochado Date: Tue, 30 Jul 2024 15:44:19 -0300 Subject: [PATCH] Bump python-version lowerbound to 3.11 Also, updated 3rd party that was added to stdlib: - importlib.resources instead of importlib_resources - tomllib instead of tomli --- pyproject.toml | 3 +-- src/pulp_docs/main.py | 6 +++--- src/pulp_docs/openapi.py | 4 ++-- src/pulp_docs/repository.py | 4 ++-- tox.ini | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9be2a77..51846cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "pulp-docs" version = "0.0.1" +requires-python = ">= 3.11" dependencies = [ "mkdocs-material", "mkdocstrings", @@ -13,10 +14,8 @@ dependencies = [ "mkdocs-site-urls", "mkdocs-literate-nav", "bs4", - "importlib_resources", "httpx", "rich", - "tomli", ] [project.scripts] diff --git a/src/pulp_docs/main.py b/src/pulp_docs/main.py index 8a64318..57e16c8 100644 --- a/src/pulp_docs/main.py +++ b/src/pulp_docs/main.py @@ -4,7 +4,7 @@ import typing as t from pathlib import Path -from importlib_resources import files +from importlib.resources import files TMP_DIR = Path("tmp") WORKDIR = Path.home() / "workspace" / "multirepo-prototype" @@ -36,8 +36,8 @@ def __init__(self, from_environ: bool = False): if from_environ is False: self.verbose = False self.workdir = Path().absolute() - self.mkdocs_file = files("pulp_docs").joinpath("data/mkdocs.yml").absolute() - self.repolist = files("pulp_docs").joinpath("data/repolist.yml").absolute() + self.mkdocs_file = files("pulp_docs").joinpath("data/mkdocs.yml") + self.repolist = files("pulp_docs").joinpath("data/repolist.yml") self.clear_cache = False if env_mkdocs := os.environ.get("PULPDOCS_MKDOCS_FILE"): diff --git a/src/pulp_docs/openapi.py b/src/pulp_docs/openapi.py index 5ff7a64..2b048e2 100644 --- a/src/pulp_docs/openapi.py +++ b/src/pulp_docs/openapi.py @@ -10,7 +10,7 @@ from pathlib import Path from typing import NamedTuple, Optional -from importlib_resources import files +from importlib.resources import files from pulp_docs.constants import BASE_TMPDIR_NAME from pulp_docs.repository import Repos @@ -20,7 +20,7 @@ def main( output_dir: Path, plugins_filter: Optional[list[str]] = None, dry_run: bool = False ): """Creates openapi json files for all or selected plugins in output dir.""" - repolist = files("pulp_docs").joinpath("data/repolist.yml").absolute() + repolist = str(files("pulp_docs").joinpath("data/repolist.yml")) repos = Repos.from_yaml(repolist).get_repos(["content"]) if plugins_filter: repos = [p for p in repos if p.name in plugins_filter] diff --git a/src/pulp_docs/repository.py b/src/pulp_docs/repository.py index d3866c7..aa51435 100644 --- a/src/pulp_docs/repository.py +++ b/src/pulp_docs/repository.py @@ -18,7 +18,7 @@ import httpx import configparser -import tomli +import tomllib import yaml from pulp_docs.utils.general import get_git_ignored_files @@ -151,7 +151,7 @@ def download( else: version_file = src_copy_path / "pyproject.toml" if version_file.exists(): - content = tomli.loads(version_file.read_text()) + content = tomllib.loads(version_file.read_text()) self.version = ( content.get("tool", {}) .get("bumpversion", {}) diff --git a/tox.ini b/tox.ini index ad5a418..4fd2e65 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] requires = tox>=4 -env_list = py{38,39,310,311,312} +env_list = py{311,312} [testenv] description = run tests