Use typing_extensions

This commit is contained in:
c-bata
2020-10-27 03:12:35 +09:00
parent 796b576644
commit d4e3cd347b
3 changed files with 21 additions and 5 deletions
+5 -2
View File
@@ -25,12 +25,15 @@ jobs:
- run: mypy .
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
- name: Setup Python${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install dependencies
run: pip install --progress-bar off .
+6 -1
View File
@@ -1,9 +1,14 @@
import json
from typing import Any, Dict, List, TypedDict
from typing import Any, Dict, List
from optuna.study import StudySummary
from optuna.trial import FrozenTrial
try:
from typing import TypedDict
except:
from typing_extensions import TypedDict
Attribute = TypedDict(
"Attribute",
+10 -2
View File
@@ -1,6 +1,7 @@
import os
import sys
import types
from typing import List
from setuptools import setup, find_packages
from importlib.machinery import SourceFileLoader
@@ -22,6 +23,13 @@ def get_version() -> int:
return getattr(target_module, "__version__")
def get_install_requires() -> List[str]:
deps = ["optuna", "bottle"]
if sys.version_info[:2] < (3, 8):
deps.append("typing-extensions")
return deps
setup(
name="optuna-dashboard",
version=get_version(),
@@ -32,7 +40,7 @@ setup(
author_email="m.shibata1020@gmail.com",
url="https://github.com/c-bata/optuna-dashboard",
packages=find_packages(),
install_requires=["optuna", "bottle"],
install_requires=get_install_requires(),
extras_require={
"lint": ["black", "flake8", "mypy"],
"release": ["wheel", "twine"],