qiskit-documentation/scripts/ibm-quantum-learning-uploader
Frank Harkins f7d32de143 Remove spinner from learning uploader (#1415)
Small refactor before #1390.

The spinner was fun when the tool was primarily used locally, but now
it's annoying in CI and is an extra dependency. See an example of the
new behaviour in the
[test](https://github.com/Qiskit/documentation/actions/runs/9173882338/job/25223510491#step:5:102).
2024-05-21 13:10:18 +00:00
..
src/learning_uploader Remove spinner from learning uploader (#1415) 2024-05-21 13:10:18 +00:00
test Fix learning uploader to handle tutorials (#938) 2024-02-29 20:24:40 +00:00
README.md Update learning uploader README.md (#1271) 2024-05-02 08:58:12 +00:00
pyproject.toml Remove spinner from learning uploader (#1415) 2024-05-21 13:10:18 +00:00

README.md

Upload to IBM Quantum Learning

This script uploads lessons to IBM Quantum Learning.

Lessons to be uploaded must be a directory containing a single notebook and any images it uses (the API can't handle image attachments inside the notebooks).

# Example
lesson-root
├── index.ipynb
└── images
    └── image-1.png

To sync your lessons automatically with the API, you'll need to add a learning-platform.conf.yaml to the root of your content folder.

# learning-api.conf.yaml
# This goes in the root of your content folder
lessons:
  - path: path/to/folder # path to folder containing the lesson
    # Lesson URLs in the API:
    urlStaging: tutorials/4e85c04a-c2fb-4bfc-9077-b75bf1b73a25
    urlProduction: tutorials/5026731b-5e7b-4585-8cf2-f24482819e21

To upload lessons using our script:

  1. Install the package

    pip install git+https://github.com/Qiskit/documentation.git#subdirectory=scripts/ibm-quantum-learning-uploader
    
  2. Run this from the root of your content folder:

    sync-lessons
    

    You'll be prompted for your username and password.

You can also upload just one lesson at a time using

sync-lessons path/to/folder

To use this script as part of CI (Travis / GitHub actions), set the LEARNING_API_TOKEN environment variable to your access token before running the script, and LEARNING_API_ENVIRONMENT to the name of the API (staging or production). You should also pin the package to a specific commit, like so:

pip install git+https://github.com/Qiskit/documentation.git@<commit-hash>#subdirectory=scripts/ibm-quantum-learning-uploader