Repository navigation
Make the shared RLE sequence limit configurable - #660
Shubham-Padkonde wants to merge 4 commits into
Conversation
korikuzma
left a comment
There was a problem hiding this comment.
@Shubham-Padkonde Thanks for making this PR! I'd like to see the tests changed before approval/merge.
|
|
||
|
|
||
| def _get_rle_seq_limit() -> int | None: | ||
| """Read the maximum optional RLE sequence length from the environment.""" |
There was a problem hiding this comment.
I think it'd be good to have docs here too
| """Read the maximum optional RLE sequence length from the environment.""" | |
| """Read the maximum optional RLE sequence length from the environment. | |
| Set `GA4GH_VRS_RLE_SEQ_LIMIT` environment variable to change | |
| the maximum length of optional `ReferenceLengthExpression.sequence` values. | |
| The default is `50` bases. Use a non-negative integer, `0` to omit the optional | |
| sequence, or `none` (case-insensitive) for no limit. | |
| :raise ValueError: If provided value is not an integer or is a negative value | |
| """ |
There was a problem hiding this comment.
I'm wondering if we could avoid using subprocess with a full script (it's a little hard to read and I imagine it could be hard to maintain). Could we instead look into mocking the environment variables in our existing tests (such as
and https://github.com/ga4gh/vrs-python/blob/main/tests/extras/test_annotate_vcf.py)?There was a problem hiding this comment.
yeah generally the recommended way to injectj/manage env vars in tests is with the pytest monkeypatch module
https://docs.pytest.org/en/stable/how-to/monkeypatch.html#monkeypatching-environment-variables
korikuzma
left a comment
There was a problem hiding this comment.
Hi @Shubham-Padkonde . Thanks for making the switch to monkeypatch. In #660 (comment), I also meant testing the RLE config limit in the existing annotator and translator tests. Could we extend these rather than recreating the workflows in test_rle_config.py? We could still keep test_invalid_rle_sequence_limit_environment
The RLE sequence limit is currently repeated as
50in normalization, translation, and VCF output. Add a sharedGA4GH_VRS_RLE_SEQ_LIMITenvironment setting so these paths agree, as requested in #598.The default remains 50 bases. A non-negative integer selects the limit,
0omits optional sequence values, andnonedisables the limit. The setting is read at import time; invalid values produce an error naming the setting. Explicit normalization/translation arguments still override the default. Documentation includes a CLI example.Validation on Python 3.12/Linux:
Prepared with Codex assistance. Fixes #598.
Running the three affected modules alone produces three existing VCR cassette failures; the same failures reproduce against unchanged source. The full suite above passes.