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

Move qiskit-tutorials into this repository #10710

Merged
merged 138 commits into from
Sep 8, 2023

Conversation

Eric-Arellano
Copy link
Collaborator

@Eric-Arellano Eric-Arellano commented Aug 25, 2023

https://github.com/Qiskit/qiskit-tutorials has been archived because the docs are now built in this repository and we want to simplify our docs infrastructure.

This PR merges the qiskit-tutorials repository here for the relevant tutorials, preserving its Git history. It uses git-filter-repo to tweak the Git history of qiskit-tutorials to be consumable in this repository, such as changing of tutorials/ to be docs/tutorials. It also prunes irrelevant commits since we only copy over the tutorials that are currently in use and we ignore files like README.md that aren't copied over.

See tutorials_migration.zip for how the migration was generated; credit to @jakelishman for the original script used in #10611. Then, I used git merge --allow-unrelated-histories qiskit-tutorials/master, with the remote qiskit-tutorials pointed at the prepared local repository.

The merge was clean. This PR adds two commits on tip:

  • Removes the prepare_tutorials.bash script and placeholder tutorials that were used to download the tutorials from qiskit-tutorials dynamically. No need now that they live in the same repository.
  • Updates the tutorials with the most recently executed versions from CI.

nonhermitian and others added 30 commits April 25, 2020 23:49
…other_optims

Add other optimization notebooks and fixes
* Set up CI with Azure Pipelines

This commit adds the CI configuration for running sphinx builds in CI. [skip ci]

* Add missing dep and start caching pip

* Install pandoc and graphviz

* Add cvxpy install for aer noise transformations

* Move aqua tutorials that depend on CPLEX to legacy_tutorials

There are 2 aqua tutorials that do not work unless CPLEX is installed.
CPLEX is too involved and difficult to install in CI. It is also
proprietary software which prohibits installing it in CI (since a CI
system can't agree to the license terms). Honestly, I'm not entirely
sure why aqua has modules in it that depend solely on having proprietary
software installed, it feels like there should be an open alternative or
if there is one already the tutorial should leverage that. To make the
docs buildable this commit moves these problematic tutorials to the
legacy directory so they're not built/run by default.

* Workaround terra mpl drawer bug

There is a bug in the mpl drawer in 0.19.0 (and 0.19.1) release where a
custom instruction does not draw without a label parameter set. This
will need to be fixed in terra, but in the meantime this worksaround the
bug by manually setting a label.

* Add texlive to installed packages

* Install correct texlive metapackage with qcircuit

* Correct package name again

* Add another missing binary dep

* Update qcircuit version as packaged version is too old

* Try using tlmgr instead of manually downloading qcircuit

* Try using more from tlmgr instead of apt

* Fix typo

* Use bash directly

* Adjust texlive update script usage

* Give up on tlmgr and try to manual install qcircuit again

* Fix typo

* revert aqua tutorial move and remove latex install

* Remove section of aqua notebook 2 that requires cplex

* Remove another notebook with cplex
…circuits_1

fix spacing around equations in circuits_1
…transpiler_notebook

Update 4_transpiler_passes_and_passmanager.ipynb
I found it confusing when reading initially, and hence wanted to reiterate that the qubit representing
the MSB is left-most, indexed with 0.
Minor improvements to Getting Started tutorials.
…pulse_tutorials

add working pulse tutorials
changed \\rho  to $\rho$ in the visualization markdown cell of statevector backend
…qiskitissue983

Fix for plot_state list and reordered functions
@1ucian0 1ucian0 added this pull request to the merge queue Sep 5, 2023
@jakelishman
Copy link
Member

jakelishman commented Sep 5, 2023

Given the latest discussion on documentation structure, are we still going ahead with this?

(Just removed from queue pending an answer - feel free to re-add if the answer is yes.)

@jakelishman jakelishman removed this pull request from the merge queue due to a manual request Sep 5, 2023
@1ucian0 1ucian0 added the on hold Can not fix yet label Sep 5, 2023
@Eric-Arellano
Copy link
Collaborator Author

Eric-Arellano commented Sep 5, 2023

Given the latest discussion on documentation structure, are we still going ahead with this?

Yes, we are going ahead with this. qiskit.org/documentation will not be removed until OneDocs has feature parity. We are not going to change the deploy for qiskit.org/documentation - it will stay this Sphinx setup.

We are moving with urgency to avoid being in a split state for too long. It's not ideal for anyone. (But, it's a huge project so may still take until ~December.)

@jakelishman jakelishman added this pull request to the merge queue Sep 5, 2023
@jakelishman
Copy link
Member

