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

Put black config in explicit config #5947

Merged
merged 5 commits into from
Oct 6, 2022
Merged

Conversation

max-sixty
Copy link
Contributor

This lets editors etc use the correct config

resolves #5946

Description

Checklist

This lets editors etc use the correct config
@max-sixty max-sixty requested a review from a team as a code owner September 28, 2022 02:42
@cla-bot cla-bot bot added the cla:yes label Sep 28, 2022
@lostmygithubaccount lostmygithubaccount added the ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering label Sep 28, 2022
@iknox-fa
Copy link
Contributor

iknox-fa commented Oct 5, 2022

Hi @max-sixty!
Thanks for opening this PR, however merging it would break our pre-commit hooks which we rely on for:

Additionally adding a pyproject.toml has a lot of implications for packaging that we haven't explored (although we have a ticket in the queue to do so at some point)

Can you say a bit more about what you're trying to achieve here? If all you want is to use black in your IDE instead of as a pre-commit hook, may I suggest just configuring black directly in your IDE (VSCode / Pycharm))?

@iknox-fa iknox-fa self-requested a review October 5, 2022 22:15
Copy link
Contributor

@iknox-fa iknox-fa left a comment

Choose a reason for hiding this comment

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

Needs further discussion
See: #5947 (comment)

@max-sixty
Copy link
Contributor Author

max-sixty commented Oct 6, 2022

however merging it would break our pre-commit hooks which we rely on for:

I don't think that's the case, respectfully. In the existing code, pre-commit passes configs to black. In the proposed code, black already has the configs. So pre-commit is running with exactly the same configs in both cases. Note that the pre-commit tests pass; and feel free to have a go locally.

This is the standard approach for using static tools with pre-commit, e.g. we've done this in https://github.com/pydata/xarray for years.

Can you say a bit more about what you're trying to achieve here? If all you want is to use black in your IDE instead of as a pre-commit hook, may I suggest just configuring black directly in your IDE (VSCode / Pycharm))?

Right, but with the proposed approach, it avoids everyone having to add a repo-specific configuration themselves. It's friendlier to new contributors!


Though I don't have a religious belief here. I noticed it when doing development on the repo, and thought it would be helpful to make it conform to best practice. But if the whole team has an aesthetic view against it, I would not be offended!

@iknox-fa iknox-fa requested review from iknox-fa and removed request for iknox-fa October 6, 2022 16:36
@iknox-fa
Copy link
Contributor

iknox-fa commented Oct 6, 2022

My mistake @max-sixty -- I misremembered the process isolation pre-commit uses when running hooks as isolating them from non pre-commit-config.yaml config values. Let's give it a whirl.

@iknox-fa iknox-fa self-requested a review October 6, 2022 16:46
Copy link
Contributor

@iknox-fa iknox-fa left a comment

Choose a reason for hiding this comment

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

LGTM

@iknox-fa iknox-fa merged commit 02a69c8 into dbt-labs:main Oct 6, 2022
@max-sixty
Copy link
Contributor Author

Cheers @iknox-fa ! Appreciate your openness

@max-sixty max-sixty deleted the black-config branch October 6, 2022 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes ready_for_review Externally contributed PR has functional approval, ready for code review from Core engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-1259] [Bug] Python formatter configs are not in config files
3 participants