Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for python 3.8 and 3.9 #522

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12

- name: Install dependencies
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']

runs-on: ubuntu-latest

Expand All @@ -32,7 +32,7 @@ jobs:

- name: Setup Komodo
run: |
pip install -U pip wheel setuptools
pip install -U pip
pip install ".[dev]"

- name: Unit tests
Expand All @@ -48,13 +48,13 @@ jobs:
run: |
komodo-transpiler transpile \
--matrix-file="ci/${{env.RELEASE_NAME}}.yml" \
--output ci --matrix-coordinates "{rhel: ['7'], py: ['${{matrix.python-version}}']}"
--output ci --matrix-coordinates "{rhel: ['8'], py: ['${{matrix.python-version}}']}"

- name: Full integration test
run: |
py_version_number=$(echo "${{ matrix.python-version }}" | sed 's/\.//g')
kmd \
ci/${{env.RELEASE_NAME}}-py$py_version_number-rhel7.yml \
ci/${{env.RELEASE_NAME}}-py$py_version_number-rhel8.yml \
ci/${{env.REPOSITORY}} \
--workspace ${{ runner.temp }}/kmd-ws \
--prefix ${{ runner.temp }}/prefix \
Expand Down
7 changes: 3 additions & 4 deletions ci/release-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
numpy:
py38: 1.23.5
py39: 1.23.5
py310: 1.23.5
py311: 1.23.5
py312: 1.26.4
py313: 2.2.0
python: 3-builtin
setuptools: 69.0.3
wheel: 0.42.0
setuptools: 75.6.0
wheel: 0.45.1
8 changes: 6 additions & 2 deletions ci/repository.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
numpy:
2.2.0:
source: pypi
make: pip
maintainer: ci
1.26.4:
source: pypi
make: pip
Expand All @@ -16,13 +20,13 @@ python:
makeopts: --virtualenv-interpreter python3

setuptools:
69.0.3:
75.6.0:
source: pypi
make: pip
maintainer: ci

wheel:
0.42.0:
0.45.1:
source: pypi
make: pip
maintainer: ci
5 changes: 2 additions & 3 deletions komodo/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re
import stat
from pathlib import Path
from typing import Dict

import requests

Expand Down Expand Up @@ -184,7 +183,7 @@ def pypaths(prefix, version):


