NESTCollaboration / nestpy

Raw Python bindings to the NEST library using pybind11.
GNU General Public License v3.0
13 stars 19 forks source link

Remove warning on import + restart github tests #96

Closed JoranAngevaare closed 1 year ago

JoranAngevaare commented 1 year ago

Remove warning on import + restart github tests

As the title states, we add two small fixes/patches:

Remove warning on import

Remove print on import. The print comes all the way from this class - which I think is great to have when you are actually using this function - but otherwise doesn't make sense.

Do this by caching the NestCalc object only when the function is called (with the default arguments).

Before

Run python -c "import nestpy; print(nestpy); print('bye bye')"
*** Detector definition message ***
You are currently using the default XENON10 template detector.

<module 'nestpy' from '/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/nestpy/__init__.py'>
bye bye

After

Run python -c "import nestpy; print(nestpy); print('bye bye')"
<module 'nestpy' from '/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/site-packages/nestpy/__init__.py'>
bye bye

Reactivate testing

Seems like testing was disabled in https://github.com/NESTCollaboration/nestpy/pull/93

Looking at some of the changes made there it looks like a different route was chosen than the testing suite provided by the setup.py, fine by me - probably would be good to disable that route altogether to avoid confusion.

Just to test that the desired behavior is re-established, I committed 7961b7e.