diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index fc7b29e6..4ff59c6d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -38,7 +38,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install --no-deps -e . + pip install -e . - name: Lint with flake8 run: | diff --git a/recirq/fermi_hubbard/extra-requirements.txt b/recirq/fermi_hubbard/extra-requirements.txt new file mode 100644 index 00000000..3ad045dc --- /dev/null +++ b/recirq/fermi_hubbard/extra-requirements.txt @@ -0,0 +1 @@ +openfermion \ No newline at end of file diff --git a/recirq/hfvqe/extra-requirements.txt b/recirq/hfvqe/extra-requirements.txt new file mode 100644 index 00000000..680ae3c7 --- /dev/null +++ b/recirq/hfvqe/extra-requirements.txt @@ -0,0 +1,3 @@ +# fix bug with openfermionpyscf https://github.com/quantumlib/ReCirq/issues/200#issuecomment-923203883 +h5py~=3.2.1 +openfermion~=1.2.0 diff --git a/recirq/optimize/extra-requirements.txt b/recirq/optimize/extra-requirements.txt new file mode 100644 index 00000000..d5e06028 --- /dev/null +++ b/recirq/optimize/extra-requirements.txt @@ -0,0 +1 @@ +scikit-learn diff --git a/recirq/otoc/extra-requirements.txt b/recirq/otoc/extra-requirements.txt new file mode 100644 index 00000000..e000a66d --- /dev/null +++ b/recirq/otoc/extra-requirements.txt @@ -0,0 +1 @@ +Py-BOBYQA diff --git a/recirq/qaoa/extra-requirements.txt b/recirq/qaoa/extra-requirements.txt new file mode 100644 index 00000000..de9c8413 --- /dev/null +++ b/recirq/qaoa/extra-requirements.txt @@ -0,0 +1 @@ +pytket-cirq~=0.16.0 diff --git a/requirements.txt b/requirements.txt index 7fc8fd16..947c6874 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,25 +7,4 @@ cirq-google~=0.12.0 seaborn sphinx ipython -black - -# optimize -scikit-learn - -# qaoa -networkx -pytket-cirq~=0.16.0 - -# quantum chess, only needed for tests -scipy - -# hfvqe -openfermion~=1.2.0 -# fix bug with openfermionpyscf https://github.com/quantumlib/ReCirq/issues/200#issuecomment-923203883 -h5py~=3.2.1 - -# fermi_hubbard -tqdm # notebook progress bars - -# otoc -Py-BOBYQA +black \ No newline at end of file diff --git a/setup.py b/setup.py index 5e5bbfa5..0a821c01 100644 --- a/setup.py +++ b/setup.py @@ -13,22 +13,41 @@ # limitations under the License. import pathlib +import functools +import operator + from setuptools import find_packages, setup __version__ = '' exec(open('recirq/_version.py').read()) assert __version__, 'Version string cannot be empty' -required_packages = pathlib.Path('requirements.txt').read_text().split('\n') -INSTALL_PACKAGES = [pkg for pkg in required_packages if pkg and not pkg.startswith('#')] + +def _parse_requirements(path: pathlib.Path): + lines = [line.strip() for line in path.read_text().splitlines() if line] + return [line for line in lines if not line.startswith('#')] + + +install_requires = _parse_requirements(pathlib.Path('requirements.txt')) +extras_require = [ + 'otoc', 'qaoa', 'optimize', 'hfvqe', 'fermi_hubbard' +] +extras_require = { + r: _parse_requirements(pathlib.Path(f'recirq/{r}/extra-requirements.txt')) + for r in extras_require +} + +# TODO(gh-231): remove and require users to install via extras_require. +install_requires = functools.reduce(operator.add, extras_require.values(), install_requires) setup(name='recirq', version=__version__, - url='http://github.com/quantumlib/cirq', - author='The Cirq Developers', + url='http://github.com/quantumlib/recirq', + author='Quantum AI team and collaborators', author_email='cirq@googlegroups.com', python_requires='>=3.6.0', - install_requires=INSTALL_PACKAGES, + install_requires=install_requires, + extras_require=extras_require, license='Apache 2', description="", long_description=open('README.md', encoding='utf-8').read(),