forked from quantumlib/Cirq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix extras_require for the cirq metapackage setup.py (quantumlib#4246)
The tensorflow-docs requirement was in the wrong format (worked for pip install but not for extras_require). It also adds testing to avoid these kind of failures: `dev_tools/packaging/packaging_test.sh` is now executed as part of the CI test suite. Fixes quantumlib#4222.
- Loading branch information
Showing
9 changed files
with
98 additions
and
12 deletions.
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
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
include requirements.txt | ||
include LICENSE |
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
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,57 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2021 The Cirq Developers | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
################################################################################ | ||
# This script tests packaging. It creates the packages for all the cirq modules | ||
# `pip install`s them in a clean virtual environment and then runs some simple | ||
# verificiations on each of the modules, ensuring that they can be imported. | ||
################################################################################ | ||
|
||
set -e | ||
|
||
# Temporary workspace. | ||
tmp_dir=$(mktemp -d) | ||
trap "{ rm -rf ${tmp_dir}; }" EXIT | ||
|
||
# New virtual environment | ||
echo "Working in a fresh virtualenv at ${tmp_dir}/env" | ||
virtualenv --quiet "--python=/usr/bin/python3" "${tmp_dir}/env" | ||
|
||
export CIRQ_PRE_RELEASE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh) | ||
out_dir=${tmp_dir}/dist | ||
dev_tools/packaging/produce-package.sh ${out_dir} $CIRQ_PRE_RELEASE_VERSION | ||
|
||
# test installation | ||
"${tmp_dir}/env/bin/python" -m pip install ${out_dir}/* | ||
|
||
echo =========================== | ||
echo Testing that code executes | ||
echo =========================== | ||
|
||
"${tmp_dir}/env/bin/python" -c "import cirq; print(cirq.google.Foxtail)" | ||
"${tmp_dir}/env/bin/python" -c "import cirq_google; print(cirq_google.Foxtail)" | ||
"${tmp_dir}/env/bin/python" -c "import cirq; print(cirq.Circuit(cirq.CZ(*cirq.LineQubit.range(2))))" | ||
|
||
echo ======================================= | ||
echo Testing that all modules are installed | ||
echo ======================================= | ||
|
||
CIRQ_PACKAGES=$(env PYTHONPATH=. python dev_tools/modules.py list --mode package) | ||
for p in $CIRQ_PACKAGES; do | ||
echo --- Testing $p ----- | ||
python_test="import $p; print($p); assert '${tmp_dir}' in $p.__file__, 'Package path seems invalid.'" | ||
env PYTHONPATH='' "${tmp_dir}/env/bin/python" -c "$python_test" && echo -e "\033[32mPASS\033[0m" || echo -e "\033[31mFAIL\033[0m" | ||
done |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# for testing packaging in isolation | ||
virtualenv | ||
|
||
# for creating packages | ||
setuptools | ||
wheel | ||
|
||
# for uploading packages to pypi | ||
twine |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# don't upgrade this just yet, anything later will require protobuf>=3.14 | ||
git+https://github.com/tensorflow/docs@a90bcd30eb550f8d4ee335ff3daf18de5ca84b70 | ||
tensorflow-docs@git+https://github.com/tensorflow/docs@a90bcd30eb550f8d4ee335ff3daf18de5ca84b70 |
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 |
---|---|---|
|
@@ -62,7 +62,7 @@ | |
url='http://github.com/quantumlib/cirq', | ||
author='The Cirq Developers', | ||
author_email='[email protected]', | ||
python_requires=('>=3.6.0'), | ||
python_requires='>=3.6.0', | ||
install_requires=requirements, | ||
extras_require={ | ||
'dev_env': dev_requirements, | ||
|