Repository: quantumlib/Cirq

Issue:
Prevent installing both cirq and cirq-unstable.
**Is your feature request related to a use case or problem? Please describe.**

If `cirq-unstable` is installed in a virtualenv and you `pip install cirq`, the virtualenv gets into a bad state. This is because they are different packages with separate metadata, but they put the python code in the same location in a `cirq` folder in site-packages. So pip thinks both are installed but in fact only the most-recently installed package is "active".

If you try to fix such a situation by uninstalling one package, the code gets removed but pip still thinks the other package is installed. The other package is now in a broken state (can't be imported, etc.). The only way to recover is to uninstall _both_ packages and then install one of them again.

**Describe the solution you'd like**

I'd like `pip install cirq` to fail if `cirq-unstable` is installed, and vice-versa. I did a quick glance at setuptools docs to see if there is some way to specify packages that _must not_ be present, but I couldn't see anything. It also doesn't seem to work to add a package requirement like `cirq != *`. I'm not sure if there's any other mechanism we can use to accomplish this.

**What is the urgency from your perspective for this issue? Is it blocking important work?**

P3 - I'm not really blocked by it, it is an idea I'd like to discuss / suggestion based on principle 

We have internal workarounds for this to try to keep people's virtualenvs in a good state if they accidentally install both versions, but it'd be great if we could prevent the problem from happening at all.


Discussion:
This sounds like a useful feature, I don't know immediately how to resolve it, but in theory it might be possible. Will flip to `triage/accepted` when we have a way to do this. 
Idea: the problem is that `cirq-unstable` is a different package from `cirq`, while in reality is just a different version. 
Maybe we should publish [pre-releases](https://pip.pypa.io/en/stable/reference/pip_install/#pre-release-versions) to the cirq package from master, and then `pip install cirq --pre` would simply pull the latest pre-release version from pypi. 
Thoughts? 
I think we used to do something like that, but then changed to use a different package for the unstable releases instead. You're right that just having one pypi package would fix the problem and it's probably the "correct" way to do things. I don't remember the reasoning for created a separate package, but perhaps @Strilanc or @dabacon can say more.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -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 "


Test patch: