Skip to content
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

Merged
merged 3 commits into from
May 18, 2023

Conversation

georgesittas
Copy link
Collaborator

No description provided.

except ImportError:
pass
logger.warning("Unable to set __version__, consider installing SQLGlot first.")
Copy link
Owner

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

Copy link
Owner

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator Author

@georgesittas georgesittas May 18, 2023

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?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try it

Copy link
Collaborator Author

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.

@tobymao tobymao merged commit 1d1c0d7 into main May 18, 2023
@tobymao tobymao deleted the jo/warn_about_version branch May 18, 2023 17:36
adrianisk pushed a commit to adrianisk/sqlglot that referenced this pull request Jun 21, 2023
* Chore: issue a warning if __version__ can't be imported

* PR feedback

* Replace 'consider installing' with 'run'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants