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 script to migrate to new guides/ structure #1294

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

Eric-Arellano
Copy link
Collaborator

@Eric-Arellano Eric-Arellano commented May 3, 2024

This is the first step in #1297.

We're going to be making last-minute changes for the docs reorg, such as finalizing URLs at the last minute. So, it's useful to have a program that can immediately regenerate the entire migration for us at any time. This program will eventually generate two commits:

  1. Move files to guides/
  2. Update non-API internal links, like /run/my-page to /guides/my-page

Thanks to this script being checked in to version control beforehand, we will have less code to review in the final migration PR.

This program is not going to be permanent. We decided in #1299 that we will not generate the Workflow index pages longterm, only in this initial PR. Instead, we'll add a validation check. So this program is only temporary while we work on the migration.

Follow up improvements

This PR is only the initial foundation of the migration program. Remaining tasks:

@Eric-Arellano Eric-Arellano changed the title [proof of concept] different docs reorganization layouts [proof of concept] new docs layout May 23, 2024
@javabster

This comment was marked as outdated.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Eric-Arellano Eric-Arellano changed the title [proof of concept] new docs layout Add script to migrate to new guides/ structure May 29, 2024
@@ -0,0 +1,538 @@
# This code is a Qiskit project.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This file can be mostly skimmed. We'll work closely with the content team to finalize the page titles and new URLs. This file is the Source Of Truth™️ for the migration.

Comment on lines +25 to +27
# ------------------------------------------------------------------------------
# Standalone pages
# ------------------------------------------------------------------------------
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The comments in this section are probably worth reading. It took me a while to figure out how to handle the situation.

Comment on lines +532 to +533
Entry("Get started"),
*GET_STARTED_CHILDREN,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will be revamped once we have proper label support

class Entry:
title: str
slug: str | None = field(default=None, kw_only=True)
children: tuple[Entry, ...] = field(default_factory=lambda: (), kw_only=True)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI tuple[X, ...] is the immutable version of list[X]. We need it to be immutable to set frozen=True. I originally was using list and didn't care about immutability, but it resulted in a bug with filter_entries, so I switched to this style.

Comment on lines +72 to +74
def entries_as_markdown_list(
entries: tuple[Entry, ...], *, indent: None | str = None
) -> str:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There might be a more readable way to write this than how I did it with indent. But it's working well, and this program is temporary, so it's probably fine

@@ -0,0 +1,205 @@
# This code is a Qiskit project.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No need to review closely this file. The content team will revamp it over time.

@@ -0,0 +1,69 @@
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This page is auto-generated.

We may want the data in alternative formats for future uses like setting up redirects in closed source. We can easily re-generate the file however we want.

@Eric-Arellano Eric-Arellano marked this pull request as ready for review May 29, 2024 21:15
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.

None yet

3 participants