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
Document python requirement for tox/mypy & remove basepython from conf #2644
Changes from 5 commits
853edf7
2979f5d
fe5e982
03df510
b604536
7e95f11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -82,13 +82,20 @@ changes. | |||||
|
||||||
### Developing and Running SQLFluff Locally | ||||||
|
||||||
#### Requirements | ||||||
|
||||||
The simplest way to set up a development environment is to use `tox`. | ||||||
First ensure that you have tox installed (windows users may have to replace `python3` with `py`): | ||||||
First ensure that you have tox installed: | ||||||
```shell | ||||||
python3 -m pip install -U tox | ||||||
python3.8 -m pip install -U tox | ||||||
``` | ||||||
**IMPORTANT:** `tox` must be installed with a minimum of Python 3.8 as the `mypy` checks are incompatible with 3.7. Those using newer versions of Python may replace `python3.8` as necessary (the test suite runs primarily under 3.10 for example). | ||||||
|
||||||
Note: Unfortunately tox does not currently support setting just a minimum Python version (though this may be be coming in tox 4!). | ||||||
|
||||||
A virtual environment can then be created and activated by running: | ||||||
#### Creating a virtual environment | ||||||
|
||||||
A virtual environment can then be created and activated by running (check the [requirements](#requirements) before running this): | ||||||
```shell | ||||||
tox -e dbt021-py38 --devenv .venv | ||||||
source .venv/bin/activate | ||||||
|
@@ -130,7 +137,7 @@ pip install -e plugins/sqlfluff-templater-dbt/. | |||||
|
||||||
### Testing | ||||||
|
||||||
To test locally, SQLFluff uses `tox`. The test suite can be run via: | ||||||
To test locally, SQLFluff uses `tox` (check the [requirements](#requirements)!). The test suite can be run via: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same feedback here. I know there’s a chance people can miss the early point but personally still find it a little overkill.
Suggested change
|
||||||
|
||||||
```shell | ||||||
tox | ||||||
|
@@ -209,7 +216,13 @@ py.test -v plugins/sqlfluff-templater-dbt/test/ | |||||
|
||||||
### Pre-Commit Config | ||||||
|
||||||
For development convenience we also provide a `.pre-commit-config.yaml` file to allow the user to install a selection of pre-commit hooks via `tox -e pre-commit -- install`. These hooks can help the user identify and fix potential linting/typing violations prior to committing their code and therefore reduce having to deal with these sort of issues during code review. | ||||||
For development convenience we also provide a `.pre-commit-config.yaml` file to allow the user to install a selection of pre-commit hooks by running (check the [requirements](#requirements) before running this): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here. Do think we’ve gone from too little guidance here to too much. But maybe you feel strongly about leaving some of these in place since I know you say you wasted a good bit of time on this?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of the cases discussed, this is maybe the most important to keep the pointer. Because this is so far away from the main tox stuff, I can easily imagine someone jumping here just for the sake of installing pre-commit tools and again if that someone already has tox installed, it's not obvious that it could be wrong even though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make things worse, if you already ran this before you realized you need to change your tox installation, it's not trivial to realize that you also need to wipe out the |
||||||
|
||||||
``` | ||||||
tox -e pre-commit -- install | ||||||
``` | ||||||
|
||||||
These hooks can help the user identify and fix potential linting/typing violations prior to committing their code and therefore reduce having to deal with these sort of issues during code review. | ||||||
|
||||||
### Documentation Website | ||||||
|
||||||
|
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.
Not sure this is needed and reads a little confusing. I think the
Then
covers 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.
I wanted to be extra sure. If someone just jumps to this section and happens to have tox installed previously, they might miss the requirement. Are you ok with keeping the pointer?
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.
Yup. OK keeping them all as you prefer.