|
31 | 31 | from genno import Computer, Key
|
32 | 32 | from sdmx.message import StructureMessage
|
33 | 33 |
|
34 |
| - from message_ix_models.types import KeyLike, MaintainableArtefactArgs |
| 34 | + from message_ix_models.types import KeyLike |
35 | 35 |
|
36 | 36 | # TODO Use "from typing import Self" once Python 3.11 is the minimum supported
|
37 | 37 | Self = TypeVar("Self", bound="AnnotationsMixIn")
|
@@ -169,6 +169,8 @@ def __init__(
|
169 | 169 | # Used only for creation
|
170 | 170 | replace: bool = False,
|
171 | 171 | cs_urn: list[str] = [],
|
| 172 | + # Others |
| 173 | + **ma_kwargs, |
172 | 174 | ):
|
173 | 175 | import pint
|
174 | 176 | from sdmx.model.common import Annotation
|
@@ -217,7 +219,6 @@ def __init__(
|
217 | 219 | anno.append(Annotation(id="file-path", text=str(_path)))
|
218 | 220 |
|
219 | 221 | # Default properties for maintainable artefacts
|
220 |
| - ma_kwargs: "MaintainableArtefactArgs" = dict() |
221 | 222 | ma_kwargs.setdefault("maintainer", read("IIASA_ECE:AGENCIES")["IIASA_ECE"])
|
222 | 223 | ma_kwargs.setdefault("is_external_reference", False)
|
223 | 224 | ma_kwargs.setdefault("is_final", False)
|
@@ -566,8 +567,7 @@ def get_cl(name: str, context: Optional["Context"] = None) -> "common.Codelist":
|
566 | 567 | id=f"CL_{id_}",
|
567 | 568 | name=f"Codes for message-ix-models concept {name!r}",
|
568 | 569 | maintainer=as_["IIASA_ECE"],
|
569 |
| - # FIXME remove str() once sdmx1 > 2.21.1 can handle Version |
570 |
| - version=str(get_version()), |
| 570 | + version=get_version(with_dev=False), |
571 | 571 | is_external_reference=False,
|
572 | 572 | is_final=True,
|
573 | 573 | )
|
@@ -695,12 +695,21 @@ def get_concept(string: str, *, cs_urn: tuple[str, ...] = tuple()) -> "common.Co
|
695 | 695 | raise ValueError(string)
|
696 | 696 |
|
697 | 697 |
|
698 |
| -def get_version() -> str: |
| 698 | +@cache |
| 699 | +def get_version(with_dev: Optional[bool] = True) -> str: |
699 | 700 | """Return a :class:`sdmx.model.common.Version` for :mod:`message_ix_models`.
|
700 | 701 |
|
701 | 702 | .. todo:: Remove :py:`str(...)` once sdmx1 > 2.21.1 can handle Version.
|
| 703 | +
|
| 704 | + Parameters |
| 705 | + ---------- |
| 706 | + with_dev : bool |
| 707 | + If :any:`True`, include the dev version part, e.g. "2025.3.12.dev123". If not, |
| 708 | + exclude. |
702 | 709 | """
|
703 |
| - return str(common.Version(version(__package__.split(".")[0]).split("+")[0])) |
| 710 | + tmp, *_ = version(__package__.split(".")[0]).partition("+" if with_dev else ".dev") |
| 711 | + |
| 712 | + return str(common.Version(tmp)) |
704 | 713 |
|
705 | 714 |
|
706 | 715 | def make_enum(urn, base=URNLookupEnum):
|
|
0 commit comments