Skip to content

Commit

Permalink
Bring back _version.py file (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline authored Jan 8, 2024
1 parent 6846c93 commit 299f271
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
*/_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
11 changes: 6 additions & 5 deletions dbtmetabase/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import importlib.metadata
import logging

from .dbt import DbtReader
Expand All @@ -9,7 +8,9 @@
__all__ = ["DbtReader", "MetabaseClient"]

try:
__version__ = importlib.metadata.version("dbt-metabase")
except importlib.metadata.PackageNotFoundError:
logger.warning("No version found in metadata")
__version__ = "0.0.0-UNKONWN"
from ._version import __version__ as version # type: ignore

__version__ = version
except ModuleNotFoundError:
logging.warning("No _version.py file")
__version__ = "0.0.0"
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ build-backend = "setuptools.build_meta"
requires = ["setuptools>=60", "setuptools-scm"]

[tool.setuptools_scm]
version_file = "dbtmetabase/_version.py"

[tool.black]
include = '\.pyi?$'
Expand Down

0 comments on commit 299f271

Please sign in to comment.