Skip to content

Commit 99a4b5a

Browse files
committed
Merge branch 'refactor-schema-generation' of https://github.com/QuEraComputing/bloqade-python into refactor-schema-generation
2 parents f3db67d + 91b5da7 commit 99a4b5a

File tree

17 files changed

+250
-356
lines changed

17 files changed

+250
-356
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,4 @@ jobs:
3939
run: pdm install # Then you can use pdm in the following steps.
4040
- name: Test with pytest & generate coverage
4141
run: |
42-
pdm run coverage
43-
- name: Upload Coverage to Codecov
44-
uses: codecov/codecov-action@v3
45-
with:
46-
token: ${{ secrets.CODECOV_TOKEN }}
47-
files: coverage.xml # optional
48-
fail_ci_if_error: true # optional (default = false)
49-
verbose: true # optional (default = false)
42+
pdm test

.github/workflows/cov.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Coverage
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
# See: https://github.com/pdm-project/pdm/issues/1879
14+
env:
15+
PDM_DEPS: 'urllib3<2'
16+
17+
jobs:
18+
coverage:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Python 3.9
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: 3.9
26+
- uses: pdm-project/setup-pdm@v3
27+
name: Setup PDM
28+
with:
29+
python-version: 3.9 # Version range or exact version of a Python version to use, the same as actions/setup-python
30+
# well we use virtualenv here
31+
# prerelease: true # Allow prerelease versions to be installed
32+
# enable-pep582: true # Enable PEP 582 package loading globally
33+
- name: Install dependencies
34+
run: pdm install # Then you can use pdm in the following steps.
35+
- name: Test with pytest & generate coverage
36+
run: |
37+
pdm run coverage
38+
- name: Upload Coverage to Codecov
39+
uses: codecov/codecov-action@v3
40+
with:
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
files: coverage.xml # optional
43+
fail_ci_if_error: true # optional (default = false)
44+
verbose: true # optional (default = false)

.github/workflows/deploy_dev.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
- uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0
23-
- name: Set up Python ${{ matrix.python-version }}
23+
- name: Set up Python 3.11
2424
uses: actions/setup-python@v4
2525
with:
26-
python-version: ${{ matrix.python-version }}
26+
python-version: 3.11
2727
- uses: pdm-project/setup-pdm@v3
2828
name: Setup PDM
2929
with:
@@ -44,10 +44,10 @@ jobs:
4444
run: |
4545
git config --local user.email "github-actions[bot]@users.noreply.github.com"
4646
git config --local user.name "github-actions[bot]"
47-
- name: Depoly documentation
47+
- name: Deploy documentation
4848
env:
4949
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5050
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
5151
run: |
5252
git fetch origin gh-pages --depth=1
53-
pdm run mike deploy --rebase --push -F ${GITHUB_WORKSPACE}/mkdocs.yml dev
53+
pdm run mike deploy -p dev

.github/workflows/deploy_latest.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Deploy release documentation
1818
runs-on: ubuntu-latest
1919
steps:
20-
- name: Wait for Dev documentation to deploy
20+
- name: Wait for dev documentation to deploy
2121
uses: lewagon/[email protected]
2222
with:
2323
ref: main
@@ -55,11 +55,10 @@ jobs:
5555
run: |
5656
export RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
5757
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION::3}" >> $GITHUB_ENV
58-
- name: Depoly documentation
58+
- name: Deploy documentation
5959
env:
6060
GH_TOKEN: ${{ secrets.GH_TOKEN }}
6161
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
6262
run: |
6363
git fetch origin gh-pages --depth=1
64-
pdm run mike deploy --rebase --push -F ${GITHUB_WORKSPACE}/mkdocs.yml --update-aliases latest ${RELEASE_TAG_VERSION}
65-
pdm run mike set-default --rebase --push -F ${GITHUB_WORKSPACE}/mkdocs.yml latest
64+
pdm run mike deploy -up ${RELEASE_TAG_VERSION} latest

