Skip to content

Move url configs to strax - #1020

Open
WenzDaniel wants to merge 7 commits into
masterfrom
move_url_configs_to_strax
Open

WenzDaniel wants to merge 7 commits into
masterfrom
move_url_configs_to_strax

Conversation

@WenzDaniel

@WenzDaniel WenzDaniel commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

What is the problem / what does the code in this PR do
In this PR we move the URL config engine from straxen to strax. This allows packages to be independent of straxen. For example when developing a straxen-like package for a local TPC. We do not moce any of the already existing protocols yet.

This PR only works in combination with straxen PR #1686.

What changed

  • strax/utils.py: three generic helpers moved over from straxen/misc.py: filter_kwargs, CacheDict and total_size. The code is unchanged.
  • strax/url_config.py (new): URLConfig, clear_config_caches and config_cache_size_mb, copied from straxen/config/url_config.py. The only changes are imports. pydantic is imported from pydantic.v1 when that exists, and from pydantic otherwise. Both give the same v1 validation, so pydantic 1.10 and 2.x both work.
  • strax/__init__.py: exports the new module (after config, because URLConfig subclasses strax.Config).
  • pyproject.toml: adds pydantic >= 1.10 as a dependency. straxen has relied on pydantic so far without declaring it; it was only installed through xedocs.
  • Docs: an API reference entry for strax.url_config.
  • Tests:
    • tests/test_url_config.py adds 36 tests. They cover registration, preprocessor precedence, URL/AST conversion, keyword-argument filtering, type validation, caching, dry evaluation, and the fact that the lineage stores the URL and not its value.
    • The tests register their own small protocols on a subclass with separate registries, so nothing leaks into the global strax.URLConfig registry.
    • tests/test_utils.py adds 3 tests for the helpers.

Compatibility

  • Nothing changes for existing strax users. The PR only adds names.
  • Old straxen releases keep working with this strax, because they still use their own URLConfig.
  • Lineage hashes are unchanged. Together with the matching straxen PR, all 90 lineage hashes of straxen.test_utils.nt_test_context("xenonnt") are identical before and after. The registered protocols and preprocessors are also identical.
  • Test suites: strax 236 passed, 7 skipped (197 before, plus 39 new). straxen 79 passed, 252 skipped, the same as before (no database access locally).

@coveralls

coveralls commented Nov 4, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 89.249% (+0.3%) from 88.915% — move_url_configs_to_strax into master

@WenzDaniel
WenzDaniel marked this pull request as ready for review November 5, 2026 09:15
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