File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""refua-data package API."""
22
3+ from importlib .metadata import version as _distribution_version
4+ from pathlib import Path
5+ import tomllib
6+
37from .cache import CacheBackend , DataCache
48from .catalog import DatasetCatalog , get_default_catalog
59from .models import ApiDatasetConfig , DatasetDefinition , FetchResult , MaterializeResult
610from .pipeline import DatasetManager
711from .validation import SourceValidationResult
812
13+
14+ def _read_version_from_pyproject () -> str | None :
15+ pyproject_path = Path (__file__ ).resolve ().parents [2 ] / "pyproject.toml"
16+ if not pyproject_path .exists ():
17+ return None
18+
19+ data = tomllib .loads (pyproject_path .read_text (encoding = "utf-8" ))
20+ project = data .get ("project" , {})
21+ version = project .get ("version" )
22+ if not version :
23+ return None
24+ return str (version )
25+
26+
27+ def _resolve_version () -> str :
28+ local_version = _read_version_from_pyproject ()
29+ if local_version is not None :
30+ return local_version
31+ return _distribution_version ("refua-data" )
32+
33+
34+ __version__ = _resolve_version ()
35+
936__all__ = [
1037 "ApiDatasetConfig" ,
1138 "CacheBackend" ,
1643 "FetchResult" ,
1744 "MaterializeResult" ,
1845 "SourceValidationResult" ,
46+ "__version__" ,
1947 "get_default_catalog" ,
2048]
You can’t perform that action at this time.
0 commit comments