.github/workflows/doc.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ env:
1616

1717
jobs:
1818
documentation:
19-
name: Build documentation
19+
name: Deploy preview documentation
2020
runs-on: ubuntu-latest
2121
steps:
22+
- name: Wait for dev documentation to deploy
23+
uses: lewagon/[email protected]
24+
with:
25+
ref: main
26+
check-name: 'Deploy dev documentation'
27+
repo-token: ${{ secrets.GITHUB_TOKEN }}
28+
wait-interval: 10
2229
- uses: actions/checkout@v4
2330
- name: Set up Python ${{ matrix.python-version }}
2431
uses: actions/setup-python@v4

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center">
22
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="docs/docs/assets/logo-dark.png">
4-
<source media="(prefers-color-scheme: light)" srcset="docs/docs/assets/logo.png">
3+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/logo-dark.png">
4+
<source media="(prefers-color-scheme: light)" srcset="docs/assets/logo.png">
55
<img alt="Bloqade Logo">
66
</picture>
77
</div>
@@ -24,7 +24,7 @@ Those coming from Bloqade.jl will most likely have this as their first question
2424

2525
Bloqade.jl was designed as an ***emulation-first*** SDK enabling users to investigate novel physical phenomena and develop complex algorithms with bleeding-edge performance. The result of this focus is that not everything made in Bloqade.jl is compatible with quantum hardware. While the ability to submit to Braket is available in Bloqade.jl it becomes cumbersome to analyze results and keep track of parameter sweeps.
2626

27-
In our mission to make neutral atom quantum computing more accessible to a broader community and the valuable feedback we've received in users of our quantum hardware, we took the opportunity to create a ***hardware-first*** SDK. One that is perfectly positioned to make it even easier to reap the benefits of neutral atoms while minimizing the pain points of initial program creation and post-processing results.
27+
In our mission to make neutral atom quantum computing more accessible to a broader community and the valuable feedback we've received in users of our quantum hardware, we took the opportunity to create a ***hardware-first*** SDK. One that is perfectly positioned to make it even easier to reap the benefits of neutral atoms while minimizing the pain points of initial program creation and post-processing results.
2828

2929
## What does Bloqade do?
3030

@@ -42,19 +42,19 @@ pip install bloqade
4242

4343
## Documentation
4444

45-
If you're already convinced about what Bloqade brings to the table, feel free to take a look at our documentation with examples [here](https://queracomputing.github.io/bloqade-python/latest/).
45+
If you're already convinced about what Bloqade brings to the table, feel free to take a look at our documentation with examples [here](https://queracomputing.github.io/bloqade-python/latest/).
4646

4747
If you aren't convinced, keep scrolling!
4848

4949
## Features
5050

5151
### Smart Documentation
5252

53-
Get where you need to go in your program development with documentation that knows *where* and *when* it's needed. Never get lost developing your algorithm ever again!
53+
Get where you need to go in your program development with documentation that knows *where* and *when* it's needed. Never get lost developing your algorithm ever again!
5454

5555
If you're a novice to neutral atoms, smart docs have your back. If you're an expert with neutral atoms, let smart docs give you some guidance on some new avenues for algorithm development.
5656

57-
![](docs/docs/assets/readme-gifs/smart-docs.gif)
57+
![](docs/assets/readme-gifs/smart-docs.gif)
5858

5959

6060
### Fully Parameterized Analog Programs
@@ -63,13 +63,13 @@ If you're a novice to neutral atoms, smart docs have your back. If you're an exp
6363

6464
You used to have to manually keep track of all the small variations of your program per parameter, keeping careful track not to forget to submit one variation or lose one on top of a convoluted post-processing pipeline to incorporate all the results in one place.
6565

