Skip to content

Reframe shared CONSTANTS as an application-startup contract#283

Merged
derek73 merged 2 commits into
masterfrom
docs/262-constants-contract-reframe
Jul 12, 2026
Merged

Reframe shared CONSTANTS as an application-startup contract#283
derek73 merged 2 commits into
masterfrom
docs/262-constants-contract-reframe

Conversation

@derek73

@derek73 derek73 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • customize.rst and the nameparser.config module docstring previously taught the None sentinel and the shared-instance gotcha as surprising properties of the API (a bolded "Potential Gotcha" callout).
  • Reframes both as a contract stated up front: CONSTANTS is for application-level configuration set once at startup -- the same role logging/locale play, 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 own Constants instance.
  • The old gotcha framing is now presented as a consequence of mixing the two up, not a surprise -- and folds in the three-spelling vocabulary (Constants() / CONSTANTS.copy()) that Add Constants.copy(); deprecate constants=None #260 added.
  • Docs only, no behavior change.

Test plan

  • pytest tests/ nameparser/ -- 1502 passed, 4 skipped, 22 xfailed, no regressions (doctests in the touched module still pass)
  • mypy nameparser/ tests/ -- clean
  • Manual doctest sanity-check of customize.rst -- no new failures near the edited sections

Fixes #262

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-commenter

codecov-commenter commented Jul 12, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.70%. Comparing base (18c9b6a) to head (381ca36).
⚠️ Report is 3 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
@derek73 derek73 merged commit 8f570ce into master Jul 12, 2026
8 checks passed
@derek73 derek73 deleted the docs/262-constants-contract-reframe branch July 12, 2026 02:37
@derek73 derek73 self-assigned this Jul 12, 2026
@derek73 derek73 added this to the v1.4 milestone Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: reframe shared CONSTANTS as an application-startup contract

2 participants