Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move requirements into subpackages #230

Merged
merged 3 commits into from
Nov 23, 2021

Conversation

mpharrigan
Copy link
Collaborator

@mpharrigan mpharrigan commented Nov 12, 2021

  • extra-requirements.txt per subpackage
  • Right now: union all the extra requirements into install_requires and add extra_requires for each subpackage (setup.py)
  • Next: modify notebooks to install using e.g. recirq[qaoa]. Remove extra requires from install_requires. This stepwise change is necessary since the notebooks install from github Separate extra requirements for specific experiments #231
  • Next: independent test jobs for subpackages to make sure the requirements are correct.

Annotated change:

# optimize
scikit-learn  # (moved to extra-requires)

# qaoa
networkx   # (transitive from cirq-core)
pytket-cirq~=0.16.0   # (moved to extra-requires)

# quantum chess, only needed for tests
scipy    # (transitive from cirq-core, test requirements shouldn't be here)

# hfvqe
openfermion~=1.2.0    # (moved to extra-requires)
# fix bug with openfermionpyscf https://github.com/quantumlib/ReCirq/issues/200#issuecomment-923203883
h5py~=3.2.1   # (moved to extra-requires)

# fermi_hubbard
tqdm  # notebook progress bars (transitive from cirq-core)

# otoc
Py-BOBYQA   # (moved to extra-requires)

Change-Id: I48b65062fbc2f1aa59749977bce54b5eec23a819
Change-Id: Ie8ab646e3fb2f4d668af7f1d404771a6ead88331
Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine but for two comments.

setup.py Outdated
for r in extras_require
}

# TODO: remove and require users to install via extras_require.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this link to a Github issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, also see #231


install_requires = _parse_requirements(pathlib.Path('requirements.txt'))
extras_require = [
'otoc', 'qaoa', 'optimize', 'hfvqe', 'fermi_hubbard'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good way to auto-detect this (or alternatively, for keeping this up to date if we add more experiments)?

Copy link
Collaborator Author

@mpharrigan mpharrigan Nov 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I first wrote it to glob/regex for extra-requirements.txt and I could set it to that. However: for my next thing I want to add CI jobs that tests each subpackage in isolation. Autogenerating CI jobs would likely be more complicated than its worth. Especially since there will be an isolated "vanilla deps" build that will run all tests not in the named extra-requires subpackages which would fail if newly added experiments did indeed have extra requirements.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, SGTM, I already approved this PR. Feel free to merge when ready.

Change-Id: I1921c0a2e866679a96549aee2d868a1478a24020
@mpharrigan mpharrigan changed the title Move requirements into subpackags Move requirements into subpackages Nov 13, 2021
@mpharrigan mpharrigan merged commit 9f342f7 into quantumlib:master Nov 23, 2021
@mpharrigan mpharrigan deleted the 2021-11-ci-a branch November 30, 2021 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants