From 70b1926f5413e795f4c882f14876f7aa76baddde Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Wed, 8 Jan 2025 15:48:24 -0500 Subject: [PATCH 1/3] Use Python 3.12 - Delete older requirements files - Test on Python 3.12 and Python 3.13 - Change root level requirements.txt to symlink - Update README --- .github/workflows/unit-tests.yml | 3 +- README.md | 12 +++--- requirements.txt | 39 +------------------ ...rements-3.11.txt => requirements-3.13.txt} | 12 +++--- requirements/requirements-3.9.txt | 38 ------------------ ...dev-3.11.txt => requirements-dev-3.13.txt} | 13 +++---- requirements/requirements-dev-3.9.txt | 30 -------------- ...st-3.11.txt => requirements-test-3.13.txt} | 4 +- requirements/requirements-test-3.9.txt | 9 ----- scripts/freeze.py | 16 ++++++-- 10 files changed, 35 insertions(+), 141 deletions(-) mode change 100644 => 120000 requirements.txt rename requirements/{requirements-3.11.txt => requirements-3.13.txt} (85%) delete mode 100644 requirements/requirements-3.9.txt rename requirements/{requirements-dev-3.11.txt => requirements-dev-3.13.txt} (70%) delete mode 100644 requirements/requirements-dev-3.9.txt rename requirements/{requirements-test-3.11.txt => requirements-test-3.13.txt} (73%) delete mode 100644 requirements/requirements-test-3.9.txt diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 48f89b0..4c12317 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -13,7 +13,8 @@ jobs: fail-fast: true matrix: python-version: - - "3.9" + - "3.12" + - "3.13" steps: - name: Checkout diff --git a/README.md b/README.md index e1965dc..9df2433 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ API server providing access to Red Hat Enterprise Linux roadmap information. ## Prerequisites -Python 3.9 or later. +Python 3.12 or later. A container runtime such as `docker` or `podman`. @@ -58,13 +58,13 @@ pre-commit run --all-files ### Updating requirements -Python 3.9, 3.11, and 3.12 must be available in order to generate requirements files. +Python 3.12 and 3.13 must be available in order to generate requirements files. -The following files are used for updating requiremetns: +The following files are used for updating requirements: -- `requiremetns.in` - Direct project dependencies -- `requiremetns-dev.in` - Requirements for development -- `requiremetns-test.in` - Requirements for running tests +- `requirements.in` - Direct project dependencies +- `requirements-dev.in` - Requirements for development +- `requirements-test.in` - Requirements for running tests - `constraints.txt` - Indirect project dependencies ``` diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e093a82..0000000 --- a/requirements.txt +++ /dev/null @@ -1,38 +0,0 @@ -annotated-types==0.7.0 -anyio==4.7.0 -certifi==2024.12.14 -click==8.1.7 -dnspython==2.7.0 -email_validator==2.2.0 -exceptiongroup==1.2.2 -fastapi==0.115.6 -fastapi-cli==0.0.7 -greenlet==3.1.1 -h11==0.14.0 -httpcore==1.0.7 -httptools==0.6.4 -httpx==0.28.1 -idna==3.10 -Jinja2==3.1.4 -markdown-it-py==3.0.0 -MarkupSafe==3.0.2 -mdurl==0.1.2 -psycopg==3.2.3 -pydantic==2.10.3 -pydantic_core==2.27.1 -Pygments==2.18.0 -python-dotenv==1.0.1 -python-multipart==0.0.20 -PyYAML==6.0.2 -rich==13.9.4 -rich-toolkit==0.12.0 -shellingham==1.5.4 -sniffio==1.3.1 -SQLAlchemy==2.0.36 -starlette==0.41.3 -typer==0.15.1 -typing_extensions==4.12.2 -uvicorn==0.34.0 -uvloop==0.21.0 -watchfiles==1.0.3 -websockets==14.1 diff --git a/requirements.txt b/requirements.txt new file mode 120000 index 0000000..c1c1417 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requirements/requirements-3.12.txt \ No newline at end of file diff --git a/requirements/requirements-3.11.txt b/requirements/requirements-3.13.txt similarity index 85% rename from requirements/requirements-3.11.txt rename to requirements/requirements-3.13.txt index b5241dc..0c1492d 100644 --- a/requirements/requirements-3.11.txt +++ b/requirements/requirements-3.13.txt @@ -1,7 +1,7 @@ annotated-types==0.7.0 -anyio==4.7.0 +anyio==4.8.0 certifi==2024.12.14 -click==8.1.7 +click==8.1.8 dnspython==2.7.0 email_validator==2.2.0 fastapi==0.115.6 @@ -12,14 +12,14 @@ httpcore==1.0.7 httptools==0.6.4 httpx==0.28.1 idna==3.10 -Jinja2==3.1.4 +Jinja2==3.1.5 markdown-it-py==3.0.0 MarkupSafe==3.0.2 mdurl==0.1.2 psycopg==3.2.3 -pydantic==2.10.3 -pydantic_core==2.27.1 -Pygments==2.18.0 +pydantic==2.10.4 +pydantic_core==2.27.2 +Pygments==2.19.1 python-dotenv==1.0.1 python-multipart==0.0.20 PyYAML==6.0.2 diff --git a/requirements/requirements-3.9.txt b/requirements/requirements-3.9.txt deleted file mode 100644 index e093a82..0000000 --- a/requirements/requirements-3.9.txt +++ /dev/null @@ -1,38 +0,0 @@ -annotated-types==0.7.0 -anyio==4.7.0 -certifi==2024.12.14 -click==8.1.7 -dnspython==2.7.0 -email_validator==2.2.0 -exceptiongroup==1.2.2 -fastapi==0.115.6 -fastapi-cli==0.0.7 -greenlet==3.1.1 -h11==0.14.0 -httpcore==1.0.7 -httptools==0.6.4 -httpx==0.28.1 -idna==3.10 -Jinja2==3.1.4 -markdown-it-py==3.0.0 -MarkupSafe==3.0.2 -mdurl==0.1.2 -psycopg==3.2.3 -pydantic==2.10.3 -pydantic_core==2.27.1 -Pygments==2.18.0 -python-dotenv==1.0.1 -python-multipart==0.0.20 -PyYAML==6.0.2 -rich==13.9.4 -rich-toolkit==0.12.0 -shellingham==1.5.4 -sniffio==1.3.1 -SQLAlchemy==2.0.36 -starlette==0.41.3 -typer==0.15.1 -typing_extensions==4.12.2 -uvicorn==0.34.0 -uvloop==0.21.0 -watchfiles==1.0.3 -websockets==14.1 diff --git a/requirements/requirements-dev-3.11.txt b/requirements/requirements-dev-3.13.txt similarity index 70% rename from requirements/requirements-dev-3.11.txt rename to requirements/requirements-dev-3.13.txt index 226687d..0640eb4 100644 --- a/requirements/requirements-dev-3.11.txt +++ b/requirements/requirements-dev-3.13.txt @@ -1,14 +1,14 @@ --r requirements-3.11.txt --r requirements-test-3.11.txt +-r requirements-3.13.txt +-r requirements-test-3.13.txt asttokens==3.0.0 cfgv==3.4.0 decorator==5.1.1 distlib==0.3.9 executing==2.1.0 filelock==3.16.1 -identify==2.6.3 +identify==2.6.5 ipdb==0.13.13 -ipython==8.30.0 +ipython==8.31.0 jedi==0.19.2 matplotlib-inline==0.1.7 nodeenv==1.9.1 @@ -19,10 +19,9 @@ pre_commit==4.0.1 prompt_toolkit==3.0.48 ptyprocess==0.7.0 pure_eval==0.2.3 -Pygments==2.18.0 +Pygments==2.19.1 PyYAML==6.0.2 stack-data==0.6.3 traitlets==5.14.3 -typing_extensions==4.12.2 -virtualenv==20.28.0 +virtualenv==20.28.1 wcwidth==0.2.13 diff --git a/requirements/requirements-dev-3.9.txt b/requirements/requirements-dev-3.9.txt deleted file mode 100644 index 02d3cdd..0000000 --- a/requirements/requirements-dev-3.9.txt +++ /dev/null @@ -1,30 +0,0 @@ --r requirements-3.9.txt --r requirements-test-3.9.txt -asttokens==3.0.0 -cfgv==3.4.0 -decorator==5.1.1 -distlib==0.3.9 -exceptiongroup==1.2.2 -executing==2.1.0 -filelock==3.16.1 -identify==2.6.3 -ipdb==0.13.13 -ipython==8.18.1 -jedi==0.19.2 -matplotlib-inline==0.1.7 -nodeenv==1.9.1 -parso==0.8.4 -pexpect==4.9.0 -platformdirs==4.3.6 -pre_commit==4.0.1 -prompt_toolkit==3.0.48 -ptyprocess==0.7.0 -pure_eval==0.2.3 -Pygments==2.18.0 -PyYAML==6.0.2 -stack-data==0.6.3 -tomli==2.2.1 -traitlets==5.14.3 -typing_extensions==4.12.2 -virtualenv==20.28.0 -wcwidth==0.2.13 diff --git a/requirements/requirements-test-3.11.txt b/requirements/requirements-test-3.13.txt similarity index 73% rename from requirements/requirements-test-3.11.txt rename to requirements/requirements-test-3.13.txt index 2c4d3a9..db08ad7 100644 --- a/requirements/requirements-test-3.11.txt +++ b/requirements/requirements-test-3.13.txt @@ -1,7 +1,7 @@ -coverage==7.6.9 +coverage==7.6.10 iniconfig==2.0.0 packaging==24.2 pluggy==1.5.0 pytest==8.3.4 pytest-cov==6.0.0 -ruff==0.8.3 +ruff==0.8.6 diff --git a/requirements/requirements-test-3.9.txt b/requirements/requirements-test-3.9.txt deleted file mode 100644 index 767dd6f..0000000 --- a/requirements/requirements-test-3.9.txt +++ /dev/null @@ -1,9 +0,0 @@ -coverage==7.6.9 -exceptiongroup==1.2.2 -iniconfig==2.0.0 -packaging==24.2 -pluggy==1.5.0 -pytest==8.3.4 -pytest-cov==6.0.0 -ruff==0.8.3 -tomli==2.2.1 diff --git a/scripts/freeze.py b/scripts/freeze.py index 2916415..ca5d20e 100755 --- a/scripts/freeze.py +++ b/scripts/freeze.py @@ -46,12 +46,12 @@ def freeze(python_version: str, requirement: Path) -> str: def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument("--python-versions", default="3.9,3.11,3.12") + parser.add_argument("--python-versions", default="3.12,3.13") return parser.parse_args() -def sort_versions(versions: list[str]) -> list[str]: +def sort_versions(versions: str) -> list[str]: def list_of_parts(items): return [int(n) for n in items.split(".")] @@ -74,8 +74,16 @@ def main(): for future in as_completed(futures): print(future.result()) - target_python_version = "3.9" - shutil.copy(repo_root / "requirements" / f"requirements-{target_python_version}.txt", "requirements.txt") + # Put requirements for the main Python version in the repo root for convenience. + target_python_version = "3.12" + requirements_link = repo_root.joinpath("requirements.txt") + # exists() returns False if the symlink is broken. + # The follow_symlinks option was added in Python 3.12. + # Doing it this way for better compatibility for now. + if requirements_link.exists() or requirements_link.is_symlink(): + requirements_link.unlink() + + requirements_link.symlink_to(f"requirements/requirements-{target_python_version}.txt") if __name__ == "__main__": From f3a89610e654979d5c3625997df5fb1414ddf903 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Wed, 8 Jan 2025 16:42:46 -0500 Subject: [PATCH 2/3] Copy the requirements file Using a symlink is a bit too fancy and not as seamless. --- requirements.txt | 38 +++++++++++++++++++++++++++++++++++++- scripts/freeze.py | 9 +-------- 2 files changed, 38 insertions(+), 9 deletions(-) mode change 120000 => 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 120000 index c1c1417..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -requirements/requirements-3.12.txt \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b5241dc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,37 @@ +annotated-types==0.7.0 +anyio==4.7.0 +certifi==2024.12.14 +click==8.1.7 +dnspython==2.7.0 +email_validator==2.2.0 +fastapi==0.115.6 +fastapi-cli==0.0.7 +greenlet==3.1.1 +h11==0.14.0 +httpcore==1.0.7 +httptools==0.6.4 +httpx==0.28.1 +idna==3.10 +Jinja2==3.1.4 +markdown-it-py==3.0.0 +MarkupSafe==3.0.2 +mdurl==0.1.2 +psycopg==3.2.3 +pydantic==2.10.3 +pydantic_core==2.27.1 +Pygments==2.18.0 +python-dotenv==1.0.1 +python-multipart==0.0.20 +PyYAML==6.0.2 +rich==13.9.4 +rich-toolkit==0.12.0 +shellingham==1.5.4 +sniffio==1.3.1 +SQLAlchemy==2.0.36 +starlette==0.41.3 +typer==0.15.1 +typing_extensions==4.12.2 +uvicorn==0.34.0 +uvloop==0.21.0 +watchfiles==1.0.3 +websockets==14.1 diff --git a/scripts/freeze.py b/scripts/freeze.py index ca5d20e..5ab380d 100755 --- a/scripts/freeze.py +++ b/scripts/freeze.py @@ -76,14 +76,7 @@ def main(): # Put requirements for the main Python version in the repo root for convenience. target_python_version = "3.12" - requirements_link = repo_root.joinpath("requirements.txt") - # exists() returns False if the symlink is broken. - # The follow_symlinks option was added in Python 3.12. - # Doing it this way for better compatibility for now. - if requirements_link.exists() or requirements_link.is_symlink(): - requirements_link.unlink() - - requirements_link.symlink_to(f"requirements/requirements-{target_python_version}.txt") + shutil.copy(repo_root / "requirements" / f"requirements-{target_python_version}.txt", "requirements.txt") if __name__ == "__main__": From 9a43c500383dc8feeb074e1f5bea3698210bd796 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Wed, 8 Jan 2025 16:43:40 -0500 Subject: [PATCH 3/3] Update containerfile --- Containerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Containerfile b/Containerfile index fe7e1bc..5252048 100644 --- a/Containerfile +++ b/Containerfile @@ -16,7 +16,7 @@ LABEL version=0.0.1 ENV VENV=/opt/venvs/rhel_roadmap ENV PYTHON="${VENV}/bin/python" ENV PATH="${VENV}/bin:$PATH" -ENV PYTHON_VERSION="3.11" +ENV PYTHON_VERSION="3.12" COPY LICENSE /licenses/Apache-2.0.txt