66-
Bloqade eliminates this with its own support for variables and internal handling of program parameter variations. Just drop in a variable in almost any place a single value can live and you can either assign a value later or a whole sequence of values to create a parameter sweep.
66+
Bloqade eliminates this with its own support for variables and internal handling of program parameter variations. Just drop in a variable in almost any place a single value can live and you can either assign a value later or a whole sequence of values to create a parameter sweep.
6767

6868
Let Bloqade handle keeping track of all the variations while you focus on becoming a master of neutral atoms.
6969

7070
Did we mention you can throw your program at hardware and emulation and still keep your parameter sweeps?
7171

72-
```python
72+
```python
7373
from bloqade import var
7474
from bloqade.atom_arrangement import Square
7575

@@ -79,7 +79,7 @@ adiabatic_durations = [0.4, 3.2, 0.4]
7979

8080
# create variables explicitly...
8181
max_detuning = var("max_detuning")
82-
# ...or implicitly inside the program definition.
82+
# ...or implicitly inside the program definition.
8383
adiabatic_program = (
8484
Square(3, "lattice_spacing")
8585
.rydberg.rabi.amplitude.uniform.piecewise_linear(
@@ -109,13 +109,13 @@ hw_results = adiabatic_program.parallelize(24).braket.aquila().run_async(100)
109109

110110
Simple and fast visualization for programs no matter how complex your program gets:
111111

112-
![](docs/docs/assets/readme-gifs/locations-hover.gif)
113-
![](docs/docs/assets/readme-gifs/graph-select.gif)
112+
![](docs/assets/readme-gifs/locations-hover.gif)
113+
![](docs/assets/readme-gifs/graph-select.gif)
114114

115-
The same holds for results:
115+
The same holds for results:
116116

117-
![](docs/docs/assets/readme-gifs/visualize-bitstrings.gif)
118-
![](docs/docs/assets/readme-gifs/hover-bitstrings.gif)
117+
![](docs/assets/readme-gifs/visualize-bitstrings.gif)
118+
![](docs/assets/readme-gifs/hover-bitstrings.gif)
119119

120120
### Maximum Composability
121121

@@ -152,14 +152,14 @@ separate_rabi_amp_wf = piecewise_linear(durations = adiabatic_durations, values
152152
max_detuning = var("max_detuning")
153153
separate_rabi_detuning = piecewise_linear(durations = adiabatic_durations, values = [-max_detuning, -max_detuning, max_detuning, max_detuning])
154154

155-
# Now bring it all together!
155+
# Now bring it all together!
156156
# And why not sprinkle in some parameter sweeps for fun?
157157
full_program = (
158158
square_lattice.rydberg.rabi.amplitude.uniform
159159
.apply(separate_rabi_amp_wf)
160160
.detuning.uniform
161161
.apply(separate_rabi_detuning)
162-
.assign(max_rabi = 15.8,
162+
.assign(max_rabi = 15.8,
163163
max_detuning = 16.33)
164164
.batch_assign(lattice_spacing = np.arange(4.0, 7.0, 0.5),
165165
max_rabi = np.linspace(2 * np.pi * 0.5, 2 * np.pi * 2.5, 6))
@@ -185,6 +185,6 @@ program_with_few_atoms.parallelize(24).braket.aquila(24).run_async(100)
185185

186186
Bloqade wouldn't exist if we weren't fortunate enough to obtain feedback from awesome members of our community such as yourself (:
187187

188-
If you find a bug, have an idea, or find an issue with our documentation, please feel free to file an issue on the [Github repo itself](https://github.com/QuEraComputing/bloqade-python/issues/new/choose).
188+
If you find a bug, have an idea, or find an issue with our documentation, please feel free to file an issue on the [Github repo itself](https://github.com/QuEraComputing/bloqade-python/issues/new/choose).
189189

190190
*May the van der Waals force be with you!*

codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ coverage:
88
default:
99
target: auto
1010
threshold: 4%
11+
12+
codecov:
13+
token: 86b6a2b8-9acb-4b50-b0da-04f14035d704

docs/docs/builder-workflow/overview.md renamed to docs/builder-workflow/overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Builder Overview
22

3-
You may have noticed from the [Usage](../getting_started/philosophy.md) and [Tutorials](https://queracomputing.github.io/bloqade-python-examples/latest/)
3+
You may have noticed from the [Usage](../getting_started/usage.md) and [Tutorials](https://queracomputing.github.io/bloqade-python-examples/latest/)
44
that Bloqade uses this interesting, dot-intensive syntax.
55

66
```python
@@ -19,7 +19,7 @@ circuit = init_qubits(n_qubits)
1919
circuit.x(0).z(1).cnot(0, 1)...
2020
```
2121

22-
What's the deal with that?
22+
What's the deal with that?
2323

2424
## Syntax Motivations
2525

@@ -36,4 +36,4 @@ The linear structure implies a natural hiearchy in how you think about targeting
3636

3737
While we hope the Smart Documentation (the ability to instantly see all your next possible steps and their capabilities in your favorite IDE/IPython) is sufficient to get you where you need to go, we undestand it's particularly beneficial to get a high-level overview of things before diving in.
3838

39-
The [Standard Representation](standard.md) is a nice flow chart that gives a high-level overview of the different steps and components in the builder syntax.
39+
The [Standard Representation](standard.md) is a nice flow chart that gives a high-level overview of the different steps and components in the builder syntax.

docs/builder-workflow/standard.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
2+
# Build Workflow
3+
4+
``` mermaid
5+
6+
flowchart TD
7+
8+
ProgramStart(["start"])
9+
10+
Geometry("Geometry or Lattice")
11+
12+
Coupling["Coupling
13+
-----------
14+
rydberg
15+
hyperfine"]
16+
17+
Detuning["detuning"]
18+
Rabi["rabi"]
19+
20+
Amplitude["amplitude"]
21+
Phase["phase"]
22+
23+
SpaceModulation("SpatialModulation
24+
----------------------
25+
uniform
26+
scale
27+
location
28+
")
29+
Waveform{"Waveform
30+
------------
31+
piecewise_linear
32+
piecewise_constant
33+
constant
34+
linear
35+
poly
36+
fn
37+
"}
38+
39+
Options(["Options
40+
---------
41+
assign
42+
batch_assign
43+
args
44+
parallelize
45+
"])
46+
47+
Services(["Services
48+
----------
49+
bloqade
50+
quera
51+
braket"])
52+
53+
QuEraBackends(["Backends
54+
------------
55+
mock
56+
cloud_mock
57+
aquila
58+
device"])
59+
60+
BraketBackends(["Backends
61+
------------
62+
aquila
63+
local_emulator"])
64+
65+
BloqadeBackends(["Backends
66+
------------
67+
python
68+
julia"])
69+
70+
Submit("Execution
71+
------------
72+
run_async()
73+
run()
74+
__call__")
75+
76+
ProgramStart -->|add_position| Geometry;
77+
Geometry --> Coupling;
78+
ProgramStart --> Coupling;
79+
80+
Coupling --> Detuning;
81+
Coupling --> Rabi;
82+
83+
Rabi --> Amplitude;
84+
Rabi --> Phase;
85+
86+
Detuning --> SpaceModulation;
87+
Amplitude --> SpaceModulation;
88+
Phase --> SpaceModulation;
89+
90+
SpaceModulation --> Waveform;
91+
92+
Waveform --> Coupling;
93+
Waveform --> Services;
94+
Waveform --> Options;
95+
Options --> Services;
96+
97+
Services -->|quera| QuEraBackends;
98+
Services -->|braket| BraketBackends;
99+
Services -->|bloqade| BloqadeBackends;
100+
QuEraBackends --> Submit;
101+
BraketBackends --> Submit;
102+
BloqadeBackends --> Submit;
103+
```

0 commit comments

Comments
 (0)