Closed maffoo closed 7 years ago
@maffoo Where do you suggest we have the default directory for the user's chemistry data? Basically, when FermiLib runs electronic structure calculations it stores them in a default location that is the first place the code looks when trying to load them. Right now the directory is data, which is in the FermiLib root directory. Should we keep that folder in this location? When I run the precommit tests right now it breaks because the file structure changes broke the code that points to the data directory.
I would suggest having the code create a folder in the user's home directory to store data like this, for example it could go in ~/.fermilib/data
(os.path.join(os.path.expanduser('~'), '.fermilib', 'data')
). We should avoid putting this in the same location as the source code itself because often when installed the code will be in a site packages directory that is only writeable by root. This location could be configurable to allow people to store such data somewhere else if they want to (though note that the existing config system will probably need to change for the same reason: it won't generally be possible, or at least not easy, to edit a config.py
file in the fermilib package after it has been installed).
This moves the code into the
src/fermilib
directory. To use the package from src, you'll need to add thesrc/
directory to your python path (or virtualenv). I also fixed up the imports to work now that all the modules are part of thefermilib
package from python's perspective. I added adirective to ensure that import behavior is consistent between python 2 and python 3. Also, I rearranged imports by grouping imports from the standard library, then 3rd party libraries, and finally fermilib. I also had to move a few imports to break some circular dependencies, in particular in places where different operator types can interconvert (e.g. fermion_operators <-> qubit_operators). In these cases, I moved the relevant imports into the conversion functions themselves.
Fixes #26