Skip to content

Switching to pre-releases instead of cirq-unstable #3527

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

Merged
merged 5 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release-master.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release cirq-unstable to PyPi
name: Pre-release cirq to PyPi

on:
push:
Expand All @@ -25,7 +25,7 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
run: |
export CIRQ_UNSTABLE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh)
[[ "$CIRQ_UNSTABLE_VERSION" =~ .*dev.* ]] && echo "Deploying dev version '$CIRQ_UNSTABLE_VERSION'" || (echo "not dev version"; exit 1)
export CIRQ_PRE_RELEASE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh)
[[ "$CIRQ_PRE_RELEASE_VERSION" =~ .*dev.* ]] && echo "Deploying dev version '$CIRQ_PRE_RELEASE_VERSION'" || (echo "not dev version"; exit 1)
python setup.py bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Installation and Documentation

Cirq documentation is available at `cirq.readthedocs.io <https://cirq.readthedocs.io>`_.

Documentation for the latest **unstable** version of cirq (tracks the repository's master branch; what you get if you ``pip install cirq-unstable``), is available at `cirq.readthedocs.io/latest <https://cirq.readthedocs.io/en/latest/>`_.
Documentation for the latest **pre-release** version of cirq (tracks the repository's master branch; what you get if you ``pip install --pre cirq``), is available at `cirq.readthedocs.io/latest <https://cirq.readthedocs.io/en/latest/>`_.

Documentation for the latest **stable** version of cirq (what you get if you ``pip install cirq``) is available at `cirq.readthedocs.io/stable <https://cirq.readthedocs.io/en/stable/>`_.

Expand Down
7 changes: 3 additions & 4 deletions dev_tools/packaging/publish-dev-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
# limitations under the License.

################################################################################
# Produces and uploads dev-version wheels to a pypi package 'cirq-unstable'
# Note that this is not the dev-version for cirq, whose use is deprecated.
# Produces and uploads dev-version wheels to the 'cirq' pypi package
#
# Uploads to the test pypi repository unless the --prod switch is added.
#
Expand Down Expand Up @@ -112,8 +111,8 @@ cd "$(git rev-parse --show-toplevel)"
tmp_package_dir=$(mktemp -d "/tmp/publish-dev-package_package.XXXXXXXXXXXXXXXX")
trap "{ rm -rf ${tmp_package_dir}; }" EXIT

# Configure to push to cirq-unstable and not cirq.
export CIRQ_UNSTABLE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh)
# Configure to push to a pre-release package of cirq.
export CIRQ_PRE_RELEASE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh)

# Produce packages.
dev_tools/packaging/produce-package.sh "${tmp_package_dir}" "${UPLOAD_VERSION}"
Expand Down
20 changes: 10 additions & 10 deletions dev_tools/packaging/verify-published-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

################################################################################
# Downloads and tests cirq wheels from the pypi package repository.
# Can verify prod, test, or unstable versions.
# --unstable: cirq-unstable from prod pypi
# Can verify prod, test, or pre-release versions.
# --pre: pre-release cirq from prod pypi
# --test: cirq from test pypi
# --prod: cirq from prod pypi
#
Expand All @@ -27,7 +27,7 @@
# dependencies disagree, the tests can spuriously fail.
#
# Usage:
# dev_tools/packaging/verify-published-package.sh PACKAGE_VERSION --test|--prod|--unstable
# dev_tools/packaging/verify-published-package.sh PACKAGE_VERSION --test|--prod|--pre
################################################################################

set -e
Expand All @@ -44,19 +44,19 @@ if [ -z "${PROJECT_VERSION}" ]; then
fi

