Skip to content

Commit 54d9831

Browse files
author
Cosimo Lupo
committed
version.py: add module exporting __version__ from package metadata, as defined by setuptools_scm
This is better than hard-coding the string in the source files. I don't put this in the top-level booleanOperations.__init__ because importing pkg_resources module is relatively expensive and would create an overhead upon importing booleanOperations.
1 parent e9262bd commit 54d9831

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/booleanOperations/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import print_function, division, absolute_import
22
from .booleanOperationManager import BooleanOperationManager
33

4-
__version__ = "0.5.1"
5-
64
# export BooleanOperationManager static methods
75
union = BooleanOperationManager.union
86
difference = BooleanOperationManager.difference

Lib/booleanOperations/version.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
try:
2+
__version__ = __import__('pkg_resources').require('booleanOperations')[0].version
3+
except Exception:
4+
__version__ = 'unknown'

0 commit comments

Comments
 (0)