Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0beffa5

Browse files
author
wouter.durnez
committed
🩹 Retain compatibility with older
1 parent 9211ae8 commit 0beffa5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎lambda_local/__init__.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@
77

88
from __future__ import print_function
99
import argparse
10-
import importlib.metadata
10+
11+
# Get the version of python-lambda-local
12+
try:
13+
from importlib.metadata import version as get_version
14+
__version__ = get_version("python-lambda-local")
15+
16+
# If importlib.metadata is not available, use pkg_resources (older versions of Python)
17+
except ImportError:
18+
from pkg_resources import require
19+
__version__ = require("python-lambda-local")[0].version
1120

1221
from .main import run
1322

14-
__version__ = importlib.metadata.version("python-lambda-local")
1523

1624
def main():
1725
args = parse_args()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /