Skip to content

Commit

Permalink
Chore: issue a warning if __version__ can't be imported (#1648)
Browse files Browse the repository at this point in the history
* Chore: issue a warning if __version__ can't be imported

* PR feedback

* Replace 'consider installing' with 'run'
  • Loading branch information
georgesittas authored May 18, 2023
1 parent 72c5995 commit 1d1c0d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sqlglot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from __future__ import annotations

import logging
import typing as t

from sqlglot import expressions as exp
Expand Down Expand Up @@ -49,11 +50,15 @@

T = t.TypeVar("T", bound=Expression)

logger = logging.getLogger("sqlglot")


try:
from sqlglot._version import __version__, __version_tuple__ # type: ignore
from sqlglot._version import __version__, __version_tuple__
except ImportError:
pass
logger.error(
"Unable to set __version__, run `pip install -e .` or `python setup.py develop` first."
)


pretty = False
Expand Down

0 comments on commit 1d1c0d7

Please sign in to comment.