scikit-hep / pyhepmc

Easy-to-use Python bindings for HepMC3
https://scikit-hep.org/pyhepmc/
BSD 3-Clause "New" or "Revised" License
21 stars 12 forks source link

improved version sourcing #32

Closed HDembinski closed 2 years ago

HDembinski commented 2 years ago

Using :attr: to get the version from pyhepmc/_version.py does not work when the installation fails due to some compilation error, making pyhepmc unimportable. :attr: is supposed to not invoke the Python interpreter to get the version literal, but for some reason this is not working. I suppose this only works when the version is a literal in __init__.py, but it is a literal in pyhepmc/_version.py. Since we cannot get rid of setup.py, because we need this to declare the CMakeExtensions there, we can just as well safely pull the version by execing _version.py from there.