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

Define public API #1030

Merged
merged 38 commits into from
Sep 19, 2024
Merged

Define public API #1030

merged 38 commits into from
Sep 19, 2024

Conversation

alecandido
Copy link
Member

@alecandido alecandido commented Sep 6, 2024

Closes #790, closes #949, and closes #1031

  • fix broken cross-references in docs

@alecandido alecandido added this to the Qibolab 0.2.0 milestone Sep 6, 2024
This was linked to issues Sep 6, 2024
Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 76.55678% with 64 lines in your changes missing coverage. Please review.

Project coverage is 52.34%. Comparing base (d07eb62) to head (26df7f2).
Report is 39 commits behind head on 0.2.

Files with missing lines Patch % Lines
src/qibolab/_core/instruments/qm/controller.py 0.00% 9 Missing ⚠️
src/qibolab/_core/instruments/qm/__init__.py 0.00% 6 Missing ⚠️
src/qibolab/_core/instruments/zhinst/executor.py 0.00% 6 Missing ⚠️
...ibolab/_core/instruments/qm/components/__init__.py 0.00% 4 Missing ⚠️
src/qibolab/instruments/era.py 0.00% 4 Missing ⚠️
src/qibolab/instruments/qm.py 0.00% 4 Missing ⚠️
src/qibolab/instruments/rohde_schwarz.py 0.00% 4 Missing ⚠️
src/qibolab/_core/instruments/qm/config/config.py 0.00% 3 Missing ⚠️
.../qibolab/_core/instruments/qm/program/arguments.py 0.00% 3 Missing ⚠️
...bolab/_core/instruments/qm/program/instructions.py 0.00% 3 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##              0.2    #1030      +/-   ##
==========================================
+ Coverage   51.52%   52.34%   +0.81%     
==========================================
  Files          56       63       +7     
  Lines        2746     2820      +74     
==========================================
+ Hits         1415     1476      +61     
- Misses       1331     1344      +13     
Flag Coverage Δ
unittests 52.34% <76.55%> (+0.81%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stavros11 stavros11 mentioned this pull request Sep 8, 2024
5 tasks
src/qibolab/__init__.py Outdated Show resolved Hide resolved
@alecandido alecandido linked an issue Sep 16, 2024 that may be closed by this pull request
@alecandido
Copy link
Member Author

I decided to address also #1031 now (and not later on), because in this way we'll be able to enforce the usage of the public API.

Indeed, with the presence of _core, it won't be possible to import something private accidentally, since it will explicitly contain ._core in the qualifier.

It is taking a little bit more, but it should be the last step for 0.2 (but the README), and I deemed it relevant, since the focus we put on stability.

I'm sorry for the huge diff, but it will mostly consist of renamed files and fixed imports, including in tests and docs (which are relevant, since they will showcase the usage of the API).

@alecandido alecandido marked this pull request as ready for review September 17, 2024 15:44
@alecandido
Copy link
Member Author

@stavros11 now, many cross-references have ._core in their qualified path. This is suboptimal, since we're documenting internal implementation details.
But that is what it was, and I didn't aim to rewrite the docs in this paper. At least, it's a clear label of something that should be reassessed...

This is a breaking change for Qibocal, postponed until 0.2 for this reason
@alecandido
Copy link
Member Author

alecandido commented Sep 17, 2024

@stavros11 a08aaa4 is completing the implementation of #949, but it's also affecting mostly QM. If you can, during your review, confirm that QM is still working as expected.

Copy link
Member

@stavros11 stavros11 left a comment

Choose a reason for hiding this comment

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

Thanks @alecandido. I wrote a few more comments, but I think the only main issue to be addressed is the one regarding QubitId and QubitPairId. This will affect how I will update the qibolab0.2 branch of qibocal, so that I can also test if QM is working with the usual routines (so it is kind of blocking).

doc/source/tutorials/circuits.rst Show resolved Hide resolved
doc/source/tutorials/lab.rst Outdated Show resolved Hide resolved
src/qibolab/_core/dummy/platform.py Show resolved Hide resolved
src/qibolab/_core/execution_parameters.py Show resolved Hide resolved
tests/conftest.py Show resolved Hide resolved
tests/conftest.py Show resolved Hide resolved
Comment on lines +3 to +6
from qibolab._core.channel import Channel, ChannelMap
from qibolab._core.instruments.dummy import DummyLocalOscillator as LocalOscillator
from qibolab._core.instruments.qm import Octave, OPXplus, QMController
from qibolab._core.platform import Platform
Copy link
Member

Choose a reason for hiding this comment

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

These platforms under dummy_qrc could also serve as template on how to write platforms, so I would prefer to stick to public objects. However, these particular instances are quite outdated and given that we postponed the test refactoring to a later release, instead of doing the effort to update them, I would suggest to just remove these files.

I believe that the tests using them are skipped anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I applied the same policy of the docs: do not take a decision, apply the minimal update.

But your suggestion makes more sense, and I agree about dropping this (reintroducing at a later stage as a proper example).

ZiAcquisitionConfig,
ZiChannel,
ZiDcConfig,
ZiIqConfig,
Zurich,
)
from qibolab.kernels import Kernels
from qibolab.parameters import Parameters
from qibolab._core.kernels import Kernels
Copy link
Member

