Skip to content
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

Typescript development in Cirq and prototype bloch sphere implementation #4171

Merged
merged 165 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from 151 commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
4648e65
add node_modules to .gitignore, add three.js to package-lock
seunomonije May 11, 2021
621b729
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije May 11, 2021
8832853
initial refactoring
seunomonije May 12, 2021
5516b55
move package-lock into the web subdirectory
seunomonije May 12, 2021
7a2aacd
readme, slight refactor
seunomonije May 14, 2021
bbf8af2
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije May 14, 2021
490a8b2
add live-server
seunomonije May 14, 2021
a08a196
added more to readme file
seunomonije May 14, 2021
b3a3a7e
prettier
seunomonije May 14, 2021
2c66c8a
small changes to readme
seunomonije May 14, 2021
bb015e0
typescript
seunomonije May 14, 2021
eb1a435
small change to readme
seunomonije May 14, 2021
724a9da
hacking endpoint from friday
seunomonije May 17, 2021
86199a6
refactor/progress dump
seunomonije May 19, 2021
1f52ac8
post gts lint. The extra interface files might not stay.
seunomonije May 19, 2021
391258d
rename to cirq-web
seunomonije May 21, 2021
2650381
refactor and additional files
seunomonije May 21, 2021
064de3f
refactor again
seunomonije May 21, 2021
be5564c
updated setup
seunomonije May 21, 2021
6d8b533
init file
seunomonije May 21, 2021
eddb58f
refactor, split cirq-web into its own package
seunomonije May 21, 2021
8015fac
update versions to match
seunomonije May 21, 2021
1557b52
add cirq-web autopkg to script
seunomonije May 21, 2021
ee9f890
moved python init
seunomonije May 21, 2021
09127f8
small test changes cuz colab is being difficult
seunomonije May 21, 2021
df2e359
new bundle to upload
seunomonije May 21, 2021
03e8bd0
lowercase cirq
seunomonije May 21, 2021
f574154
fix dev browser environment
seunomonije May 21, 2021
c24ffe3
pre presentation
seunomonije May 26, 2021
e78d85d
post presentation state
seunomonije May 26, 2021
21343fb
very very very rough bloch sphere
seunomonije May 27, 2021
37f1218
rough vector support end to end
seunomonije May 27, 2021
6351f77
updated with working HTML hot reloading and example bloch_sphere in j…
seunomonije May 27, 2021
29ec82f
progress dump
seunomonije Jun 3, 2021
cf9b435
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jun 3, 2021
807b4ff
refactored Bloch Sphere organization
seunomonije Jun 3, 2021
731d194
new directory structure, standalone HTML files, Python integration, n…
seunomonije Jun 4, 2021
5ab03c5
small changes for webpack continuity and organization
seunomonije Jun 4, 2021
51ea689
added comments to ts components
seunomonije Jun 4, 2021
c7cf8c9
rename cirq_python to cirq_web
seunomonije Jun 4, 2021
ab8febe
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jun 4, 2021
b33eb1e
added first test
seunomonije Jun 4, 2021
3fedccd
added preliminary testing to cirq_web
seunomonije Jun 4, 2021
b4ecff1
recommit
seunomonije Jun 4, 2021
12bc26b
testing covg, updated readmes, documentation, other
seunomonije Jun 7, 2021
e6723da
todo readme
seunomonije Jun 8, 2021
416b126
move gitignore
seunomonije Jun 8, 2021
c07c561
fix gitignore
seunomonije Jun 8, 2021
57df8aa
cleanup
seunomonije Jun 8, 2021
fce0580
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jun 8, 2021
f2eec63
remove bloch sphere
seunomonije Jun 8, 2021
918f77e
remove files.js
seunomonije Jun 8, 2021
bd5d1b4
add dist for path issues, may need to refactor to keep out later
seunomonije Jun 8, 2021
39ab966
adding support for cirq-web dependencies in the pytest-minimal test
seunomonije Jun 8, 2021
44d62b6
quick fix to pytest-minimal
seunomonije Jun 8, 2021
10bd505
explicit utf-8 encoding for windows systems
seunomonije Jun 8, 2021
08e48a5
quick addition
seunomonije Jun 8, 2021
8300306
add final explicit encoding
seunomonije Jun 8, 2021
83297ef
deciding to use mocha for testing
seunomonije Jun 8, 2021
802f9d2
testing framework setup with simple test run
seunomonije Jun 8, 2021
c431503
Update cirq-web/cirq_web/bloch_sphere/cirq_bloch_sphere.py
seunomonije Jun 8, 2021
0107a58
Update cirq-web/cirq_ts/_version.py
seunomonije Jun 8, 2021
bbc844e
Update cirq-web/cirq_ts/src/bloch_sphere/components/Axes.class.d.ts
seunomonije Jun 8, 2021
0ccdb90
Update cirq-web/cirq_ts/src/bloch_sphere/components/Axes.class.ts
seunomonije Jun 8, 2021
6f5597f
Update cirq-web/cirq_ts/src/bloch_sphere/components/Meridians.class.ts
seunomonije Jun 8, 2021
cd1c7a0
Update cirq-web/cirq_web/bloch_sphere/cirq_bloch_sphere.py
seunomonije Jun 8, 2021
b3d297d
Update cirq-web/setup.py
seunomonije Jun 8, 2021
af02537
Update cirq-web/cirq_ts/src/bloch_sphere/components/Meridians.class.ts
seunomonije Jun 8, 2021
b2045e9
Update cirq-web/cirq_ts/src/bloch_sphere/components/Meridians.class.ts
seunomonije Jun 8, 2021
efcdac1
Update cirq-web/cirq_ts/src/bloch_sphere/components/Meridians.class.ts
seunomonije Jun 8, 2021
d489643
Update cirq-web/cirq_ts/src/bloch_sphere/components/Vector.class.ts
seunomonije Jun 8, 2021
a758965
small changes
seunomonije Jun 8, 2021
2f0c502
Merge branch 'master' of https://github.com/seunomonije/Cirq
seunomonije Jun 8, 2021
a343878
small fixes commit
seunomonije Jun 8, 2021
bc4d3de
first round of comment resolutions, added tiny visualization testing …
seunomonije Jun 9, 2021
227b56f
cirq_ts readme PR comment fixes
seunomonije Jun 9, 2021
0a46d3f
PR comment fixes BlochSphere.ts
seunomonije Jun 9, 2021
bc97a60
PR comment fixes meridians
seunomonije Jun 9, 2021
576031b
PR comment fixes scene
seunomonije Jun 9, 2021
54b2e1b
PR comment fixes vector and test
seunomonije Jun 9, 2021
28467fb
double check fixes from PR comments
seunomonije Jun 9, 2021
0a5f6bc
rename files, work on text.ts
seunomonije Jun 9, 2021
845a944
temp change of bs symbols, quick/dirty but working e2e image check te…
seunomonije Jun 10, 2021
2c80848
ran the linter, fixed .eslintrc.json so that it reports no errors
seunomonije Jun 10, 2021
7657584
add preliminary CI
seunomonije Jun 10, 2021
70887eb
CI for unit testing
seunomonije Jun 10, 2021
b80007b
fix rename for ts-test
seunomonije Jun 10, 2021
8ad3ef4
rename library to CirqTS
seunomonije Jun 10, 2021
2527c57
can configure div id of the bloch sphere
seunomonije Jun 10, 2021
7bce91e
add vector type
seunomonije Jun 10, 2021
250ea94
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jun 10, 2021
3a6acd6
update bundle and jupyter notebook
seunomonije Jun 10, 2021
6aabc66
small refactor of python, added more to README
seunomonije Jun 10, 2021
71ff76d
pylint
seunomonije Jun 10, 2021
a803e11
removed IPython as a requirement
seunomonije Jun 11, 2021
3c3bafc
added TS testing frameworks, rough TS viz and unit testing, small rea…
seunomonije Jun 14, 2021
f6e48bb
restart ci
seunomonije Jun 14, 2021
a49fcbc
test ci
seunomonije Jun 14, 2021
3451a3a
add back coverage testing
seunomonije Jun 14, 2021
20b314c
fixed merge conflicts
seunomonije Jun 14, 2021
d3fdd5a
make check/ts-coverage an executable
seunomonije Jun 14, 2021
4bb2242
rough text changes, fix ipython fails on CI
seunomonije Jun 14, 2021
b512c9f
move _version.py to the correct spot
seunomonije Jun 14, 2021
8769ffc
quick updates
seunomonije Jun 14, 2021
b8d5926
fix space in file
seunomonije Jun 15, 2021
e7ba83f
updated ts testing framework, fixed labels
seunomonije Jun 15, 2021
cbb6930
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jun 15, 2021
278c911
linting and merge w upstream
seunomonije Jun 15, 2021
3b5a513
add copyrights, small PR comment changes
seunomonije Jun 15, 2021
bdc7955
fix naming of divId
seunomonije Jun 15, 2021
16ec03a
ts e2e testing writes to temp file
seunomonije Jun 15, 2021
9bdbc47
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jun 15, 2021
3e1054d
exclude utility functions from testing
seunomonije Jun 15, 2021
599a8bd
updated testing portion of ts README
seunomonije Jun 15, 2021
8820d39
updated README, example notebook, fixed bloch sphere vector point, sm…
seunomonije Jun 16, 2021
b41057c
linting and cleanup changes
seunomonije Jun 16, 2021
4d6bffc
deleting bloch sphere due to ci issues
seunomonije Jun 16, 2021
2914c0d
redo expected png
seunomonije Jun 16, 2021
b259678
add utf-8 encoding to test
seunomonije Jun 16, 2021
4b0da2d
second attempt to fix image diff issue
seunomonije Jun 16, 2021
e48596f
fix test to account for unicode diff threshold
seunomonije Jun 16, 2021
2fe2377
update cirq-web readme
seunomonije Jun 16, 2021
625659e
add utf-8 charset for readme
seunomonije Jun 16, 2021
d2e37ea
add cirq_ts to setup.py
seunomonije Jun 16, 2021
9f403bf
change setup.py for new packaging structure
seunomonije Jun 16, 2021
e314d19
add ts distribution files to the python package
seunomonije Jun 16, 2021
045fbc3
more clarity to package searching
seunomonije Jun 16, 2021
1976d8c
add .js extension
seunomonije Jun 16, 2021
3a6e0a6
add manifest file to help get the bundles
seunomonije Jun 16, 2021
cc23aee
change to setup.py
seunomonije Jun 16, 2021
6a619dd
reset setup.py
seunomonije Jun 16, 2021
44a9521
include package data tag for manifest to work
seunomonije Jun 16, 2021
eb0d7a4
testing removal of cirq_ts from packagin, we don't need it to have an…
seunomonije Jun 16, 2021
bae0b7c
adding cirq_ts back, we need it
seunomonije Jun 16, 2021
ede563f
formatting fix
seunomonije Jun 16, 2021
12fdbc7
remove packaging from readme
seunomonije Jun 17, 2021
22ed261
Merge branch 'master' into master
seunomonije Jun 17, 2021
c187c49
typescript PR fixes
seunomonije Jun 17, 2021
6e2e549
pr fixes for python
seunomonije Jun 17, 2021
969d236
change fixes
seunomonije Jun 17, 2021
618ff01
missed fixes
seunomonije Jun 17, 2021
7f9536e
progress on new testing
seunomonije Jun 21, 2021
5469659
another refactor of the testing framework
seunomonije Jun 21, 2021
7ff32f7
update meridians test
seunomonije Jun 21, 2021
27ed7cb
major typescript code and testing refactor, implemented PR comments
seunomonije Jun 22, 2021
b30dd9b
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jun 22, 2021
d59d56a
lint fixes
seunomonije Jun 22, 2021
8998701
PR comment resolutions, additional misc cleanup and fixes
seunomonije Jun 24, 2021
da0c436
Merge branch 'master' into master
seunomonije Jun 24, 2021
e041212
add IPython back for CI
seunomonije Jun 24, 2021
4deb927
pr comment fixes and bug fixes
seunomonije Jun 25, 2021
95e6fa1
added uuids to bloch spheres, cleaned up example notebook
seunomonije Jun 25, 2021
72ee0e8
update testing statements, general pr fixes
seunomonije Jun 28, 2021
d32510c
fix axes
seunomonije Jun 28, 2021
16ae383
Merge branch 'master' of https://github.com/quantumlib/Cirq
seunomonije Jul 1, 2021
553dde8
removed json middleman, added more check scripts, general cleanup
seunomonije Jul 1, 2021
59511c6
removed MANIFEST.in and included bundle in package_data
seunomonije Jul 1, 2021
60cc765
changes to pass CI, delete determine_env from widget (YAGNI)
seunomonije Jul 1, 2021
9eb7f29
fix changes after quick scroll through
seunomonije Jul 1, 2021
07c6c50
PR comment resolutions, adding CI for end to end tests, other refacto…
seunomonije Jul 1, 2021
1ab1b76
pr resolutions
seunomonije Jul 2, 2021
f56bdd3
pr changes
seunomonije Jul 2, 2021
28187c7
revert .gitignore
seunomonije Jul 2, 2021
44bb800
rename MockWidget to FakeWidget and format widget.py
seunomonije Jul 2, 2021
9026f65
Merge branch 'master' into master
balopat Jul 2, 2021
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
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,36 @@ jobs:
with:
name: notebook-outputs
path: out
ts-lint:
name: Typescript lint check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
node-version: '14.16.1'
- name: Install npm
run: npm --prefix 'cirq-web/cirq_ts' ci
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
- name: Lint
run: check/ts-lint
ts-test:
name: Typescript unit testing
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
node-version: '14.16.1'
- name: Install npm dependencies
run: npm --prefix 'cirq-web/cirq_ts' ci
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
- name: Test
run: check/ts-test
ts-coverage:
name: Typescript unit testing coverage
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
node-version: '14.16.1'
- name: Install npm dependencies
run: npm --prefix 'cirq-web/cirq_ts' ci
- name: Test
run: check/ts-coverage
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ docs/api_docs
.python-version

