provide-foundry
2026-03-21
Add pre-commit, memray stress tests, and optimize crossrepo-links regex
15 files · 367+ · 156-
Pre-compiled regex optimization for crossrepo-links plugin
1 file changed
crossrepo_links.pyExtracted all regex patterns to module-level pre-compiled constants. Consolidated per-package loops (28 individual patterns) into single alternation regexes for markdown and HTML link transforms. Same treatment for nested path fixups (14 patterns to 1). Moved PACKAGES list and NESTED_MAPPINGS dict to module scope.
- The crossrepo-links plugin now compiles regex patterns once at module load instead of on every page render, and uses single-pass alternation instead of O(n) per-package loops, significantly reducing allocation pressure during large doc builds.
streamline
architectural
1 file
crossrepo_links.py
Memray allocation stress tests
7 files changed
memray_crossrepo_links_stress.pyNew stress script exercising the regex-heavy link transformation pipeline (200 cycles x 20 pages) with realistic cross-repo markdown.memray_extract_stress.pyNew stress script for config extraction hot paths (50 cycles of extract_base_mkdocs into temp directories).__init__.pyEmpty init for memray test packagebaselines.jsonAllocation baselines for crossrepo_links and extract stress testsconftest.pyImport wrknv memray fixturestest_crossrepo_links_allocations.pyMemray allocation regression test for crossrepo-links transformstest_extract_allocations.pyMemray allocation regression test for config extraction
- Memray stress tests guard against allocation regressions in the two hottest code paths: cross-repo link transformation and config extraction. Tests are excluded from default pytest runs via markers.
qualify
behavioral
2 files
test_crossrepo_links_allocations.pytest_extract_allocations.py
Pre-commit config and SPDX lint fixes
3 files changed
.pre-commit-config.yamlNew pre-commit config with ruff, mypy strict, and standard hooks (trailing-whitespace, end-of-file-fixer, check-yaml, etc.). Includes site/ exclusion for generated docs.add_spdx_headers.pyCanonical lint fixes: replace Tuple with tuple, normalize quotes, extract _check_existing_header helper, rename loop variable (E741).validate_spdx_headers.pyNormalize quotes, reorder imports, remove year from SPDX header
Dependency and config updates
4 files changed
pyproject.tomlExclude memray tests from default pytest run, add memray markeruv.lockUpgrade provide-foundation from 0.3.21 to 0.3.21.post1wrknv.tomlAdd memray task aliases for running stress tests.gitignoreAdd memray-output/ to gitignore