That's ok if the timeline for 1docs migration is still months. I just didn't want us to merge a huge amount of code into this repo that we were going to remove five minutes later.

@jakelishman jakelishman removed this pull request from the merge queue due to a manual request Sep 5, 2023
@jakelishman
Copy link
Member

Wait sorry, this commit shouldn't be squash-merged, so shouldn't go through the queue. We might want to regenerate it with a new filter when there's a clean time to merge so it's up-to-date without including a wrong-way merge in the history.

@mtreinish
Copy link
Member

mtreinish commented Sep 5, 2023

We should not use the merge queue for this PR, instead I'll manually merge commit it as a repo admin. I'll take a look at it tomorrow morning

@jakelishman
Copy link
Member

Also: I'm fairly sure that the "merge" went a little wrong here: it looks pretty like it was actually rebased over 021b0ff rather than an unrelated-histories merge (because all the commits have been re-committed, and the base of this PR has the mentioned commit as a parent).

@Eric-Arellano
Copy link
Collaborator Author

it looks pretty like it was actually rebased over 021b0ff rather than an unrelated-histories merge (because all the commits have been re-committed, and the base of this PR has the mentioned commit as a parent).

Yeah I think that's right.

I hopefully got it right with this force push. I did git rebase -i upstream/main and removed all commits so it's like this was upstream/main. Then, git merge --allow-unrelated-histories qiskit-tutorials/master. Then, git cherry-pick for the two manual commits I wrote.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Thanks for re-doing the merge; it looks correct to me now. I think we can admin-merge this once Matt comes online. I'll try and make sure that nothing else merges in the interim so there's no chance of a mess up when we skip the queue CI.

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

This LGTM, thanks for doing this. The only tutorials I was confused by at first was the opflow overview and the gradients framework ones as both functions are deprecated. But we should keep those documented through their deprecation period still so having them migrated is fine even if we end up deleting them in a few months.

@mtreinish mtreinish added documentation Something is not clear or an error documentation Changelog: None Do not include in changelog and removed on hold Can not fix yet labels Sep 8, 2023
@mtreinish mtreinish merged commit c20356b into Qiskit:main Sep 8, 2023
14 checks passed
@Eric-Arellano Eric-Arellano deleted the merge-tutorials branch September 8, 2023 12:29
Eric-Arellano added a commit to Qiskit/documentation that referenced this pull request Oct 4, 2023
Closes #21. 

