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

Qiskit docs generation only changes release notes for its own version #860

Merged
merged 5 commits into from
Feb 23, 2024

Conversation

arnaucasau
Copy link
Collaborator

@arnaucasau arnaucasau commented Feb 21, 2024

Summary

Part of #755

This PR changes the logic of the API generation script to only modify the release notes file of the version we are regenerating at that moment. Before, the release notes files contained more than one version, and we needed to update several files, independently of what version we were regenerating. After Qiskit/qiskit#11840, we can assume that the release notes files will only contain their own versions, and we can simply our script by removing some functions.

New logic

The API generation script will transform every link of the release notes files to point to its version folder instead of the top level. Once we have the correct links, we will directly write the release notes file, if we didn't have them before, or otherwise, we will create a new file containing the header of the old file we had and the version sections of the new one downloaded from Box. That way, we can make manual changes like the table added in the release notes of qiskit 0.44 without losing them in the next regeneration.

Functions removed

This change allows us to remove the following two functions:

The extractMarkdownReleaseNotesPatches function extracted all the versions in a release notes file and stored the markdown of each patch to posteriorly merge them under their minor version file. Now we have one minor version per file, so we don't need to break the release notes into pieces anymore. The new logic treats all patch versions as a block.

The sortReleaseNotesVersions were used to sort the patch versions. Given that the file will have the correct order, we don't need to worry about it either.

Removing these two functions allows us to remove the test file, given that they composed the entire file.

@arnaucasau arnaucasau marked this pull request as ready for review February 21, 2024 13:42
@arnaucasau arnaucasau changed the title [WIP] API generation script: change release notes logic API generation script: change release notes logic Feb 21, 2024
Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

🙌

@@ -102,6 +102,11 @@ async function copyApiDocsAndUpdateLinks(
),
);
}

const source = `${getRoot()}/docs/api/${pkgName}/release-notes/${versionWithoutPatch}.md`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

source is a vague name. How about releaseNotePath?

Comment on lines 147 to 149
/**
* Updates the release notes folder by adding the notes to their corresponding version
* file.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function docstring and function name are too general. It should now only be about writing for a specific version, like writeReleaseNoteForVersion

@Eric-Arellano Eric-Arellano changed the title API generation script: change release notes logic Qiskit docs generation only changes release notes for its own version Feb 22, 2024
@arnaucasau arnaucasau added this pull request to the merge queue Feb 23, 2024
@arnaucasau arnaucasau removed this pull request from the merge queue due to a manual request Feb 23, 2024
@arnaucasau arnaucasau added this pull request to the merge queue Feb 23, 2024
Merged via the queue into Qiskit:main with commit 3ca6915 Feb 23, 2024
6 checks passed
@arnaucasau arnaucasau deleted the AC/single-release-notes branch February 23, 2024 11:32
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
…Qiskit#860)

### Summary 

Part of Qiskit#755

This PR changes the logic of the API generation script to only modify
the release notes file of the version we are regenerating at that
moment. Before, the release notes files contained more than one version,
and we needed to update several files, independently of what version we
were regenerating. After Qiskit/qiskit#11840, we
can assume that the release notes files will only contain their own
versions, and we can simply our script by removing some functions.

### New logic

The API generation script will transform every link of the release notes
files to point to its version folder instead of the top level. Once we
have the correct links, we will directly write the release notes file,
if we didn't have them before, or otherwise, we will create a new file
containing the header of the old file we had and the version sections of
the new one downloaded from Box. That way, we can make manual changes
like the table added in the release notes of qiskit 0.44 without losing
them in the next regeneration.

### Functions removed

This change allows us to remove the following two functions:

The `extractMarkdownReleaseNotesPatches` function extracted all the
versions in a release notes file and stored the markdown of each patch
to posteriorly merge them under their minor version file. Now we have
one minor version per file, so we don't need to break the release notes
into pieces anymore. The new logic treats all patch versions as a block.

The `sortReleaseNotesVersions` were used to sort the patch versions.
Given that the file will have the correct order, we don't need to worry
about it either.

Removing these two functions allows us to remove the test file, given
that they composed the entire file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants