Skip to content

Commit f2d55e9

Browse files
babbushdabacon
authored andcommitted
Adds a version file
1 parent b232b18 commit f2d55e9

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

cirq/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@
141141
Timestamp,
142142
)
143143

144-
# Import examples last, because they reference this top-level package.
145-
144+
# Import examples second-to-last, because they reference this top-level package.
146145
from cirq import examples
146+
147+
# Import version last since it is a relative import.
148+
from ._version import __version__

cirq/_version.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Define version number here and read it from setup.py automatically"""
16+
__version__ = "0.1"

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414

1515
from setuptools import find_packages, setup
1616

17+
# This reads the __version__ variable from cirq/_version.py
18+
exec(open('cirq/_version.py').read())
19+
1720
# Read in requirements.txt
1821
requirements = open('requirements.txt').readlines()
1922
requirements = [r.strip() for r in requirements]
2023

2124
setup(
2225
name='cirq',
23-
version='0.1',
26+
version=__version__,
2427
url='http://github.com/quantumlib/cirq',
2528
author='The Cirq Developers',
2629
install_requires=requirements,

0 commit comments

Comments
 (0)