Skip to content

Commit

Permalink
Dropping support for Python 3.7 and moving Literal from typing_extens…
Browse files Browse the repository at this point in the history
…ions to typing
  • Loading branch information
swansonk14 committed Jun 28, 2023
1 parent d26f0b8 commit c48ef74
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 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.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@main
Expand Down
4 changes: 2 additions & 2 deletions 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.7+
Tap requires Python 3.8+

To install Tap from PyPI run:
```
Expand Down Expand Up @@ -281,7 +281,7 @@ Tuples can be used to specify a fixed number of arguments with specified types u

#### `Literal`

Literal is analagous to argparse's [choices](https://docs.python.org/3/library/argparse.html#choices), which specifies the values that an argument can take. For example, if arg can only be one of 'H', 1, False, or 1.0078 then you would specify that `arg: Literal['H', 1, False, 1.0078]`. For instance, `--arg False` assigns arg to False and `--arg True` throws error. The `Literal` type was introduced in Python 3.8 ([PEP 586](https://www.python.org/dev/peps/pep-0586/)) and can be imported with `from typing_extensions import Literal`.
Literal is analagous to argparse's [choices](https://docs.python.org/3/library/argparse.html#choices), which specifies the values that an argument can take. For example, if arg can only be one of 'H', 1, False, or 1.0078 then you would specify that `arg: Literal['H', 1, False, 1.0078]`. For instance, `--arg False` assigns arg to False and `--arg True` throws error.

#### `Union`

Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@
packages=find_packages(),
package_data={'tap': ['py.typed']},
install_requires=[
'typing_extensions >= 3.7.4',
'typing-inspect >= 0.7.1',
'docstring-parser >= 0.15'
],
tests_require=['pytest'],
python_requires='>=3.7',
python_requires='>=3.8',
classifiers=[
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
Expand Down
2 changes: 1 addition & 1 deletion tap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
Generator,
Iterator,
List,
Literal,
Optional,
Tuple,
Union,
)
from typing_extensions import Literal
from typing_inspect import get_args as typing_inspect_get_args, get_origin as typing_inspect_get_origin

if sys.version_info >= (3, 10):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
from typing import List
from typing_extensions import Literal
from typing import List, Literal
import unittest
from unittest import TestCase

Expand Down
3 changes: 1 addition & 2 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import pickle
import sys
from tempfile import TemporaryDirectory
from typing import Any, Iterable, List, Optional, Set, Tuple, Union
from typing_extensions import Literal
from typing import Any, Iterable, List, Literal, Optional, Set, Tuple, Union
import unittest
from unittest import TestCase

Expand Down
3 changes: 1 addition & 2 deletions tests/test_subparser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from argparse import ArgumentError
import sys
from typing import Union
from typing_extensions import Literal
from typing import Literal, Union
import unittest
from unittest import TestCase

Expand Down
3 changes: 1 addition & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import os
import subprocess
from tempfile import TemporaryDirectory
from typing import Any, Callable, List, Dict, Set, Tuple, Union
from typing import Any, Callable, List, Literal, Dict, Set, Tuple, Union
import unittest
from unittest import TestCase
from typing_extensions import Literal

from tap.utils import (
get_class_column,
Expand Down

0 comments on commit c48ef74

Please sign in to comment.