if [ "${PROD_SWITCH}" = "--test" ]; then
PYPI_REPOSITORY_FLAG="--index-url=https://test.pypi.org/simple/"
PIP_FLAGS="--index-url=https://test.pypi.org/simple/"
PYPI_REPO_NAME="TEST"
PYPI_PROJECT_NAME="cirq"
elif [ "${PROD_SWITCH}" = "--prod" ]; then
PYPI_REPOSITORY_FLAG=''
PIP_FLAGS=''
PYPI_REPO_NAME="PROD"
PYPI_PROJECT_NAME="cirq"
elif [ "${PROD_SWITCH}" = "--unstable" ]; then
PYPI_REPOSITORY_FLAG=''
elif [ "${PROD_SWITCH}" = "--pre" ]; then
PIP_FLAGS='--pre'
PYPI_REPO_NAME="PROD"
PYPI_PROJECT_NAME="cirq-unstable"
PYPI_PROJECT_NAME="cirq"
else
echo -e "\033[31mSecond argument must be '--prod' or '--test' or '--unstable'.\033[0m"
echo -e "\033[31mSecond argument must be '--prod' or '--test' or '--pre'.\033[0m"
exit 1
fi

Expand Down Expand Up @@ -85,7 +85,7 @@ for PYTHON_VERSION in python3; do
"${tmp_dir}/${PYTHON_VERSION}/bin/pip" install --quiet -r "${RUNTIME_DEPS_FILE}"
fi
echo Installing "${PYPI_PROJECT_NAME}==${PROJECT_VERSION} from ${PYPI_REPO_NAME} pypi"
"${tmp_dir}/${PYTHON_VERSION}/bin/pip" install --quiet ${PYPI_REPOSITORY_FLAG} "${PYPI_PROJECT_NAME}==${PROJECT_VERSION}"
"${tmp_dir}/${PYTHON_VERSION}/bin/pip" install --quiet ${PIP_FLAGS} "${PYPI_PROJECT_NAME}==${PROJECT_VERSION}"

# Check that code runs without dev deps.
echo Checking that code executes
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/google/colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"\n",
"For details of authentication and installation, please see [go/quantum-engine-quickstart](http://go/quantum-engine-quickstart). \n",
"\n",
"Note: The below code will install the latest stable release of cirq. If you need the latest and greatest features and don't mind if a few things aren't quite working correctly, you can install `cirq-unstable` instead of `cirq` to get the most up-to-date features of cirq.\n",
"Note: The below code will install the latest stable release of cirq. If you need the latest and greatest features and don't mind if a few things aren't quite working correctly, you can install the pre-release version of `cirq` using `pip install --pre cirq` instead of `pip install cirq` to get the most up-to-date features of cirq.\n",
"\n",
"1. Enter the Cloud project ID you'd like to use in the `project_id` field.\n",
"2. Then run the cell below (and go through the auth flow for access to the project id you entered).\n",
Expand Down
2 changes: 1 addition & 1 deletion release.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ themselves are created. Note that development is done on the `master`
branch, so if you want to use a more stable version you should use one
of the [releases](https://github.com/quantumlib/Cirq/releases) or
install from pypi using `pip install cirq`. The release from the
latest commit to master can be installed with `pip install cirq-unstable`.
latest commit to master can be installed with `pip install --pre cirq`.

## Versioning

Expand Down
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
# README file as long_description.
long_description = io.open('README.rst', encoding='utf-8').read()

# If CIRQ_UNSTABLE_VERSION is set then we use cirq-unstable as the name of the package
# and update the version to this value.
if 'CIRQ_UNSTABLE_VERSION' in os.environ:
name = 'cirq-unstable'
__version__ = os.environ['CIRQ_UNSTABLE_VERSION']
# If CIRQ_PRE_RELEASE_VERSION is set then we update the version to this value.
# It is assumed that it ends with one of `.devN`, `.aN`, `.bN`, `.rcN` and hence
# it will be a pre-release version on PyPi. See
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#pre-release-versioning
# for more details.
if 'CIRQ_PRE_RELEASE_VERSION' in os.environ:
__version__ = os.environ['CIRQ_PRE_RELEASE_VERSION']
long_description = (
"**This is a development version of Cirq and may be "
"unstable.**\n\n**For the latest stable release of Cirq "
Expand Down