Skip to content

Commit 9f74acf

Browse files
authored
feat: define VRS schema version in package (#543)
supercedes #467. In that PR, I defined a hook for setuptools that would use the tag info in a submodule and auto-update a variable with the latest VRS schema tag, so that wheels built by our release workflow would contain the right value. There were probably going to be some hiccups that way, though, and I also couldn't get it to be testable in github actions on account of how actions/checkout seemed to be pulling the git repos. Here, we just define a little old constant with the schema version. This is a fully manual process, but theoretically we won't need to update it that often, so it should be fine.
1 parent 180127f commit 9f74acf

6 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/ga4gh/vrs/__init__.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""Public interface to the GA4GH Variation Representation reference
2-
implementation
3-
"""
1+
"""Public interface to the GA4GH Variation Representation reference implementation"""
42

53
from importlib.metadata import PackageNotFoundError, version
64

@@ -9,11 +7,21 @@
97
from ga4gh.vrs.models import VrsType
108
from ga4gh.vrs.normalize import normalize
119

12-
__all__ = ["VrsType", "models", "normalize", "vrs_deref", "vrs_enref"]
13-
1410
try:
1511
__version__ = version(__name__)
1612
except PackageNotFoundError: # pragma: nocover
1713
__version__ = "unknown"
1814
finally:
1915
del version, PackageNotFoundError
16+
17+
18+
VRS_VERSION = "2.0.1"
19+
20+
__all__ = [
21+
"VRS_VERSION",
22+
"VrsType",
23+
"models",
24+
"normalize",
25+
"vrs_deref",
26+
"vrs_enref",
27+
]

src/ga4gh/vrs/extras/annotator/vcf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
VrsObjectIdentifierIs,
1414
use_ga4gh_compute_identifier_when,
1515
)
16-
from ga4gh.vrs import __version__
16+
from ga4gh.vrs import VRS_VERSION, __version__
1717
from ga4gh.vrs.dataproxy import _DataProxy
1818
from ga4gh.vrs.extras.translator import AlleleTranslator
1919
from ga4gh.vrs.models import Allele
@@ -137,8 +137,7 @@ def _update_vcf_header(
137137
info_field_num,
138138
"String",
139139
(
140-
"The computed identifiers for the GA4GH VRS Alleles corresponding to the "
141-
f"GT indexes of the {info_field_desc} alleles [VRS-Python version {__version__}]"
140+
f"The computed identifiers for the GA4GH VRS Alleles corresponding to the GT indexes of the {info_field_desc} alleles [VRS version={VRS_VERSION};VRS-Python version={__version__}]"
142141
),
143142
)
144143
vcf.header.info.add(
7 Bytes
Binary file not shown.
7 Bytes
Binary file not shown.
7 Bytes
Binary file not shown.

tests/extras/test_annotate_vcf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pytest
1010

11-
from ga4gh.vrs import __version__
11+
from ga4gh.vrs import VRS_VERSION, __version__
1212
from ga4gh.vrs.dataproxy import DataProxyValidationError, SeqRepoRESTDataProxy
1313
from ga4gh.vrs.extras.annotator.vcf import VcfAnnotator, VcfAnnotatorError
1414

@@ -47,6 +47,7 @@ def compare_vcfs(actual_vcf_path: Path, expected_vcf_path: Path):
4747
out_vcf_lines, expected_output_lines, strict=False
4848
):
4949
if actual_line.startswith("##INFO=<ID=VRS_Allele_IDs"):
50+
expected_line = expected_line.replace("1111", VRS_VERSION)
5051
expected_line = expected_line.replace("9999", __version__)
5152
assert actual_line == expected_line
5253

0 commit comments

Comments
 (0)