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 21541ce

Browse files
Merge pull request #82 from WouterDurnez/master
Update `__init__` to deal with outdated `pkg_resources` package for newer versions of python
2 parents 6b88d11 + 0beffa5 commit 21541ce

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎lambda_local/__init__.py

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

88
from __future__ import print_function
99
import argparse
10-
import pkg_resources
1110

12-
from .main import run
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
1320

14-
__version__=pkg_resources.require("python-lambda-local")[0].version
21+
from .mainimportrun
1522

1623

1724
def main():

0 commit comments

Comments
(0)

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