♻️ Central declarative SdConfig dataclass#274
Merged
Conversation
b057e25 to
204341c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
==========================================
+ Coverage 88.39% 89.95% +1.55%
==========================================
Files 11 12 +1
Lines 1043 1115 +72
==========================================
+ Hits 922 1003 +81
+ Misses 121 112 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
35e2235 to
0821409
Compare
All global configuration is declared once on a dataclass with typed, TOML-compatible fields, per-field validators and help text (modelled on myst-parser's MdParserConfig): flat sd_* confvals remain the public interface; modules read via a typed get_sd_config accessor; invalid values warn under design.config and fall back to defaults, with per-entry pruning for sd_custom_directives.
76a829c to
5664ce2
Compare
The rst/myst comment/target tests added in #271 broke the py311-no-myst tox env (not run in CI); guard the myst variants with the same skipif pattern used in test_snippets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Foundation for #265 §3.9: all global configuration is now declared once on a
SdConfigdataclass (sphinx_design/config.py), modelled on myst-parser'sMdParserConfig+dc_validatorspattern — per-field type, default, validator, and help text in field metadata, with every value TOML-representable (so config could later be read from a TOML file, or understood by non-Python implementations).sd_*confvals remain the public interface, registered by iterating the dataclass fields; modules read via a typedget_sd_config(env)accessor.sd_custom_directives,sd_fontawesome_latex) migrate with unchanged names, defaults, and semantics for valid configs; validation warnings unify underdesign.config(suppressible), running before Sphinx core's confval type check so users get one clear message.sd_custom_directivesentries are now warned about and dropped individually (previously some invalid shapes passed silently or half-registered; dropping also removes a latent crash when an invalid entry overrode a built-in directive name). Valid configs are byte-identical in behaviour.suppress_warningssupport, and a TOML round-trip via stdlibtomllibcovering every field.py311-no-mysttox env — the myst variants now carry the sameskipifguard astest_snippets.Upcoming options from the roadmap (tabs storage prefix, FontAwesome config, card legacy-syntax flag) land as fields here.
Validation at head:
tox -e py311(all passing incl. #270's i18n tests),py311-no-myst(fixed),mypy,ruff check/format,docs-alabaster— all green. Reviewed line-by-line (full diff) before merge per the new review gate.