refactor(python): split monolithic python.rs into nested submodules#725
Merged
refactor(python): split monolithic python.rs into nested submodules#725
Conversation
Split the 5,407-line python.rs into python/ directory with surface-focused submodules following ADR 0009: - mod.rs: PythonParser struct, PackageParser dispatcher, re-exports - utils.rs: shared helpers (dependency building, normalization, etc.) - archive.rs: sdist/wheel/egg extraction, pip-origin-json parsing - rfc822_meta.rs: PKG-INFO/METADATA RFC 822 parsing - pyproject.rs: pyproject.toml + Poetry parsing - setup_py.rs: AST and regex setup.py parsing - setup_cfg.rs: setup.cfg INI parsing - pypi_json.rs: pypi.json + pip-inspect parsing Circular dependencies resolved by relocating cross-cutting helpers: - extract_setup_cfg_dependency_name → utils - pip-origin-json items → archive - detect_pkg_info_datasource_id → utils - apply_project_url_mappings, parse_setup_cfg_keywords → utils Test files co-located in python/ per ADR 0009: - python_test.rs → python/test.rs - python_scan_test.rs → python/scan_test.rs
9df34e3 to
7762aeb
Compare
Update parser structure guidance to reflect the nested-submodule convention for large ecosystems: - HOW_TO_ADD_A_PARSER.md: reference ADR 0009 for directory-structured parsers, update templates, module wiring, test file paths, and done checklist to include both flat and nested options - ADR 0009: replace speculative python/ layout with actual structure - add-parser SKILL.md: same updates, plus add ADR 0009 to references
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
python.rsinto apython/directory with surface-focused submodules, following ADR 0009extract_setup_cfg_dependency_name→ utils, pip-origin-json items → archive,detect_pkg_info_datasource_id→ utils,apply_project_url_mappings/parse_setup_cfg_keywords→ utils)python/directory per ADR 0009 (python_test.rs→python/test.rs,python_scan_test.rs→python/scan_test.rs)Changes
python/mod.rspython/utils.rsbuild_pypi_urls,read_toml_file,has_private_classifier, etc.python/archive.rspython/rfc822_meta.rspython/pyproject.rspython/setup_py.rspython/setup_cfg.rspython/pypi_json.rsClean dependency order:
utils → setup_cfg → archive → rfc822_meta → pyproject → setup_py → pypi_json → dispatcherTesting
cargo clippy --all-targets -- -D warningscleancargo check --testscleanADR