Python module compilation
Our Python abilities are realized in two parts: Boost Python wrapping of C++ code and Python source code for operator overloading. The Boost Python module is compiled in the objdir while the Python source code stays in the srcdir. This makes testing and using it a hassle.
Modify CMakeLists.txt to copy the Python source code to the objdir for easy testing.
Commit fd06d66c581c6d7217def2149a31bd42958542a5 enables installation of the various Python bits to the lib directory.
How about installing pyambit to the usual python modules location– site-packages? That's what CheMPS2 does, and I've started installing psi4 plugins there. I can see that this scheme works better in a virtualenv/conda environment whereas the "lib" installation is better with generic python, but it'd be nice if the site-packages installation was a cmake option rather than me patching your cmake.
Also, is there a quick python script test of pyambit? I'd rather not install compiled tests.
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index 3bd7cb8..b148eb0 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -23,6 +23,6 @@ target_link_libraries(pyambit ambit ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${Boos
set_target_properties(pyambit PROPERTIES PREFIX "")
set_target_properties(pyambit PROPERTIES SUFFIX ${PYTHON_MODULE_EXTENSION})
-install(TARGETS pyambit DESTINATION lib/ambit)
+install(TARGETS pyambit DESTINATION ${PYTHON_SITE_PACKAGES}/ambit)
endif()
Sounds good to me.
There should be test_*.py in the lib directory that can test the Python side of things.
Aha, found them, thanks. I had been looking in tests and near the python code.
On the site-packages, very good, I'll do a PR once everything's working w/Psi4.