Choose a reason for hiding this comment

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

Following the previous comment, I don't think this path even exists anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I just completely ignored Zurich. This was the result of a bulk change, that I just post-controlled to not break anything relevant. I did not check it made sense in all the affected files.

I will apply the same resolution above, and remove the file.

@stavros11
Copy link
Member

About docs, I just tried to compile locally and I see that the API reference still has some references to internal packages, eg. "qibolab.compilers package", "qibolab.pulses package", etc and related submodules. The pages are empty, but still there. I have not checked but there are probably some leftovers within the sphinx code (.rst files). We should probably remove these.

@alecandido
Copy link
Member Author

About docs, I just tried to compile locally and I see that the API reference still has some references to internal packages, eg. "qibolab.compilers package", "qibolab.pulses package", etc and related submodules. The pages are empty, but still there. I have not checked but there are probably some leftovers within the sphinx code (.rst files). We should probably remove these.

Have you tried removing all the gitignored content in your repo?

I.e.:

git clean -fdx doc/

@stavros11
Copy link
Member

Have you tried removing all the gitignored content in your repo?

I.e.:

git clean -fdx doc/

That worked, thanks.

Copy link
Member

@stavros11 stavros11 left a comment

Choose a reason for hiding this comment

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

@stavros11 a08aaa4 is completing the implementation of #949, but it's also affecting mostly QM. If you can, during your review, confirm that QM is still working as expected.

I just updated qibocal and the platform and tested the single shot, Rabi amplitude and length routines and they all work on hardware. I redefined QubitId and QubitPairId in qibocal.auto.operation for that purpose (qiboteam/qibocal@a905fb4).

At these stage I believe the only open discussions are:

  • ExecutionParameters (could even be done in a different PR),
  • expose PLATFORMS (environment variable name) to public API or equivalent (trivial),
  • remove dummy_qrc platforms from tests (not fully relevant since tests are not strictly part of the qibolab package, thus internal). Btw, on this, I am already updating the QM platform for tests in Tests for QUA programs #1039, so you could even leave as it is here.

@alecandido
Copy link
Member Author

  • remove dummy_qrc platforms from tests (not fully relevant since tests are not strictly part of the qibolab package, thus internal). Btw, on this, I am already updating the QM platform for tests in

Ok, this I will as it is (including Zurich), but I'll address the others, including the docs, but excluding ExecutionParameters (at least if we decide it's too late, it's not affecting the rest).

@alecandido
Copy link
Member Author

I'm still missing a test for locate_platform(). I'll provide it asap.

@alecandido
Copy link
Member Author

alecandido commented Sep 19, 2024

@stavros11 this is now ready, I'll merge as soon as the CI will pass

@alecandido alecandido merged commit dff7479 into 0.2 Sep 19, 2024
28 checks passed
@alecandido alecandido deleted the public-api branch September 19, 2024 13:02
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.

Move content to a _core subpackage Check derivative imports Public API
3 participants