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

Add tutorials to examples #807

Open
wants to merge 15 commits into
base: 0.1
Choose a base branch
from

Conversation

rscircus
Copy link
Contributor

@rscircus rscircus commented Feb 18, 2024

The docs of this project contain examples. However, these examples have a few missing dependencies and other tiny errata. To fix these this PR proposes to:

  • add the examples in the tutorial
  • source the shown examples in the tutorial from these examples
  • such that the tutorials contain less tiny mistakes
  • allow a 'newbie' to get started quicker

This PR partially addresses issue #802.

Discussion:

How to deal with testcode/testoutput in sphinx? It fails right now as described in: #828

Todo:

After rebase: Update example scripts to current state of docs.

  • add calibration examples
  • add circuits examples
  • add compiler examples
  • add instrument examples
  • add lab examples
  • add pulse examples
  • provide brief description of each tutorial as module docstring

Testing:

  • diff against docs generated by main

Checklist:

  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.
  • Reviewers confirm new code works as expected.

@rscircus rscircus marked this pull request as draft February 18, 2024 18:46
Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

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

Thank you very much @rscircus, I just took a quick look, but I will take a deeper one as soon as possible.

I added a tiny comment for the time being, and I have a further one: could you provide a (even brief) description of each tutorial?
You could even use a module docstring for this (just a docstring starting at line 1)

pyproject.toml Outdated Show resolved Hide resolved
@alecandido
Copy link
Member

source the shown examples in the tutorial from these examples

I guess you mean something like this?
https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-literalinclude

such that the tutorials contain less tiny mistakes

This in principle should be prevented by doctest, since they are already running in the CI (but for sure there is something broken)

allow a 'newbie' to get started quicker

Instead, this could be an interesting point of view: self-contained scripts might be helpful for beginners :)

@rscircus
Copy link
Contributor Author

Instead, this could be an interesting point of view: self-contained scripts might be helpful for beginners :)

That was the idea. :)

@rscircus
Copy link
Contributor Author

I'll continue working on this at the weekend! :)

@rscircus
Copy link
Contributor Author

Sorry for the delay here. The past two weeks have been very busy.

@rscircus rscircus force-pushed the doc/executable_tutorials branch 2 times, most recently from a2fc0ea to 27d3e86 Compare March 27, 2024 07:41
@rscircus
Copy link
Contributor Author

@alecandido - used literalincludes to add the examples shown in the tutorial. Maybe we have to think about having two examples folders now. Anyway, I already saw the advantage that the pre-commit hook started to modify the code examples I updated from the current docs. ☺️

@alecandido
Copy link
Member

@alecandido - used literalincludes to add the examples shown in the tutorial. Maybe we have to think about having two examples folders now. Anyway, I already saw the advantage that the pre-commit hook started to modify the code examples I updated from the current docs. ☺️

Thanks @rscircus, that is definitely good!

Embedding languages in other languages is always messy, because they get closer to arbitrary strings. IDEs are now providing support, but it is never as good as for the native one, and similarly concerning tools.

Whenever this will be merged, we could even propagate to the other Qibo projects.

@stavros11 stavros11 modified the milestone: Qibolab 0.2.0 Apr 17, 2024
@rscircus
Copy link
Contributor Author

Rebased on top of main - a514441

@rscircus
Copy link
Contributor Author

Not sure how to deal with some of the testcode, which @stavros11 also mentioned in #828. Multiple options are available. I'd suggest to discuss this.

@rscircus
Copy link
Contributor Author

rscircus commented Jul 2, 2024

Rebase onto qiboteam:main

@rscircus rscircus marked this pull request as ready for review July 2, 2024 03:47
@alecandido alecandido changed the base branch from main to 0.1 August 21, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants