diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..6df9afa6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +pyproject.toml export-subst diff --git a/pyproject.toml b/pyproject.toml index 4625cf19..3f6dc4d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,6 +84,7 @@ dependencies = [ "backports.zoneinfo<1; python_version<'3.9'", "crate>=2,<3", "geojson<4,>=2.5", + "importlib-metadata; python_version<'3.8'", "importlib-resources; python_version<'3.9'", "sqlalchemy<2.1,>=1", "verlib2<0.3", @@ -252,8 +253,9 @@ non_interactive = true # enable_recursive_aliases = true [tool.versioningit.vcs] -method = "git" +method = "git-archive" default-tag = "0.0.0" +describe-subst = "$Format:%(describe:tags)$" # =================== # Tasks configuration diff --git a/src/sqlalchemy_cratedb/__init__.py b/src/sqlalchemy_cratedb/__init__.py index 41cbf381..502816be 100644 --- a/src/sqlalchemy_cratedb/__init__.py +++ b/src/sqlalchemy_cratedb/__init__.py @@ -52,7 +52,22 @@ monkeypatch_add_exec_driver_sql() +try: + from importlib.metadata import PackageNotFoundError, version +except (ImportError, ModuleNotFoundError): # pragma:nocover + from importlib_metadata import ( # type: ignore[assignment,no-redef,unused-ignore] + PackageNotFoundError, + version, + ) + +try: + __version__ = version("sqlalchemy-cratedb") +except PackageNotFoundError: # pragma: no cover + __version__ = "unknown" + + __all__ = [ + __version__, dialect, FloatVector, Geopoint,