Skip to content

Commit cd5964b

Browse files
committed
Literal support in config.py
1 parent bae0e44 commit cd5964b

File tree

1 file changed

+6
-1
lines changed
  • {{cookiecutter.project_name}}/app/core

1 file changed

+6
-1
lines changed

{{cookiecutter.project_name}}/app/core/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@
2020
"""
2121

2222
from pathlib import Path
23-
from typing import Dict, List, Literal, Union
23+
from typing import Dict, List, Union
2424

2525
import toml
2626
from pydantic import AnyHttpUrl, AnyUrl, BaseSettings, EmailStr, validator
2727

28+
try:
29+
from typing import Literal
30+
except ImportError:
31+
from typing_extensions import Literal
32+
2833
PROJECT_DIR = Path(__file__).parent.parent.parent
2934
pyproject_content = toml.load(f"{PROJECT_DIR}/pyproject.toml")["tool"]["poetry"]
3035

0 commit comments

Comments
 (0)