# notebook test output
out
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
out

15 changes: 15 additions & 0 deletions check/ts-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

################################################################################
# Build the bundle files for Cirq-web
#
# Usage:
# check/ts-build
################################################################################

# Get the working directory to the repo root.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$(git rev-parse --show-toplevel)"

cd 'cirq-web/cirq_ts'
npx webpack --mode production
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 14 additions & 0 deletions check/ts-coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

################################################################################
# Runs the Istanbul coverage checker on the Typescript. Primarily used for CI.
#
# Usage:
# check/ts-lint
################################################################################

# Get the working directory to the repo root.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$(git rev-parse --show-toplevel)"

npm --prefix 'cirq-web/cirq_ts' run coverage
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 14 additions & 0 deletions check/ts-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

################################################################################
# Runs the linter on the Typescript. Primarily used for CI.
#
# Usage:
# check/ts-lint
################################################################################

# Get the working directory to the repo root.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$(git rev-parse --show-toplevel)"

npm --prefix 'cirq-web/cirq_ts' run lint
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 14 additions & 0 deletions check/ts-lint-and-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

################################################################################
# Runs gts on the Typescript files in the cirq-web package
#
# Usage:
# check/ts-lint-and-format
################################################################################

# Get the working directory to the repo root.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$(git rev-parse --show-toplevel)"