The code was copied with the below script. The closed source repository
got most of its content from open source, but did not use a Git
migration to transfer over commit history. So rather than using a Git
migration like we did with `qiskit-tutorials`
(Qiskit/qiskit#10710), this manually attributes
relevant contributors for the files they had an influence on.

```python
import shutil
import subprocess
from dataclasses import dataclass
from pathlib import Path

IQP_ROOT = Path("../iqp-channel-docs")
DOCS_ROOT = Path("./")


@DataClass(frozen=True)
class Author:
    name: str
    email: str

    def commit_line(self) -> str:
        return f"Co-authored-by: {self.name} <{self.email}>"


AXEL = Author("Axel Hernández Ferrera", "axelhzf@gmail.com")
ABBY_C = Author("Abby Cross", "across@us.ibm.com")
BECKY = Author("Rebecca Dimock", "66339736+beckykd@users.noreply.github.com")
FRANK = Author("Frank Harkins", "frankharkins@hotmail.co.uk")
KEVIN = Author("Kevin Tian", "kevin.tian@ibm.com")
JESSIE = Author("Jessie Yu", "jessieyu@us.ibm.com")
ELENA = Author("Elena Peña Tapia", "57907331+ElePT@users.noreply.github.com")
PAUL_N = Author("Paul Nation", "nonhermitian@gmail.com")
SOOLU = Author("Soolu Thomas", "soolu.thomas@ibm.com")
THOMAS_A = Author("Thomas Alexander", "thomas.a.alexander@ibm.com")
JAKE_L = Author("Jake Lishman", "jake.lishman@ibm.com")
MICHAEL_H = Author("Michael Healy", "mbhealy@ibm.com")
MARIUS = Author("Marius Hillenbrand", "marius.hillenbrand@ibm.com")
REZA = Author("Reza Jokar", "jokar@ibm.com")


def main() -> None:
    # Copy images
    copy_image_folders(
        [
            "build",
            "migration",
            "optimize",
            "qiskit-ibm-runtime",
            "run",
            "start",
        ]
    )
    commit("Migrate images from closed source", [])

    # Copy TOC files
    copy_docs_files(
        [
            "build/_toc.json",
            "optimize/_toc.json",
            "run/_toc.json",
            "start/_toc.json",
            "test/_toc.json",
        ]
    )
    commit("Migrate TOC files from closed source", [AXEL])

    # Copy original content
    copy_docs_files(
        [
            "start/index.mdx",
            "start/install.mdx",
            "start/intro-to-qiskit.ipynb",
            "start/runtime.mdx",
            "build/index.mdx",
            "build/first-circuit.mdx",
            "build/operators_overview.ipynb",
            "build/primitives.mdx",
            "build/primitives-get-started.mdx",
            "build/primitives-examples.mdx",
            "build/feature-table.mdx",
            "build/backend_reset.ipynb",
            "build/pulse.ipynb",
            "test/index.mdx",
            "test/simulators.mdx",
            "optimize/index.mdx",
            "run/hardware.mdx",
            "run/instances.mdx",
            "run/backends.mdx",
            "run/estimate-job.mdx",
            "run/queue.mdx",
            "run/circuit-execution.mdx",
            "run/reserve-system-time.mdx",
            "run/retired-systems.mdx",
        ]
    )
    commit("Migrate original content from closed source", [ABBY_C, BECKY])

    # Copy hello world
    copy_docs_files(["start/hello-world.ipynb"])
    commit("Migrate Hello World guide from closed source", [FRANK, BECKY, ABBY_C])

    # Copy runtime migration guides
    copy_docs_files(
        ["start/compare.mdx", "start/migrate.mdx", "start/migrate-examples.mdx"]
    )
    commit(
        "Migrate Runtime migration guides from closed source",
        [JESSIE, KEVIN, BECKY, FRANK, ELENA],
    )

    # Copy dynamic circuits
    copy_docs_files(
        [
            "build/getting-started-with-dynamic-circuits.ipynb",
            "build/midcircuit_measurement.ipynb",
            "build/dynamic-circuits-basics-with-qiskit.ipynb",
            "build/dynamic-circuits-basics-with-openqasm3.ipynb",
        ]
    )
    commit(
        "Migrate Dynamic Circuits content from closed source",
        [SOOLU, THOMAS_A, JAKE_L, MARIUS, MICHAEL_H, REZA, BECKY, ABBY_C],
    )

    # Copy runtime content
    copy_docs_files(
        [
            "build/primitive-options.mdx",
            "test/noise.mdx",
            "optimize/algorithm-tuning-options.mdx",
            "optimize/error-mitigation.mdx",
            "optimize/error-suppression.mdx",
            "run/account-management.mdx",
            "run/sessions.mdx",
            "run/run-sessions.mdx",
            "run/monitor.mdx",
            "run/cost.mdx",
            "run/max-execution-time.mdx",
        ]
    )
    commit(
        "Migrate Runtime content from closed source",
        [JESSIE, KEVIN, BECKY, ABBY_C],
    )

    # Copy Aer tutorial
    copy_docs_files(["test/building_noise_models.ipynb"])
    commit("Migrate Aer noise model from closed source", [PAUL_N])


def copy_docs_files(files: list[str]) -> None:
    for f in files:
        dest = DOCS_ROOT / "docs" / f
        dest.parent.mkdir(parents=True, exist_ok=True)
        shutil.copy(IQP_ROOT / "docs" / f, dest)


def copy_image_folders(folders: list[str]) -> None:
    for folder in folders:
        shutil.copytree(
            IQP_ROOT / "packages" / "web" / "public" / "images" / folder,
            DOCS_ROOT / "public" / "images" / folder,
        )


def commit(msg: str, authors: list[Author]) -> None:
    subprocess.run(["git", "add", "."], check=True)
    if authors:
        author_lines = "\n".join(author.commit_line() for author in authors)
        msg += f"\n\n{author_lines}"
    subprocess.run(["git", "commit", "-m", msg], check=True)


main()
```
Eric-Arellano pushed a commit to Qiskit/documentation that referenced this pull request Oct 6, 2023
https://github.com/Qiskit/qiskit-tutorials has been archived because the
docs are now built in this repository and we want to simplify our docs
infrastructure.

This PR merges the qiskit-tutorials repository here for the relevant
tutorials, preserving its Git history. It uses `git-filter-repo` to
tweak the Git history of `qiskit-tutorials` to be consumable in this
repository, such as changing of `tutorials/` to be `docs/tutorials`. It
also prunes irrelevant commits since we only copy over the tutorials
that are currently in use and we ignore files like README.md that aren't
copied over.

See
[tutorials_migration.zip](https://github.com/Qiskit/qiskit/files/12442282/tutorials_migration.zip)
for how the migration was generated; credit to @jakelishman for the
original script used in Qiskit/qiskit#10611.
Then, I used `git merge --allow-unrelated-histories
qiskit-tutorials/master`, with the remote `qiskit-tutorials` pointed at
the prepared local repository.

The merge was clean. This PR adds two commits on tip:

* Removes the `prepare_tutorials.bash` script and placeholder tutorials
that were used to download the tutorials from `qiskit-tutorials`
dynamically. No need now that they live in the same repository.
* Updates the tutorials with the most recently executed versions from
CI.
Eric-Arellano pushed a commit to Qiskit/documentation that referenced this pull request Oct 9, 2023
https://github.com/Qiskit/qiskit-tutorials has been archived because the
docs are now built in this repository and we want to simplify our docs
infrastructure.

This PR merges the qiskit-tutorials repository here for the relevant
tutorials, preserving its Git history. It uses `git-filter-repo` to
tweak the Git history of `qiskit-tutorials` to be consumable in this
repository, such as changing of `tutorials/` to be `docs/tutorials`. It
also prunes irrelevant commits since we only copy over the tutorials
that are currently in use and we ignore files like README.md that aren't
copied over.

See
[tutorials_migration.zip](https://github.com/Qiskit/qiskit/files/12442282/tutorials_migration.zip)
for how the migration was generated; credit to @jakelishman for the
original script used in Qiskit/qiskit#10611.
Then, I used `git merge --allow-unrelated-histories
qiskit-tutorials/master`, with the remote `qiskit-tutorials` pointed at
the prepared local repository.

The merge was clean. This PR adds two commits on tip:

* Removes the `prepare_tutorials.bash` script and placeholder tutorials
that were used to download the tutorials from `qiskit-tutorials`
dynamically. No need now that they live in the same repository.
* Updates the tutorials with the most recently executed versions from
CI.
Eric-Arellano pushed a commit to Qiskit/documentation that referenced this pull request Oct 12, 2023
https://github.com/Qiskit/qiskit-tutorials has been archived because the
docs are now built in this repository and we want to simplify our docs
infrastructure.

This PR merges the qiskit-tutorials repository here for the relevant
tutorials, preserving its Git history. It uses `git-filter-repo` to
tweak the Git history of `qiskit-tutorials` to be consumable in this
repository, such as changing of `tutorials/` to be `docs/tutorials`. It
also prunes irrelevant commits since we only copy over the tutorials
that are currently in use and we ignore files like README.md that aren't
copied over.

See
[tutorials_migration.zip](https://github.com/Qiskit/qiskit/files/12442282/tutorials_migration.zip)
for how the migration was generated; credit to @jakelishman for the
original script used in Qiskit/qiskit#10611.
Then, I used `git merge --allow-unrelated-histories
qiskit-tutorials/master`, with the remote `qiskit-tutorials` pointed at
the prepared local repository.

The merge was clean. This PR adds two commits on tip:

* Removes the `prepare_tutorials.bash` script and placeholder tutorials
that were used to download the tutorials from `qiskit-tutorials`
dynamically. No need now that they live in the same repository.
* Updates the tutorials with the most recently executed versions from
CI.
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
Closes Qiskit#21. 

The code was copied with the below script. The closed source repository
got most of its content from open source, but did not use a Git
migration to transfer over commit history. So rather than using a Git
migration like we did with `qiskit-tutorials`
(Qiskit/qiskit#10710), this manually attributes
relevant contributors for the files they had an influence on.

```python
import shutil
import subprocess
from dataclasses import dataclass
from pathlib import Path

IQP_ROOT = Path("../iqp-channel-docs")
DOCS_ROOT = Path("./")


@DataClass(frozen=True)
class Author:
    name: str
    email: str

    def commit_line(self) -> str:
        return f"Co-authored-by: {self.name} <{self.email}>"


AXEL = Author("Axel Hernández Ferrera", "axelhzf@gmail.com")
ABBY_C = Author("Abby Cross", "across@us.ibm.com")
BECKY = Author("Rebecca Dimock", "66339736+beckykd@users.noreply.github.com")
FRANK = Author("Frank Harkins", "frankharkins@hotmail.co.uk")
KEVIN = Author("Kevin Tian", "kevin.tian@ibm.com")
JESSIE = Author("Jessie Yu", "jessieyu@us.ibm.com")
ELENA = Author("Elena Peña Tapia", "57907331+ElePT@users.noreply.github.com")
PAUL_N = Author("Paul Nation", "nonhermitian@gmail.com")
SOOLU = Author("Soolu Thomas", "soolu.thomas@ibm.com")
THOMAS_A = Author("Thomas Alexander", "thomas.a.alexander@ibm.com")
JAKE_L = Author("Jake Lishman", "jake.lishman@ibm.com")
MICHAEL_H = Author("Michael Healy", "mbhealy@ibm.com")
MARIUS = Author("Marius Hillenbrand", "marius.hillenbrand@ibm.com")
REZA = Author("Reza Jokar", "jokar@ibm.com")


def main() -> None:
    # Copy images
    copy_image_folders(
        [
            "build",
            "migration",
            "optimize",
            "qiskit-ibm-runtime",
            "run",
            "start",
        ]
    )
    commit("Migrate images from closed source", [])

    # Copy TOC files
    copy_docs_files(
        [
            "build/_toc.json",
            "optimize/_toc.json",
            "run/_toc.json",
            "start/_toc.json",
            "test/_toc.json",
        ]
    )
    commit("Migrate TOC files from closed source", [AXEL])

    # Copy original content
    copy_docs_files(
        [
            "start/index.mdx",
            "start/install.mdx",
            "start/intro-to-qiskit.ipynb",
            "start/runtime.mdx",
            "build/index.mdx",
            "build/first-circuit.mdx",
            "build/operators_overview.ipynb",
            "build/primitives.mdx",
            "build/primitives-get-started.mdx",
            "build/primitives-examples.mdx",
            "build/feature-table.mdx",
            "build/backend_reset.ipynb",
            "build/pulse.ipynb",
            "test/index.mdx",
            "test/simulators.mdx",
            "optimize/index.mdx",
            "run/hardware.mdx",
            "run/instances.mdx",
            "run/backends.mdx",
            "run/estimate-job.mdx",
            "run/queue.mdx",
            "run/circuit-execution.mdx",
            "run/reserve-system-time.mdx",
            "run/retired-systems.mdx",
        ]
    )
    commit("Migrate original content from closed source", [ABBY_C, BECKY])

    # Copy hello world
    copy_docs_files(["start/hello-world.ipynb"])
    commit("Migrate Hello World guide from closed source", [FRANK, BECKY, ABBY_C])

    # Copy runtime migration guides
    copy_docs_files(
        ["start/compare.mdx", "start/migrate.mdx", "start/migrate-examples.mdx"]
    )
    commit(
        "Migrate Runtime migration guides from closed source",
        [JESSIE, KEVIN, BECKY, FRANK, ELENA],
    )

    # Copy dynamic circuits
    copy_docs_files(
        [
            "build/getting-started-with-dynamic-circuits.ipynb",
            "build/midcircuit_measurement.ipynb",
            "build/dynamic-circuits-basics-with-qiskit.ipynb",
            "build/dynamic-circuits-basics-with-openqasm3.ipynb",
        ]
    )
    commit(
        "Migrate Dynamic Circuits content from closed source",
        [SOOLU, THOMAS_A, JAKE_L, MARIUS, MICHAEL_H, REZA, BECKY, ABBY_C],
    )

    # Copy runtime content
    copy_docs_files(
        [
            "build/primitive-options.mdx",
            "test/noise.mdx",
            "optimize/algorithm-tuning-options.mdx",
            "optimize/error-mitigation.mdx",
            "optimize/error-suppression.mdx",
            "run/account-management.mdx",
            "run/sessions.mdx",
            "run/run-sessions.mdx",
            "run/monitor.mdx",
            "run/cost.mdx",
            "run/max-execution-time.mdx",
        ]
    )
    commit(
        "Migrate Runtime content from closed source",
        [JESSIE, KEVIN, BECKY, ABBY_C],
    )

    # Copy Aer tutorial
    copy_docs_files(["test/building_noise_models.ipynb"])
    commit("Migrate Aer noise model from closed source", [PAUL_N])


def copy_docs_files(files: list[str]) -> None:
    for f in files:
        dest = DOCS_ROOT / "docs" / f
        dest.parent.mkdir(parents=True, exist_ok=True)
        shutil.copy(IQP_ROOT / "docs" / f, dest)


def copy_image_folders(folders: list[str]) -> None:
    for folder in folders:
        shutil.copytree(
            IQP_ROOT / "packages" / "web" / "public" / "images" / folder,
            DOCS_ROOT / "public" / "images" / folder,
        )


def commit(msg: str, authors: list[Author]) -> None:
    subprocess.run(["git", "add", "."], check=True)
    if authors:
        author_lines = "\n".join(author.commit_line() for author in authors)
        msg += f"\n\n{author_lines}"
    subprocess.run(["git", "commit", "-m", msg], check=True)


main()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog documentation Something is not clear or an error documentation
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.