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

Allow setting the location of pyproject.toml file #9

Closed
AngellusMortis opened this issue Jul 15, 2019 · 9 comments
Closed

Allow setting the location of pyproject.toml file #9

AngellusMortis opened this issue Jul 15, 2019 · 9 comments

Comments

@AngellusMortis
Copy link

It would be great to be able to specify the location of the pyproject.toml file for more advanced setups.

black currently allows setting the location of the pyproject.toml file with the --config option.

@peterjc
Copy link
Owner

peterjc commented Jul 16, 2019

I'm curious, could you point me at a couple of projects using black with the --config option?

How would you see this working from flake8? A flake8-black plugin specific configuration setting within the flake8 configuration file being used?

Also note that currently flake8-black does not respect everything in the black pyproject.toml settings (e.g. includes and excludes are not currently respected, as stated in the README).

@peterjc
Copy link
Owner

peterjc commented Aug 2, 2019

Proposal from discussion on #10 with @098799:

Add an optional flake8 setting for the plugin (i.e. in file .flake8, setup.cfg, or tox.ini - whatever the user has picked), giving the filename of a black configuration file to use.

e.g. Something like this (not sure about the best key name to use here, suggestions?):

[flake8]
flake8-black-config = /mnt/shared/config/black.toml

This would be like using black --config /mnt/shared/config/black.toml ... at the command line?

@peterjc
Copy link
Owner

peterjc commented Aug 5, 2019

In discussion on #11, I think rather than flake8-black-config we could just use black-config as the setting name, equivalently:

$ flake8 --black-config /mnt/shared/config/black.toml ...

@peterjc
Copy link
Owner

peterjc commented Aug 6, 2019

Closed by #11, this will be in release v0.1.1

@peterjc
Copy link
Owner

peterjc commented Aug 6, 2019

Is it useful to be able to explicit say run flake8-black with NO black configuration TOML file at all?

e.g. flake8 --black-config '' ... (that's two single quotes - bash would take two double quotes as well), meaning an empty string? Sadly there doesn't seem to be a good way to do this in a flake8 config file, the following and variations like seems to act the same as leaving out the setting:

[flake8]
black-config=''

Instead, I am considering e.g. flake8 --black-config - ... (that's a minus sign), or in a flake8 config file, something like the following:

[flake8]
black-config='-'  # Explicitly do not use any black TOML file

@098799
Copy link

098799 commented Aug 6, 2019

What's your use case for that? I assume that this would be ran only in projects with pyproject.toml specified, but then why would one want to check against standard black?

@peterjc
Copy link
Owner

peterjc commented Aug 6, 2019

On a large project you might aspire to follow default black, but have to work towards this gradually.

It occurs to me another way someone might expect to do this would be to piggy-back on the flake8 --isolated ... option, but that seems a bit too magic to me?

@098799
Copy link

098799 commented Aug 6, 2019

TBH sounds like just about right amount of magic to me :) (as long as it's properly documented) We should be able to smuggle that in from parse_options, right?

@peterjc
Copy link
Owner

peterjc commented Aug 6, 2019

We should be able to, much like how earlier iterations of this plugin accessed the max-line-length setting.

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

No branches or pull requests

3 participants