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

馃敡 Centralise access to sphinx-needs config #998

Merged
merged 1 commit into from Aug 28, 2023
Merged

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Aug 27, 2023

similar to #987, accessing sphinx-needs configuration via the sphinx Config object is difficult to work with and ensure type safety, due to its dynamic nature.

This PR moves all configuration specification to the NeedsSphinxConfig class, which is a thin wrapper around the sphinx Config, to define and provide type safe access to the sphinx-need specific configuration.

This is non-breaking change, since all configuration can still be accessed via the sphinx Config, (although this is discouraged).

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.

Ok, that's smart and a great example of the dataclasses benefits.
I like it 馃憤

@chrisjsewell chrisjsewell merged commit 1ecb2b7 into master Aug 28, 2023
10 checks passed
@chrisjsewell chrisjsewell deleted the type-config branch August 28, 2023 04:51
chrisjsewell added a commit that referenced this pull request Aug 29, 2023
This PR adds strict typing to most of the package, building on #987 and #998 to try to confine use of dynamic types to a small surface area.
This hopefully makes it easier for developers to navigate the code base, and lessens the potential for bugs arising from type mismatches.

---

There are still some open questions, particularly around `NeedsInfoType`, which

1. has some dynamic fields (such as user defined links/options) and,
2. has some fields which are only set after post-transforms (such `process_need_nodes`)
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