Skip to content

Commit

Permalink
feat: Drop support for Python 3.8 and add support for Python 3.12 (#153)
Browse files Browse the repository at this point in the history
BREAKING CHANGE for users of Python 3.8, please update to the latest version of Python (3.12)
  • Loading branch information
Carlos Lubbers authored Nov 14, 2023
1 parent 781a9cc commit 2e2f298
Show file tree
Hide file tree
Showing 5 changed files with 790 additions and 741 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/CI-Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
python-version: ["3.12"]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.0
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v4.7.1
with:
python-version: ${{ matrix.python-version }}

- name: Run image
uses: abatilo/actions-poetry@v2.2.0
uses: abatilo/actions-poetry@v2.3.0
with:
poetry-version: 1.2.2
poetry-version: 1.6.1
- name: Cache Poetry virtualenv
uses: actions/cache@v3
id: cache
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.9, "3.10", "3.11", "3.12"]
os: [ubuntu-22.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.0
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v4.7.1
with:
python-version: ${{ matrix.python-version }}

- name: Run image
uses: abatilo/actions-poetry@v2.2.0
uses: abatilo/actions-poetry@v2.3.0
with:
poetry-version: 1.2.2
poetry-version: 1.6.1
- name: Cache Poetry virtualenv
uses: actions/cache@v3
id: cache
Expand Down
28 changes: 2 additions & 26 deletions geolib/models/utils.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
# FROM https://github.com/python/cpython/blob/6292be7adf247589bbf03524f8883cb4cb61f3e9/Lib/typing.py
import collections
import sys
from typing import Dict, List, Tuple, Type, _GenericAlias, _SpecialForm, get_type_hints

if sys.version_info < (3, 9):
# Python 3.9 does not include `_special`, so use the function from typing instead

def get_args(tp):
"""Get type arguments with all substitutions performed.
For unions, basic simplifications used by Union constructor are performed.
Examples:
get_args(Dict[str, int]) == (str, int)
get_args(int) == ()
get_args(Union[int, Union[T, int], str][int]) == (int, str)
get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
get_args(Callable[[], T][int]) == ([], int)
"""
if isinstance(tp, (_GenericAlias, _SpecialForm)) and not tp._special:
res = tp.__args__
if tp.__origin__ is collections.abc.Callable and res[0] is not Ellipsis:
res = (list(res[:-1]), res[-1])
return res
return ()

else:
from typing import get_args as get_args # NOQA
from typing import List, Tuple, Type, _GenericAlias, get_type_hints
from typing import get_args as get_args


def unpack_if_union(tp):
Expand Down
Loading

0 comments on commit 2e2f298

Please sign in to comment.