npm --prefix 'cirq-web/cirq_ts' run fix
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 16 additions & 0 deletions check/ts-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

################################################################################
# Runs the test files
#
# Usage:
# check/ts-test
#
# "npm run test" runs unit tests
################################################################################

# Get the working directory to the repo root.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$(git rev-parse --show-toplevel)"

npm --prefix 'cirq-web/cirq_ts' run test
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions cirq-web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Ignore node modules
node_modules/

# Pytest files
.pytest_cache/

# Coverage testing information
.nyc_output/

# Extras
build/

201 changes: 201 additions & 0 deletions cirq-web/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}

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

http://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.
1 change: 1 addition & 0 deletions cirq-web/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include cirq_ts/dist/*.bundle.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this file, MANIFEST.in is only for source distributions and we don't publish source distros.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I fixed by just adding to package_data

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, package_data determines what the wheel file (binary distribution) contains.
I guess you still need to delete this file! :)

48 changes: 48 additions & 0 deletions cirq-web/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

seunomonije marked this conversation as resolved.
Show resolved Hide resolved

`Cirq <https://quantumai.google/cirq>`__ is a Python library for writing, manipulating, and optimizing quantum
circuits and running them against quantum computers and simulators.

This module is **cirq-web**, which allows users to take advantage of browser based 3d visualization tools
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
and features in Cirq. cirq-web also provides a development environment for contributors to create and add
their own visualizations to the module.

Documentation
-------------
All current documentation for cirq-web can be found in the README files located in this module's subdirectories.
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

Below is a quick example of how to generate a portable 3d rendering of a bloch sphere using cirq-web:
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: python

from cirq_web import BlochSphere
sphere = BlochSphere()
sphere.generate_html_file()

This will create the file in the current working directory. There are additional options to specify the
output directory, open the visualization in a browser, etc.
seunomonije marked this conversation as resolved.
Show resolved Hide resolved

You can also view and interact with a bloch sphere in a Colab or Jupyter notebook setting
seunomonije marked this conversation as resolved.
Show resolved Hide resolved
with the following:

.. code-block:: python

from cirq_web import BlochSphere
sphere = BlochSphere()
display(sphere)

Note that you can pass a state vector into the :code:`BlochSphere()` constructor to view a particular
wcourtney marked this conversation as resolved.
Show resolved Hide resolved
state.

See the example Jupyter notebook in this directory for more examples on how to use cirq-web.

Installation
------------

Cirq-web is currently in development, and therefore is only available via pre-release.

To install the pre-release version of only **cirq-web**, use `pip install cirq-web --pre`.

Note, that this will install both cirq-web and cirq-core.

To get all the optional modules installed as well, you'll have to use `pip install cirq` or `pip install cirq --pre` for the pre-release version.
Loading