You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ability to find pythonnet version at runtime / define __version__ #1909
I would like to be able to find out which version of pythonnet is installed in a particular runtime environment from the python side. Most packages define a package.__version__ for that purpose. I couldn't find anything like that in pythonnet.
I'd like to adjust the build process to add a version to pythonnet directly, instead. To read the clr version, you have to have initialised the .NET runtime already.
@amueller Is this really necessary nowadays? Since Python 3.8, there is importlib.metadata.version which will work even when you just do python setup.py build in the local checkout. In the end, I would just use this one to define __version__ as well, just on 3.7 we'd need to fall back to pkg_resources which introduces a runtime dependency on setuptools.
Activity
lostmsu commentedon Sep 15, 2022
As a workaround you could do
lostmsu commentedon Sep 15, 2022
Actually, there's already
clr.__version__filmor commentedon Sep 16, 2022
I'd like to adjust the build process to add a version to
pythonnetdirectly, instead. To read theclrversion, you have to have initialised the .NET runtime already.filmor commentedon Sep 17, 2022
@amueller Is this really necessary nowadays? Since Python 3.8, there is
importlib.metadata.versionwhich will work even when you just dopython setup.py buildin the local checkout. In the end, I would just use this one to define__version__as well, just on 3.7 we'd need to fall back topkg_resourceswhich introduces a runtime dependency onsetuptools.amueller commentedon Sep 19, 2022
I was actually unaware of that. Thank you, that indeed makes it unnecessary.