def make(
pkgs: Dict[str, str],
pkgs: dict[str, str],
repo,
data,
prefix,
Expand Down Expand Up @@ -228,7 +227,7 @@ def make(
def resolve(input_str):
return input_str.replace("$(prefix)", prefix)

for package_name, path in zip(pkgorder, pkgpaths):
for package_name, path in zip(pkgorder, pkgpaths, strict=False):
ver = pkgs[package_name]
current = repo[package_name][ver]
make = current["make"]
Expand Down
3 changes: 1 addition & 2 deletions komodo/check_unused_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import argparse
import os
import sys
from typing import Dict

import yaml

Expand All @@ -16,7 +15,7 @@ def check_for_unused_package(
release_file: ReleaseFile,
package_status_file: str,
repository: RepositoryFile,
builtin_python_versions: Dict[str, str],
builtin_python_versions: dict[str, str],
):
package_status = load_yaml(package_status_file)
public_and_plugin_packages = [
Expand Down
5 changes: 2 additions & 3 deletions komodo/check_up_to_date_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pathlib
import re
import sys
from typing import Dict, List

import requests
import ruamel.yaml
Expand Down Expand Up @@ -57,7 +56,7 @@ def get_python_requirement(sources: list):
return ""


def is_platform_compatible(build_info: List[Dict], platform: str) -> bool:
def is_platform_compatible(build_info: list[dict], platform: str) -> bool:
if platform == "darwin":
platform = "macos"
if platform == "linux2":
Expand All @@ -73,7 +72,7 @@ def is_platform_compatible(build_info: List[Dict], platform: str) -> bool:

def compatible_versions(
releases: dict, python_version, platform: str
) -> List[get_version.Version]:
) -> list[get_version.Version]:
compatible_versions = []
for version_str, build_info in releases.items():
try:
Expand Down
3 changes: 1 addition & 2 deletions komodo/cleanup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/env python

import sys
from typing import List

from komodo.yaml_file_types import ReleaseFile, RepositoryFile


def cleanup(repository_file_path: str, release_files_path: List[str]):
def cleanup(repository_file_path: str, release_files_path: list[str]):
repository_file = RepositoryFile()(repository_file_path)
repository = repository_file.content

Expand Down
29 changes: 15 additions & 14 deletions komodo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import os
import sys
import uuid
from collections.abc import Callable, Mapping, Sequence
from pathlib import Path
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, Union
from typing import Any

import jinja2
from ruamel.yaml import YAML
Expand Down Expand Up @@ -40,7 +41,7 @@ class KomodoNamespace(argparse.Namespace):
cmake: str
pip: str
workspace: str
extra_data_dirs: List[str]
extra_data_dirs: list[str]
postinst: str


Expand Down Expand Up @@ -88,7 +89,7 @@ def create_enable_scripts(komodo_prefix: str, komodo_release: str) -> None:


def _print_timing(
timing_element: Tuple[str, datetime.timedelta],
timing_element: tuple[str, datetime.timedelta],
adjust: bool = False,
) -> None:
if adjust:
Expand Down Expand Up @@ -125,10 +126,10 @@ def is_download_only(args: KomodoNamespace) -> bool:
@profile_time("Fetching all packages")
def download_packages(
release_file_content: Mapping[str, str],
repository_file_content: Mapping[str, Mapping[str, Union[str, Sequence[str]]]],
repository_file_content: Mapping[str, Mapping[str, str | Sequence[str]]],
download_destination: str,
pip_executable: str = "pip",
) -> Dict[str, str]:
) -> dict[str, str]:
"""Downloads all PyPI packages to destination. Tries to download other
packages to destination too.
Git packages are collected, and a dict of all git hashes is returned.
Expand Down Expand Up @@ -205,14 +206,14 @@ def generate_release_root(release_path: Path) -> Path:
def generate_release_manifest(
release_name: Path,
release_file_content: Mapping[str, str],
repository_file_content: Mapping[str, Mapping[str, Union[str, Sequence[str]]]],
git_hashes: Optional[Mapping[str, str]] = None,
repository_file_content: Mapping[str, Mapping[str, str | Sequence[str]]],
git_hashes: Mapping[str, str] | None = None,
) -> None:
releasedoc = Path(release_name) / Path(release_name)
with open(releasedoc, mode="w", encoding="utf-8") as filehandle:
release: Dict[str, Dict[str, str]] = {}
release: dict[str, dict[str, str]] = {}
for package, version in release_file_content.items():
entry: Dict[str, str] = repository_file_content[package][version]
entry: dict[str, str] = repository_file_content[package][version]
maintainer = repository_file_content[package][version]["maintainer"]
if entry.get("fetch") == "git":
version = git_hashes[package]
Expand Down Expand Up @@ -250,7 +251,7 @@ def delete_old_previously_moved_releases(prefix_path: Path, release_name: Path)
)


def apply_fallback_tmpdir_for_pip_if_set(tmp_dir: Optional[str] = None):
def apply_fallback_tmpdir_for_pip_if_set(tmp_dir: str | None = None):
"""Allows e.g. pip to use this folder as a destination for "pip
download", instead of in some cases falling back to /tmp, which is
undesired when building on nfs.
Expand All @@ -265,7 +266,7 @@ def apply_fallback_tmpdir_for_pip_if_set(tmp_dir: Optional[str] = None):
@profile_time("pip install to final destination")
def install_previously_downloaded_pip_packages(
release_file_content: Mapping[str, str],
repository_file_content: Mapping[str, Mapping[str, Union[str, Sequence[str]]]],
repository_file_content: Mapping[str, Mapping[str, str | Sequence[str]]],
downloads_directory: str,
pip_executable: str,
release_root: Path,
Expand Down Expand Up @@ -295,7 +296,7 @@ def install_previously_downloaded_pip_packages(


def run_post_installation_scripts_if_set(
postinst: Optional[str], release_path: Path
postinst: str | None, release_path: Path
) -> None:
if postinst:
timing_func = profile_time("Running post-install scripts")
Expand Down Expand Up @@ -328,7 +329,7 @@ def compile_python_bytecode_files_and_fix_permissions(
compile_python_bytecode_files(release_root)


timings: List[Tuple[str, datetime.timedelta]] = []
timings: list[tuple[str, datetime.timedelta]] = []


def _main(args: KomodoNamespace) -> None:
Expand Down Expand Up @@ -416,7 +417,7 @@ def cli_main():
_main(args)


def parse_args(args: List[str]) -> KomodoNamespace:
def parse_args(args: list[str]) -> KomodoNamespace:
"""Parse the arguments from the command line into an `argparse.Namespace`.
Having a separated function makes it easier to test the CLI.

Expand Down
7 changes: 3 additions & 4 deletions komodo/deployed.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import argparse
import json
import os
from typing import List, Optional

from komodo.matrix import get_matrix_base
from komodo.yaml_file_types import ReleaseDir
Expand Down Expand Up @@ -35,13 +34,13 @@ def _fetch_non_deployed_releases(install_root, release_folder):
def fetch_non_deployed(
install_root: str,
releases_folder: str,
limit: Optional[int] = None,
) -> List[str]:
limit: int | None = None,
) -> list[str]:
non_deployed = _fetch_non_deployed_releases(install_root, releases_folder)
return non_deployed[:limit]


def output_formatter(release_list: List[str], do_json: bool = False) -> str:
def output_formatter(release_list: list[str], do_json: bool = False) -> str:
if do_json:
return json.dumps(release_list, separators=(",", ":"))
return "\n".join(release_list)
Expand Down
18 changes: 9 additions & 9 deletions komodo/insert_proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import difflib
import os
from base64 import b64decode
from collections.abc import Mapping, MutableSet
from datetime import datetime
from typing import Dict, Mapping, MutableSet, Optional, Union

import github
from github import Github, UnknownObjectException
Expand All @@ -21,8 +21,8 @@


def recursive_update(
to_be_upgraded: Mapping[str, Union[str, Mapping[str, str]]],
upgrades: Optional[Mapping[str, Union[str, Mapping[str, str]]]],
to_be_upgraded: Mapping[str, str | Mapping[str, str]],
upgrades: Mapping[str, str | Mapping[str, str]] | None,
) -> None:
"""Updates release in place with upgrades/additions of packages from upgrades.

Expand Down Expand Up @@ -115,7 +115,7 @@ def get_upgrade_key(target: str) -> str:


def validate_upgrades(
upgrade_section: Dict[str, str], repofile: RepositoryFile
upgrade_section: dict[str, str], repofile: RepositoryFile
) -> None:
errors = set()
for package_name, package_version in upgrade_section.items():
Expand All @@ -128,7 +128,7 @@ def validate_upgrades(

def recursive_validate_package_entries(
package_name,
package_version_or_matrix: Union[str, Mapping, None],
package_version_or_matrix: str | Mapping | None,
repository_file: RepositoryFile,
errors: MutableSet,
) -> None:
Expand All @@ -151,7 +151,7 @@ def recursive_validate_package_entries(
def generate_contents_of_new_release_matrix(
base_release_matrix_content: Mapping,
repofile: RepositoryFile,
upgrade: Optional[Dict],
upgrade: dict | None,
) -> str:
if upgrade:
validate_upgrades(upgrade, repofile)
Expand Down Expand Up @@ -207,7 +207,7 @@ def create_pr_with_changes(
tmp_target: str,
tmp_ref: GitRef,
pr_msg: str,
rhel8: Optional[bool] = False,
rhel8: bool | None = False,
):
commit_title = (
f"Add release {target} (+rhel8)" if rhel8 else f"Add release {target}"
Expand Down Expand Up @@ -258,7 +258,7 @@ def insert_proposals(
git_ref: str,
jobname: str,
joburl: str,
rhel8: Optional[bool] = False,
rhel8: bool | None = False,
) -> None:
tmp_target = target + ".tmp"

Expand All @@ -274,7 +274,7 @@ def insert_proposals(
base_file = f"releases/matrices/{base}.yml"
release_file_yaml_string = load_yaml_from_repo(base_file, repo, git_ref)
release_matrix_file = ReleaseMatrixFile.from_yaml_string(release_file_yaml_string)
upgrade: Dict[str, str] = proposal_file.content.get(upgrade_key)
upgrade: dict[str, str] = proposal_file.content.get(upgrade_key)

repofile_yaml_string = load_yaml_from_repo("repository.yml", repo, git_ref)
repofile = RepositoryFile().from_yaml_string(repofile_yaml_string)
Expand Down
5 changes: 2 additions & 3 deletions komodo/lint_maturity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import argparse
import os
import warnings
from typing import List

import yaml
from packaging.version import InvalidVersion, Version
Expand Down Expand Up @@ -126,7 +125,7 @@ def get_release_version(release_basename, tag_exceptions_release):
return release_version


def run(files_to_lint: List[str], tag_exceptions):
def run(files_to_lint: list[str], tag_exceptions):
system_exit_msg = ""
system_warning_msg = ""

Expand Down Expand Up @@ -181,7 +180,7 @@ def read_yaml_file_and_convert_to_release_file(release_file_path: str) -> Releas
return ReleaseFile().from_yaml_string(value=release_file_yaml_string)


def get_files_to_lint(release_folder: str, release_file: str) -> List[str]:
def get_files_to_lint(release_folder: str, release_file: str) -> list[str]:
if release_folder is None:
files_to_lint = [release_file]
else:
Expand Down
Loading
Loading