Reframe shared CONSTANTS as an application-startup contract#283
Merged
Conversation
The docs taught the None sentinel and the shared-instance gotcha as surprising properties of the API. State the actual contract instead: CONSTANTS is for application-level configuration set once at startup -- the same role logging and locale play, since it's the only channel that reaches parses in code you don't own. Anything scoped to one dataset, one library, or one test should get its own Constants instance instead. The "Potential Gotcha" framing in both customize.rst and the config module docstring is now presented as a consequence of mixing the two up, not a surprise. No behavior change -- docs only. Fixes #262.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #283 +/- ##
=======================================
Coverage 97.70% 97.70%
=======================================
Files 13 13
Lines 917 917
=======================================
Hits 896 896
Misses 21 21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The pointer sent readers to "Module-level Shared Configuration Instance" for private-config guidance, but that section title reads as being about the shared instance, not the private alternative -- name what's actually there (the three explicit forms) instead. Found in review of #283.
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.
Summary
customize.rstand thenameparser.configmodule docstring previously taught theNonesentinel and the shared-instance gotcha as surprising properties of the API (a bolded "Potential Gotcha" callout).CONSTANTSis for application-level configuration set once at startup -- the same rolelogging/localeplay, since it's the only channel that reaches parses in code you don't own (helpers, pipelines, third-party libraries). Anything scoped to one dataset, one library, or one test should get its ownConstantsinstance.Constants()/CONSTANTS.copy()) that Add Constants.copy(); deprecate constants=None #260 added.Test plan
pytest tests/ nameparser/-- 1502 passed, 4 skipped, 22 xfailed, no regressions (doctests in the touched module still pass)mypy nameparser/ tests/-- cleancustomize.rst-- no new failures near the edited sectionsFixes #262