From e2a96b6b1204695b1ce063a328f2fd62b44f31d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Pat=C3=B3?= Date: Mon, 23 Nov 2020 15:48:51 -0800 Subject: [PATCH 1/3] switching to pre-releases instead of cirq-unstable --- .github/workflows/release-master.yml | 2 +- README.rst | 2 +- dev_tools/packaging/publish-dev-package.sh | 2 +- dev_tools/packaging/verify-published-package.sh | 12 ++++++------ docs/tutorials/google/colab.ipynb | 2 +- release.md | 2 +- setup.py | 7 ++++--- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 3f5058a4649..7ca60af0910 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -1,4 +1,4 @@ -name: Release cirq-unstable to PyPi +name: Pre-release cirq to PyPi on: push: diff --git a/README.rst b/README.rst index da195a2d2df..df816b63c51 100644 --- a/README.rst +++ b/README.rst @@ -23,7 +23,7 @@ Installation and Documentation Cirq documentation is available at `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 `_. +Documentation for the latest **unstable** 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 `_. Documentation for the latest **stable** version of cirq (what you get if you ``pip install cirq``) is available at `cirq.readthedocs.io/stable `_. diff --git a/dev_tools/packaging/publish-dev-package.sh b/dev_tools/packaging/publish-dev-package.sh index d63ea052920..ec46b0256f7 100755 --- a/dev_tools/packaging/publish-dev-package.sh +++ b/dev_tools/packaging/publish-dev-package.sh @@ -112,7 +112,7 @@ 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. +# Configure to push to a pre-release package of cirq. export CIRQ_UNSTABLE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh) # Produce packages. diff --git a/dev_tools/packaging/verify-published-package.sh b/dev_tools/packaging/verify-published-package.sh index baa158624b7..40a856a8fba 100755 --- a/dev_tools/packaging/verify-published-package.sh +++ b/dev_tools/packaging/verify-published-package.sh @@ -17,7 +17,7 @@ ################################################################################ # Downloads and tests cirq wheels from the pypi package repository. # Can verify prod, test, or unstable versions. -# --unstable: cirq-unstable from prod pypi +# --unstable: pre-release cirq from prod pypi # --test: cirq from test pypi # --prod: cirq from prod pypi # @@ -44,17 +44,17 @@ 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='' + 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" exit 1 @@ -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 diff --git a/docs/tutorials/google/colab.ipynb b/docs/tutorials/google/colab.ipynb index 26d3d4e5936..87ed2acdea7 100644 --- a/docs/tutorials/google/colab.ipynb +++ b/docs/tutorials/google/colab.ipynb @@ -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", diff --git a/release.md b/release.md index 6b32a894bb3..dfdeeb16aeb 100644 --- a/release.md +++ b/release.md @@ -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 cirq==dev`. ## Versioning diff --git a/setup.py b/setup.py index b4fe3cce020..13860adee9a 100644 --- a/setup.py +++ b/setup.py @@ -28,10 +28,11 @@ # 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 is set then we update the version to this value. +# As it contains "dev" 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_UNSTABLE_VERSION' in os.environ: - name = 'cirq-unstable' __version__ = os.environ['CIRQ_UNSTABLE_VERSION'] long_description = ( "**This is a development version of Cirq and may be " From c9087c0f3741115f120930f73f04749143cf0d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Pat=C3=B3?= Date: Wed, 2 Dec 2020 14:35:53 -0800 Subject: [PATCH 2/3] review comments + cleanups --- .github/workflows/release-master.yml | 4 ++-- README.rst | 2 +- dev_tools/packaging/publish-dev-package.sh | 5 ++--- dev_tools/packaging/verify-published-package.sh | 10 +++++----- setup.py | 9 +++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 7ca60af0910..111d7abd712 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -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/* \ No newline at end of file diff --git a/README.rst b/README.rst index df816b63c51..8f226afb784 100644 --- a/README.rst +++ b/README.rst @@ -23,7 +23,7 @@ Installation and Documentation Cirq documentation is available at `cirq.readthedocs.io `_. -Documentation for the latest **unstable** 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 `_. +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 `_. Documentation for the latest **stable** version of cirq (what you get if you ``pip install cirq``) is available at `cirq.readthedocs.io/stable `_. diff --git a/dev_tools/packaging/publish-dev-package.sh b/dev_tools/packaging/publish-dev-package.sh index ec46b0256f7..efabf878d5c 100755 --- a/dev_tools/packaging/publish-dev-package.sh +++ b/dev_tools/packaging/publish-dev-package.sh @@ -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. # @@ -113,7 +112,7 @@ tmp_package_dir=$(mktemp -d "/tmp/publish-dev-package_package.XXXXXXXXXXXXXXXX") trap "{ rm -rf ${tmp_package_dir}; }" EXIT # Configure to push to a pre-release package of cirq. -export CIRQ_UNSTABLE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh) +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}" diff --git a/dev_tools/packaging/verify-published-package.sh b/dev_tools/packaging/verify-published-package.sh index 40a856a8fba..cc9e6e55381 100755 --- a/dev_tools/packaging/verify-published-package.sh +++ b/dev_tools/packaging/verify-published-package.sh @@ -16,8 +16,8 @@ ################################################################################ # Downloads and tests cirq wheels from the pypi package repository. -# Can verify prod, test, or unstable versions. -# --unstable: pre-release cirq 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 # @@ -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 @@ -51,12 +51,12 @@ elif [ "${PROD_SWITCH}" = "--prod" ]; then PIP_FLAGS='' PYPI_REPO_NAME="PROD" PYPI_PROJECT_NAME="cirq" -elif [ "${PROD_SWITCH}" = "--unstable" ]; then +elif [ "${PROD_SWITCH}" = "--pre" ]; then PIP_FLAGS='--pre' PYPI_REPO_NAME="PROD" 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 diff --git a/setup.py b/setup.py index c2e1a7e04f8..ef26e6ea428 100644 --- a/setup.py +++ b/setup.py @@ -30,12 +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 update the version to this value. -# As it contains "dev" it will be a pre-release version on PyPi. See +# 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_UNSTABLE_VERSION' in os.environ: - __version__ = os.environ['CIRQ_UNSTABLE_VERSION'] +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 " From e7c1ed72c5391b7d41f47706559610b5a6b0a35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Pat=C3=B3?= Date: Wed, 2 Dec 2020 15:03:48 -0800 Subject: [PATCH 3/3] fix typo --- release.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.md b/release.md index dfdeeb16aeb..5b6bc874c66 100644 --- a/release.md +++ b/release.md @@ -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==dev`. +latest commit to master can be installed with `pip install --pre cirq`. ## Versioning