-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
adding pre-commit install to make dev #6417
Conversation
Thanks for picking this up @justbldwn! This is looking great ✨ -- let's run with it. An argument could be made for creating a stand-alone rule within the Two small suggestions:
Feel free to click the "Ready for review" button as soon as you're up for 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.
For those who don't want pre-commit run automatically, could you add an additional make target (maybe "dev_req" that doesn't install pre-commit? Thanks.
thanks for the feedback! i just added a |
@gerda in which cases would we not want to install and run |
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.
Sorry for any churn here @justbldwn and @gshank
Hopefully we can come to a happy medium that:
- Gives explicit instructions how to install all the expected tooling
- Doesn't end up with longer and longer contributing file
My spicy take is that the contributing file should be closer to 100 lines long than 250 lines long so that it's more readable 🌶️ That's obviously outside of the focus of this PR, but still on my mind!
CONTRIBUTING.md
Outdated
#### Installation without `pre-commit`: | ||
```sh | ||
make dev_req | ||
``` | ||
or, alternatively: | ||
```sh |
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.
Given the addition of the dev_req
rule, adding this section makes sense on first blush.
But... the contributing file already seems unbearably long to me. I wish it was like 75% shorter rather than even just a few lines longer.
Anyone that knows good reasons why they don't want the pre-commit install
step probably has keen enough eyes to know that they can omit it and just run:
pip install -r dev-requirements.txt -r editable-requirements.txt
This is a case in which "less is more" and we can just omit explicitly documenting how to do it.
#### Installation without `pre-commit`: | |
```sh | |
make dev_req | |
``` | |
or, alternatively: | |
```sh |
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.
@gshank I would prefer to exclude additional instructions to describe how to omit installation of pre-commit
hooks for three main reasons:
- Installing pre-commit hooks is the happy path!
- How to omit installation of
pre-commit
seems obvious without explanation needed - More text makes it harder to read the document as a whole
How would you feel about going back to the more simple instructions?
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 see no need to describe how to use dev_req. Just have a Makefile target.
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.
Sounds good @gshank!
@justbldwn If you commit my two suggestions (including the one to remove the "Installation without pre-commit
" section), I think we'll be good to go!
You'll probably want to make a final pass through your edits to make sure everything reads the way you want it to.
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.
@dbeatty10 @gshank thank you both for the helpful feedback here! i just pushed up a new commit to remove a chunk from the CONTRIBUTING.md
about using make dev_req
, and instead just left instructions for using make dev
. however, the dev_req
target in the Makefile
still exists for anyone that may want to use it.
Makefile
Outdated
dev: ## Installs dbt-* packages in develop mode along with development dependencies and pre-commit. | ||
@\ | ||
pip install -r dev-requirements.txt -r editable-requirements.txt && \ | ||
pre-commit install |
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'm not a Make guru, but it seems like this would be more DRY if re-factored like this:
dev: ## Installs dbt-* packages in develop mode along with development dependencies and pre-commit. | |
@\ | |
pip install -r dev-requirements.txt -r editable-requirements.txt && \ | |
pre-commit install | |
dev: dev_req ## Installs dbt-* packages in develop mode along with development dependencies and pre-commit. | |
@\ | |
pre-commit install |
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 like this a lot - thanks for the tip! hadn't considered this, but it makes total sense this way. it should now be written this way in the latest commit (b4bf3b4)
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.
There's two little pieces I didn't notice earlier related to .PHONY
targets.
I'm adding them as suggestions in this review, and then I'll go ahead and commit them afterwards.
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.
This looks ready to rock 🎸
Thanks for this contribution @justbldwn !
Could you re-review @gerda? One thing to take a look at: the changlog entry currently says Should it be |
resolves #6269
Description
hey @dbeatty10 , I am opening this as a draft PR to review in reference to #6269. i can convert this to no longer be a draft if you are okay with this as a possible solution.
I noticed #6269 was open for adding
pre-commit install
to theCONTRIBUTING.md
file. interestingly enough, the docs mention thatmake dev
should installpre-commit
for you here in the second sentence, but it's not currently doing that.so far, this PR just adds
pre-commit install
as part of themake dev
command in theMakefile
, but I can also help add some docs to theCONTRIBUTING.md
file to installpre-commit
manually as an alternative to using themake dev
command if you think it is necessary. i hope it's okay that this change is a bit out of scope for the requirements of the ticket, but this change should help contributors get setup more quickly todbt-core
as long as they are using themake
commands.let me know if there is anything else i can help contribute to this!
Checklist
changie new
to create a changelog entry