-
Notifications
You must be signed in to change notification settings - Fork 117
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
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
openfermion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scikit-learn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Py-BOBYQA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytket-cirq~=0.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: remove and require users to install via extras_require. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this link to a Github issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done, also see #231 |
||
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(), | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.