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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敡 Consolidate needs data post-processing #1039

Merged
merged 1 commit into from Sep 28, 2023

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Sep 28, 2023

This PR is a step towards #1018, and being able to generate the needs.json without running the Sphinx BUILD phase.

Here we consolidate all functions that post-process the needs data, after it has been fully extracted from all documents and external sources.
We remove the individual logic from within these functions, to check if the post-processing has already been done, and instead check before running all the functions.

This refactor does not actually change the sphinx-needs process in any way, this will come in later PRs

@danwos
Copy link
Member

danwos commented Sep 28, 2023

#1036 got accepted and is ready for merge. After that I review this PR :)

@chrisjsewell
Copy link
Member Author

#1036 got accepted and is ready for merge. After that I review this PR :)

Rebased and good for review @danwos 馃槃

create_back_links(env, links["option"])

process_constraints(app)
if not needs_data.needs_is_post_processed:
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the main change; we move all needs post-processing under a single if block, which only gets run once (not for every document)

# We call process_needextend here by our own, so that we are able
# to give print_need_nodes the already found need_nodes.
process_needextend(app, doctree, fromdocname)
for extend_node in doctree.findall(Needextend):
Copy link
Member Author

Choose a reason for hiding this comment

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

This is split out from the original process_needextend function, since it is not part of the needs data post-processing

check_links(env)
create_back_links(env)
process_constraints(app)
extend_needs_data(app)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is process_needextend, but with the removal of nodes

resolve_dynamic_values(env)
resolve_variants_options(env)
check_links(env)
create_back_links(env)
Copy link
Member Author

Choose a reason for hiding this comment

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

looping through all link types is also moved internal to the create_back_links function

Copy link
Member

@danwos danwos 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 cleaning this up a little bit.
Looks good to me.

@chrisjsewell chrisjsewell merged commit 0f0ae77 into master Sep 28, 2023
12 checks passed
@chrisjsewell chrisjsewell deleted the consolidate-need-post-processing branch September 28, 2023 13:59
iSOLveIT pushed a commit that referenced this pull request Oct 24, 2023
This commit is a step towards being able to generate the needs.json without running the Sphinx `BUILD` phase.

Here we consolidate all functions that post-process the needs data, after it has been fully extracted from all documents and external sources.
We remove the individual logic from within these functions, to check if the post-processing has already been done, and instead check before running all the functions.

This refactor does not actually change the sphinx-needs process in any way, this will come later.
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

2 participants