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 isort configuration through pyproject.toml #78

Closed
wants to merge 1 commit into from
Closed

Allow isort configuration through pyproject.toml #78

wants to merge 1 commit into from

Conversation

uyar
Copy link

@uyar uyar commented Feb 26, 2020

This change fixes the -incorrectly- closed issue #71.

This change fixes the -incorrectly- closed issue #71.
jnns added a commit to jnns/flake8-isort that referenced this pull request Feb 29, 2020
isort will look for a configuration in pyproject.toml
when the TOML library is available.

flake8-isort has its own mechanism to look up an appropriate
configuration file and will pass its path on to isort.
Right now, flake8-isort doesn't consider pyproject.toml files as
configuration file candidates and will raise an error if there's
no other configuration file than the pyproject.toml.

Luckily, there's the parameter `--no-isort-config` to make flake8-isort
not stall when it cannot find a config file.
In this case, isort will not be instructed to look for a specific
configuration file by flake8-isort but instead look for it itself
(beginning from either the currently linted file path
or the current working directory).

This is great because it means that we can rely on isort
to figure out which config to use
and linting behavior between both libraries will be exactly the same.
The search for a configuration file can be removed from flake8-isort
and we get Pyproject.toml support for free.
The `--no-isort-config` option can be removed as well
because from now on it will always be the burden of isort
to figure out which config to use.

Related to gforcada#71
Closes gforcada#78
@uyar
Copy link
Author

uyar commented Feb 29, 2020

I'm not closing this PR just yet but the PR by @jnns looks better.

@uyar
Copy link
Author

uyar commented Feb 29, 2020

And if for some reason this PR gets preferred, I will rewrite the code to use tomlkit instead of toml since that is used in the isort project itself.

EDIT: isort 4.3.21 uses toml, so modifying this PR is not needed.

@gforcada
Copy link
Owner

@uyar and @jnns would you be ok with closing this one in favor of @jnns #79 ?

@uyar
Copy link
Author

uyar commented Mar 13, 2020

@gforcada @jnns Yes, I think #79 is the cleaner way. I checked it on one of my projects and it seems to work OK.

@gforcada gforcada closed this in 701995a Apr 15, 2020
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.

None yet

2 participants