-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: issue a warning if __version__ can't be imported #1648
Conversation
sqlglot/__init__.py
Outdated
except ImportError: | ||
pass | ||
logger.warning("Unable to set __version__, consider installing SQLGlot first.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this more explicit, so not consider installing
tell them to run
pip install -e . or python setup.py develop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and don't make this a warning, make it an error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobymao I wonder whether this message will always be printed when using sqlglot simply for its interface (i.e. not developing in it). For example, if you import sqlglot
or use its CLI as: python -m sqlglot ...
, will it still log? If so, do we want it to log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it is printed regardless:
➜ sqlglot git:(jo/warn_about_version) python -m sqlglot "select foo"
Unable to set __version__, run `pip install -e .` or `python setup.py develop` first.
SELECT
"foo"
This is without having a _version.py
file at all.
* Chore: issue a warning if __version__ can't be imported * PR feedback * Replace 'consider installing' with 'run'
No description provided.