summaryrefslogtreecommitdiff
path: root/git/compat/typing.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-04-21 10:03:11 +0200
committerMichał Górny <mgorny@gentoo.org>2021-04-23 16:19:19 +0200
commitf8e223263c73a7516e2b216a546079e9a144b3a5 (patch)
treef7226e621a621b3df1de4fdebb17f3e4421e660d /git/compat/typing.py
parent4119a576251448793c07ebd080534948cad2f170 (diff)
downloadgitpython-f8e223263c73a7516e2b216a546079e9a144b3a5.tar.gz
Use typing-extensions only on Python < 3.8
All necessary attributes are available in the built-in typing module since Python 3.8. Use typing-extensions only for older versions of Python, and avoid the unnecessary dep in 3.8+.
Diffstat (limited to 'git/compat/typing.py')
-rw-r--r--git/compat/typing.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/git/compat/typing.py b/git/compat/typing.py
new file mode 100644
index 00000000..4bab4cdd
--- /dev/null
+++ b/git/compat/typing.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+# config.py
+# Copyright (C) 2021 Michael Trier (mtrier@gmail.com) and contributors
+#
+# This module is part of GitPython and is released under
+# the BSD License: http://www.opensource.org/licenses/bsd-license.php
+
+import sys
+
+if sys.version_info[:2] >= (3, 8):
+ from typing import Final, Literal
+else:
+ from typing_extensions import Final, Literal