feat: complete the Braket SDK cheat sheet with verified snippets#1279
feat: complete the Braket SDK cheat sheet with verified snippets#1279hassaansaleem28 wants to merge 16 commits into
Conversation
Co-authored-by: Jean-Christophe Jaskula <jjaskula@amazon.com> Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
…(en + fr) Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
…it caught Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1279 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 169 169
Lines 10963 10963
Branches 1412 1412
=========================================
Hits 10963 10963 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The jekyll bundle is failing. Please include detailed instructions in the Readme on how to make it work. |
Signed-off-by: hassaansaleem28 <iamhassaans@gmail.com>
|
done @peterkomar-aws. I ran the whole flow locally and it builds and serves cleanly, with both language pages returning HTTP 200: $ bundle install $ bundle exec jekyll build $ bundle exec jekyll serve $ curl -I http://127.0.0.1:4000/ # English page Steps are in doc/cheat_sheet/README.md under "Preview the site locally" if you'd like to reproduce it. |
Issue #, if available: Closes #1255
Description of changes:
This finishes the Braket SDK cheat sheet that was started in the draft PR #995 by @jcjaskula-aws. As the issue suggested, I built on that work and opened a fresh PR for clarity. The first commit brings in the original foundation untouched and credits the original authors, then the later commits take it the rest of the way.
What I did:
Went through every existing snippet and fixed the ones that no longer match the current SDK. For example
task.result()(it wasresults()), theCircuit.unitaryargument order, straight quotes in the free parameter examples, the retired RigettiAspenM3device, and a couple of missing imports.Added the five sections the issue asked for, in both English and French:
Finished the French translation. The original design was bilingual but the French side was only partly done, so I brought every section to parity. The code stays identical across languages and only the descriptions are translated.
Added a small script that checks the cheat sheet against the installed SDK. It runs every import, runs the local snippets for real, makes sure the French code matches the English, and confirms the generated file is up to date. Writing this is actually how I found two of the snippet bugs above.
Restored the generator that builds the flat
genai_cheat_sheet.mdcompanion file. The original was removed in feat: publish a cheat sheet via github pages #995 because it downloaded a zip over the network and broke CI, so I rewrote it to read the local files instead, and regenerated the output.Added a
README.mdin the cheat sheet folder that explains how to add or edit a section, add a language, run the checks, regenerate the companion file, and preview the site locally.Fixed the publish workflow to call the restored generator, and added a small workflow that runs the checks on pull requests. Publishing still only happens on pushes to main.
Testing done:
I installed the SDK in a clean Python 3.12 environment and ran the verification script, which passes. Every import resolves, the local snippets run on the local simulator and the local emulator, the English and French code match, and the generated file is in sync. I also ran the same lint commands the CI uses (
ruff format --check .andruff check src) and both pass. The changes are documentation only and do not touchsrcor the unit tests.Merge Checklist
General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.