Skip to content

Commit

Permalink
Add resource estimates requirements as extras_require. (quantumlib#841)
Browse files Browse the repository at this point in the history
* Add resource estimates requirements as extras_require.

* Update readmes.

* Fix quoutes.

* Move to max line length of 100.

* Add black configuration to pyproject.toml.

* Fix formatting.
  • Loading branch information
fdmalone authored Oct 24, 2023
1 parent ce9dade commit be816c3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
18 changes: 10 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@
import io
import os

from setuptools import setup, find_packages

from setuptools import find_packages, setup

# This reads the __version__ variable from openfermion/_version.py
__version__ = ''
exec(open('src/openfermion/_version.py').read())

# Readme file as long_description:
long_description = ('===========\n' +
'OpenFermion\n' +
'===========\n')
long_description = '===========\n' + 'OpenFermion\n' + '===========\n'
stream = io.open('README.rst', encoding='utf-8')
stream.readline()
long_description += stream.read()
Expand All @@ -31,15 +28,19 @@
requirements = open('dev_tools/requirements/deps/runtime.txt').readlines()
requirements = [r.strip() for r in requirements]
requirements = [r for r in requirements if not r.startswith('#')]
# Resource estimates requirements.
resource_requirements = open('dev_tools/requirements/deps/resource_estimates.txt').readlines()
resource_requirements = [r.strip() for r in resource_requirements]
resource_requirements = [r for r in resource_requirements if not r.startswith('#')]

docs_files_gen = os.walk('docs')
docs_data_files_tuples = []
for cwd, subdirs, files in list(docs_files_gen)[1:]:
if 'ipynb_checkpoints' in cwd:
continue
docs_data_files_tuples.append(
(os.path.join('openfermion',
cwd), [os.path.join(cwd, file) for file in files]))
(os.path.join('openfermion', cwd), [os.path.join(cwd, file) for file in files])
)

setup(
name='openfermion',
Expand All @@ -58,7 +59,8 @@
'': [
os.path.join('src', 'openfermion', 'testing', '*.npy'),
os.path.join('src', 'openfermion', 'testing', '*.hdf5'),
],
]
},
extras_require={'resources': resource_requirements},
data_files=docs_data_files_tuples,
)
7 changes: 2 additions & 5 deletions src/openfermion/resource_estimates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

Code is system tested on Debian GNU/Linux with Python 3.8.5. All the code comes with tests (use `pytest`), but not unit tested with GitHub worflows.

Since the FT costing is closely tied to manipulation of molecular integrals (localization, active space selection, benchmarking against CCSD(T), ...) the code depends on [PySCF](https://pyscf.org/). Since we do not want to burden all OpenFermion users with this dependency, testing is disabled in the GitHub workflow. Moreover, the `resource_estimates` functionality requires the dependencies
Since the FT costing is closely tied to manipulation of molecular integrals (localization, active space selection, benchmarking against CCSD(T), ...) the code depends on [PySCF](https://pyscf.org/) and is not installed by default. To install it do:

```
pyscf
h5py~=3.3.0
jax
jaxlib
pip install openfermion[resources]
```

For THC factorization, it also requires [BTAS](https://github.com/ValeevGroup/BTAS) and the [PyBTAS](https://github.com/ncrubin/pybtas) wrapper, which require their own installation + depends.
Expand Down
11 changes: 5 additions & 6 deletions src/openfermion/resource_estimates/pbc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ Further details are provided in a [tutorial](./notebooks/resource_estimates.ipyn

Similar to the case of molecular resource estimation, we do not wish to burden all OpenFermion users with these dependencies, and testing with GitHub workflows is disabled. Currently we only check if pyscf is available. If it is then pytest will pick up the pbc module and run the tests. Note the tests can be quite slow due to the cost associated with building the integrals.

## Requirements
Requirements can be found in [resource_estimates.txt](../../../../dev_tools/requirements/deps/resource_estimates.txt)
## Installation

The additional requirements required can be installed with openfermion by doing

```
pyscf
jax
jaxlib
ase
pip install openfermion[resources]
```

0 comments on commit be816c3

Please sign in to comment.