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

♻️ Improve access to dynamic configs: extra_options, functions, warnings #1332

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

chrisjsewell
Copy link
Member

These three configurations are complicated by the fact that they can be set both in the conf.py configuration, but also via functions from sphinx_needs.api.

This has lead to confusion, when to use NEEDS_CONFIG and when to use NeedsSphinxConfig, and indeed I have already had to fix numerous bugs when NeedsSphinxConfig was incorrectly used

In this PR we split access to these configs into:

  • NeedsSphinxConfig._extra_options, NeedsSphinxConfig._functions, NeedsSphinxConfig._warnings, which access the "raw" sphinx configuration
  • NeedsSphinxConfig.extra_options, NeedsSphinxConfig.functions, NeedsSphinxConfig.warnings, which access the "combined" sphinx config + API added values

We also make NEEDS_CONFIG private and merge in the use of NEEDS_FUNCTIONS.
This makes the code less prone to mistakes in the use of the wrong variable

These three configurations are complicated by the fact that they can be set both in the `conf.py` configuration, but also via functions from `sphinx_needs.api`.

This has lead to confusion, when to use `NEEDS_CONFIG` and when to use `NeedsSphinxConfig` (which I have already had to fix numerous bugs for)

In this PR we make split access to these configs into:

- `NeedsSphinxConfig._extra_options`, `NeedsSphinxConfig._functions`, `NeedsSphinxConfig._warnings`, which access the "raw" sphinx configuration
- `NeedsSphinxConfig.extra_options`, `NeedsSphinxConfig.functions`, `NeedsSphinxConfig.warnings`, which access the "combined" sphinx config + API added values
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 91.08911% with 9 lines in your changes missing coverage. Please review.

Project coverage is 88.02%. Comparing base (4e10030) to head (662319c).
Report is 77 commits behind head on master.

Files with missing lines Patch % Lines
sphinx_needs/config.py 85.24% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1332      +/-   ##
==========================================
+ Coverage   86.87%   88.02%   +1.14%     
==========================================
  Files          56       60       +4     
  Lines        6532     7034     +502     
==========================================
+ Hits         5675     6192     +517     
+ Misses        857      842      -15     
Flag Coverage Δ
pytests 88.02% <91.08%> (+1.14%) ⬆️

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.

Copy link
Member

@ubmarco ubmarco left a comment

Choose a reason for hiding this comment

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

LGTM

@chrisjsewell chrisjsewell merged commit 7c05d59 into master Oct 25, 2024
17 checks passed
@chrisjsewell chrisjsewell deleted the dynamic-config branch October 25, 2024 12:33
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.

2 participants