Skip to content

Commit

Permalink
Removing Python 3.8 due to end-of-life
Browse files Browse the repository at this point in the history
  • Loading branch information
swansonk14 committed Oct 21, 2024
1 parent 69d2f0a commit fe0d2d8
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@main
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 Jesse Michel and Kyle Swanson
Copyright (c) 2024 Jesse Michel and Kyle Swanson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Running `python square.py --num 2` will print `The square of your number is 4.0.

## Installation

Tap requires Python 3.8+
Tap requires Python 3.9+

To install Tap from PyPI run:

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ dependencies = [
"packaging",
"typing-inspect >= 0.7.1",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
2 changes: 1 addition & 1 deletion src/tap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def enforce_reproducibility(
raise ValueError(f"{no_reproducibility_message}: Uncommitted changes " f"in current args.")


# TODO: remove this once typing_inspect.get_origin is fixed for Python 3.8, 3.9, and 3.10
# TODO: remove this once typing_inspect.get_origin is fixed for Python 3.9 and 3.10
# https://github.com/ilevkivskyi/typing_inspect/issues/64
# https://github.com/ilevkivskyi/typing_inspect/issues/65
def get_origin(tp: Any) -> Any:
Expand Down
3 changes: 0 additions & 3 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def configure(self):
# tried redirecting stderr using unittest.mock.patch
# VersionTap().parse_args(['--version'])

@unittest.skipIf(sys.version_info < (3, 8), 'action="extend" introduced in argparse in Python 3.8')
def test_actions_extend(self):
class ExtendTap(Tap):
arg = [1, 2]
Expand All @@ -185,7 +184,6 @@ def configure(self):
args = ExtendTap().parse_args("--arg a b --arg a --arg c d".split())
self.assertEqual(args.arg, [1, 2] + "a b a c d".split())

@unittest.skipIf(sys.version_info < (3, 8), 'action="extend" introduced in argparse in Python 3.8')
def test_actions_extend_list(self):
class ExtendListTap(Tap):
arg: List = ["hi"]
Expand All @@ -196,7 +194,6 @@ def configure(self):
args = ExtendListTap().parse_args("--arg yo yo --arg yoyo --arg yo yo".split())
self.assertEqual(args.arg, "hi yo yo yoyo yo yo".split())

@unittest.skipIf(sys.version_info < (3, 8), 'action="extend" introduced in argparse in Python 3.8')
def test_actions_extend_list_int(self):
class ExtendListIntTap(Tap):
arg: List[int] = [0]
Expand Down
3 changes: 0 additions & 3 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ def test_both_assigned_okay(self):


class ParameterizedStandardCollectionTests(TestCase):
@unittest.skipIf(
sys.version_info < (3, 9), "Parameterized standard collections (e.g., list[int]) introduced in Python 3.9"
)
def test_parameterized_standard_collection(self):
class ParameterizedStandardCollectionTap(Tap):
arg_list_str: list[str]
Expand Down
3 changes: 0 additions & 3 deletions tests/test_tapify.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,6 @@ def __eq__(self, other: str) -> bool:

self.assertEqual(output, "complex things require 1 0 Person(jesse)")

@unittest.skipIf(
sys.version_info < (3, 9), "Parameterized standard collections (e.g., list[int]) introduced in Python 3.9"
)
def test_tapify_complex_types_parameterized_standard(self):
def concat(complexity: list[int], requires: tuple[int, int], intelligence: Person) -> str:
return f'{" ".join(map(str, complexity))} {requires[0]} {requires[1]} {intelligence}'
Expand Down
10 changes: 3 additions & 7 deletions tests/test_to_tap_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
_IS_PYDANTIC_V1 = Version(pydantic.__version__) < Version("2.0.0")


# To properly test the help message, we need to know how argparse formats it. It changed from 3.8 -> 3.9 -> 3.10 -> 3.13
# To properly test the help message, we need to know how argparse formats it. It changed from 3.9 -> 3.10 -> 3.13
_OPTIONS_TITLE = "options" if not sys.version_info < (3, 10) else "optional arguments"
_ARG_LIST_DOTS = "..." if not sys.version_info < (3, 9) else "[ARG_LIST ...]"
_ARG_LIST_DOTS = "..."
_ARG_WITH_ALIAS = (
"-arg, --argument_with_really_long_name ARGUMENT_WITH_REALLY_LONG_NAME"
if not sys.version_info < (3, 13)
Expand Down Expand Up @@ -472,8 +472,6 @@ def test_subclasser_complex_help_message(class_or_function_: Any):
"--arg_int 1 --baz X --foo b",
SystemExit(
"error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')"
if sys.version_info >= (3, 9)
else "error: invalid choice: 'X' (choose from 'a', 'b')"
),
),
(
Expand All @@ -493,14 +491,12 @@ def test_subclasser_subparser(
_test_subclasser(subclasser_subparser, class_or_function_, args_string_and_arg_to_expected_value, test_call=False)


# @pytest.mark.skipif(sys.version_info < (3, 10), reason="argparse is different. Need to fix help_message_expected")
@pytest.mark.parametrize(
"args_string_and_description_and_expected_message",
[
(
"-h",
"Script description",
# foo help likely missing b/c class nesting. In a demo in a Python 3.8 env, foo help appears in -h
f"""
usage: pytest [--foo] --arg_int ARG_INT [--arg_bool] [--arg_list [ARG_LIST {_ARG_LIST_DOTS}]] [-h]
{{a,b}} ...
Expand All @@ -513,7 +509,7 @@ def test_subclasser_subparser(
b b help
{_OPTIONS_TITLE}:
--foo (bool, default=False) {'' if sys.version_info < (3, 9) else 'foo help'}
--foo (bool, default=False) foo help
--arg_int ARG_INT (int, required) some integer
--arg_bool (bool, default=True)
--arg_list [ARG_LIST {_ARG_LIST_DOTS}]
Expand Down

0 comments on commit fe0d2d8

Please sign in to comment.