Skip to content

Commit 788fd97

Browse files
committed
feat: implement dynamic __version__
Version is retrieved dynamically from the package after it is built by setup.py. This allows users to access the version of Pynite they have installed without having to manually update the version whenever a new release is made.
1 parent 142633e commit 788fd97

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Pynite/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# Select libraries that will be imported into Pynite for the user
22
from Pynite.FEModel3D import FEModel3D
33
from Pynite.ShearWall import ShearWall
4+
import Pynite
5+
6+
from pip._vendor import pkg_resources
7+
8+
def get_version(package):
9+
package = package.lower()
10+
return next((p.version for p in pkg_resources.working_set if p.project_name.lower() == package), "No match")
11+
12+
__version__= get_version("PyniteFEA")

0 commit comments

Comments
 (0)