Repository navigation
Expose safe effect-graph codec and eliminate cross-module private imports (11.17.0) - #753
Merged
Merged
Conversation
…orts (11.17.0) - Expose a documented read-only finite class registry (`effect_serialization_classes`) and safe typed JSON codec (`EffectReference`, `AssembledAllele`, `effect_to_json`, `effect_from_json`, `effect_from_serializable_repr`, `effect_collection_to_json`, `effect_collection_from_json`, `effect_collection_from_serializable_repr`) for native effect and `EffectCollection` graphs, routing `MutationEffect.from_json`, `EffectCollection.from_json`, and `EffectCollection.from_csv` `effect_json` decoding through the finite allowlist without dynamic module imports. - Add public `registered_annotators(*, include_deprecated=False)` API. - Eliminate all cross-module single-underscore imports across `varcode/`, split `varcode/effects/structural.py` into `structural_models.py`, `structural_fusions.py`, `structural_candidates.py`, and `structural.py`, break the `structural` <-> `sequence_change` private cycle, and add AST lint and codec regression tests. Closes #674 Closes #692
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
Closes #674
Closes #692
1. Public finite class registry, safe typed JSON codec, and annotator listing API (#674)
effect_serialization_classes() -> Mapping[tuple[str, str], type], returning a read-only allowlist of reviewed classes accepted in native Varcode effect andEffectCollectionarchives (including backwards-compatible legacy aliases_EffectReference,_AssembledAllele,_ORFTranscript,_ReferenceGenome,_Feature, and_ReferenceTranscript, plusPinnedEnsemblGenome; upstream public export tracked in Export PinnedEnsemblGenome from a public module for finite serialization registries orfdata#210).EffectReference,AssembledAllele,effect_to_json,effect_from_json,effect_from_serializable_repr,effect_collection_to_json,effect_collection_from_json, andeffect_collection_from_serializable_reprat the package root.MutationEffect.from_json(),EffectCollection.from_json(), andEffectCollection.from_csv()effect_jsonrestoration through the finite-allowlist decoders, preserving graph cycles, candidate ordering, germline/haplotype baselines, andorf_effect_schemasnapshots while rejecting unreviewed classes and arbitrary function metadata without dynamic module imports.default_effect_sort_key(retaining_default_effect_sort_keyfor legacyEffectCollectionarchives).registered_annotators(*, include_deprecated: bool = False) -> tuple[str, ...]so callers can inspect registered annotator names without importing private registry state.2. Eliminate cross-module underscore imports & split
effects/structural.py(#692)_namehelpers to documented public names in their owning modules (contigs,mutant_transcript,orf,orf_serialization,genome_sequence,germline,reference,rna_evidence,structural_variant,sv_allele_parser,transcript_model,vcf,vcf_parsing,effects/classify,effects/effect_prediction), and renamevarcode/_sample_vcf.pytovarcode/sample_vcf.py.varcode/effects/structural.pyintostructural_models.py,structural_fusions.py,structural_candidates.py, andstructural.py, and break the two-way private import cycle betweenstructuralandsequence_changeviastructural_variant.affected_spanandmutant_transcript.retained_cds_start.tests/test_private_imports.py, and cover ordinary, splice, germline/phased, structural, extra-ORF, legacy-alias, and untrusted-class rejection cases intests/test_safe_effect_codec.py.Version
varcodeto11.17.0with release notes inCHANGELOG.md, API docs indocs/api_effects.mdanddocs/api_annotators.md, and static typing checks intests/typing/api_inputs.py.