Skip to content

Commit 82e570c

Browse files
committed
Wrapping __version__ in try/catch block
Because you may be developing on the project without having installed it just yet.
1 parent 52ca998 commit 82e570c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mrmat_python_api_flask/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@
3434
from flask_marshmallow import Marshmallow
3535
from flask_oidc import OpenIDConnect
3636

37-
__version__ = importlib.metadata.version('mrmat-python-api-flask')
37+
try:
38+
__version__ = importlib.metadata.version('mrmat-python-api-flask')
39+
except importlib.metadata.PackageNotFoundError:
40+
# You have not explicitly installed the package just yet
41+
__version__ = 'UNKNOWN'
42+
3843
db = SQLAlchemy()
3944
ma = Marshmallow()
4045
migrate = Migrate()

0 commit comments

Comments
 (0)