Skip to content

Commit

Permalink
DEP: drop support for Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Sep 1, 2024
1 parent 36d0dde commit f07ead4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- macos-latest
- windows-latest
python-version:
- '3.9'
- '3.10'
- '3.12'
free-threading:
- false
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.12'

runs-on: ubuntu-latest
Expand All @@ -86,7 +86,7 @@ jobs:
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.12'

runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Typing :: Typed",
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"inifix>=4.2.2",
"packaging>=21.0",
Expand Down Expand Up @@ -77,7 +77,7 @@ combine-as-imports = true
known-first-party = ["idefix_cli"]

[tool.mypy]
python_version = 3.9
python_version = '3.10'
show_error_codes = true
warn_unused_configs = true
warn_unused_ignores = true
Expand Down
4 changes: 2 additions & 2 deletions src/idefix_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import FunctionType, ModuleType
from typing import Any, Final, Optional
from typing import Any, Final

from idefix_cli import __version__
from idefix_cli._theme import set_theme
Expand Down Expand Up @@ -94,7 +94,7 @@ def _setup_commands(parser: ArgumentParser) -> CommandMap:
f"command plugin {command_name} is missing a module docstring"
)

usage: Optional[str]
usage: str | None
help, _, usage = module.__doc__.strip().partition("\n")
usage = usage or None
sub_parser = sparsers.add_parser(
Expand Down
8 changes: 4 additions & 4 deletions src/idefix_cli/_commands/digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from argparse import ArgumentParser
from pathlib import Path
from time import monotonic_ns
from typing import Any, Optional
from typing import Any

from idefix_cli.lib import print_error

Expand Down Expand Up @@ -84,7 +84,7 @@ def add_arguments(parser: ArgumentParser) -> None:

def command(
dir: str,
input_: Optional[list[str]] = None,
input_: list[str] | None = None,
output=sys.stdout,
all_files: bool = False,
timeit: bool = False,
Expand Down Expand Up @@ -135,13 +135,13 @@ def command(
header = data[0][0] # first line captured from the first log file

if len(data) > 1:
for p, c in zip(log_files[1:], data[1:]):
for p, c in zip(log_files[1:], data[1:], strict=False):
if c[0] != header: # pragma: no cover
print_error(f"header mismatch from {p} and {log_files[0]}")
return 1

final_result: list[str] = []
for p, d in zip(log_files, data):
for p, d in zip(log_files, data, strict=False):
columns = _log_to_data(d)
final_result.append(_data_to_json(p.name, columns))

Expand Down
3 changes: 2 additions & 1 deletion src/idefix_cli/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import re
import sys
import warnings
from collections.abc import Callable
from configparser import ConfigParser
from functools import wraps
from glob import glob
from itertools import chain
from pathlib import Path
from textwrap import indent
from typing import Any, Callable, TypeVar, cast
from typing import Any, TypeVar, cast

from packaging.version import Version
from termcolor import cprint
Expand Down
10 changes: 2 additions & 8 deletions tests/test_ux.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import sys

import pytest
from pytest_check import check

from idefix_cli.__main__ import main

if sys.version_info >= (3, 10):
OPTIONAL_SEC = "options"
else:
OPTIONAL_SEC = "optional arguments"
HELP_MESSAGE = (
"usage: idfx [-h] [-v] {clean,clone,conf,digest,read,run,switch,write} ...\n"
"\n"
f"{OPTIONAL_SEC}:\n"
"options:\n"
" -h, --help show this help message and exit\n"
" -v, --version show program's version number and exit\n"
"\n"
Expand All @@ -32,7 +26,7 @@
def get_lines(help_message: str) -> list[str]:
# skip the first lines because they differ between macos and linux
lines = iter(help_message.splitlines())
while not next(lines).startswith(OPTIONAL_SEC):
while not next(lines).startswith("options:"):
continue

return list(lines)
Expand Down

0 comments on commit f07ead4

Please sign in to comment.