Skip to content

Commit b3a7a97

Browse files
fix compatibility with Python 3.7 (#38)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d97bd20 commit b3a7a97

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ on:
77
jobs:
88
build:
99
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python_version:
13+
- "3"
14+
- "3.7"
1015
steps:
1116
- uses: actions/checkout@v2
1217
- name: Set up Python
1318
uses: actions/setup-python@v2
1419
with:
15-
python-version: 3
20+
python-version: ${{ matrix.python_version }}
1621
- run: pip install .[test] coverage
1722
- name: Test
1823
run: coverage run --source=./dargs -m unittest -v && coverage report

dargs/dargs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@
2424
from copy import deepcopy
2525
from enum import Enum
2626
from textwrap import indent
27-
from typing import Any, Callable, Dict, Iterable, List, Optional, Union, get_origin
27+
from typing import Any, Callable, Dict, Iterable, List, Optional, Union
28+
29+
try:
30+
from typing import get_origin
31+
except ImportError:
32+
from typing_extensions import get_origin
2833

2934
import typeguard
3035

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ classifiers = [
1717
]
1818
dependencies = [
1919
"typeguard>=3",
20+
'typing_extensions; python_version < "3.8"',
2021
]
2122
requires-python = ">=3.7"
2223
readme = "README.md"

0 commit comments

Comments
 (0)