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

Support pyproject.toml for configuration #813

Closed
Dr-ZeeD opened this issue Oct 29, 2018 · 10 comments
Closed

Support pyproject.toml for configuration #813

Dr-ZeeD opened this issue Oct 29, 2018 · 10 comments

Comments

@Dr-ZeeD
Copy link

Dr-ZeeD commented Oct 29, 2018

I would love to see support for pyproject.toml for the configuration as, e.g., black does

@IanLee1521
Copy link
Member

@ZeeD26 - would you be willing to submit a PR?

@sigmavirus24
Copy link
Member

@IanLee1521 the configuration management in this project is an abysmal nightmare. Until someone has time to do serious refactoring, I strongly advise against accepting this as a feature.

@IanLee1521
Copy link
Member

Good point.

@asears
Copy link

asears commented Dec 15, 2020

Is there more traction now for pyproject.toml format? Seems more prevalent on Github. We are looking at Poetry and this would be useful to have central configuration.

@sigmavirus24
Copy link
Member

Not really, no

arcondello added a commit to arcondello/dimod that referenced this issue Jun 8, 2021
Now that we're starting to use python's typing module, 80 chars
is becoming increasingly restrictive.

This commit signals that dimod support 100 characters by adding
it to the setup.cfg. Ideally we would like to add it to the
pyproject.toml, but right now that's not supported. See
PyCQA/pycodestyle#813
carstencodes added a commit to carstencodes/pycodestyle that referenced this issue Aug 4, 2021
The PIP518 support as described in
PyCQA#813
has been implemented roughly.

It uses the toml package, since the toml package describes itself as
being Python 2 compatible.
Using another package will create  a dependency that
might not be wanted. Hence the dependency is
treated optional as an extra, so consumers can decide
which revision they would like to use.

TODO: Unit test must be written explicitely.
@carstencodes
Copy link

Hi, I must agree to @sigmavirus24, the configuration is really messed up, but I think I found a simple and backward compliant way of adding this feature.

The idea is to read the configuration from the pyproject.toml into a dictionary and add it to the configparser object.

To keep the current behavior, that no dependencies must be used, the feature is added as an extra.

There are still some things to do before #1007 can be merged:

  • Fallback mode: Read data from setup.cfg/tox.ini if no data is found in pyproject.toml
  • Add Unit tests for pyproject.toml

Please tell me, what you think.

@pzelnip
Copy link

pzelnip commented Oct 27, 2021

I'm not clear from the discussion: if someone were to implement pyproject.toml support (perhaps via the idea that @carstencodes suggested) would that be welcomed as a contribution? If yes, then it would be appreciated to indicate that clearly so as to encourage a contribution. If not, then I'd suggest this be closed so as to make it clear the format will not be supported (and if that decision is reversed the issue can always be reopened).

@carstencodes
Copy link

I'll try to add the missing parts on the upcoming weekend. Then it's up to the maintainers to merge or reject this PR.

As we can see in PyCQA/flake8#234, supporting this issue might be hard to accomplish. Since discussion about pyproject.toml support is too heated for some projects (see flake8), it might be a good idea to wait for a toml parser in python (see https://bugs.python.org/issue40059).

Or to use a workaround, like I did with carstencodes/flake518.

@sigmavirus24
Copy link
Member

If not, then I'd suggest this be closed

Good idea

@sigmavirus24 sigmavirus24 pinned this issue Oct 28, 2021
@holocronweaver
Copy link

I see that pydocstyle supports pyproject.toml - could the same approach be taken in pycodestyle?

This seems a fairly popular feature request considering it is both pinned and has received 80+ thumbs up. Maybe a good time to re-open this issue and re-examine, as it is nearing a year since the last update?

@PyCQA PyCQA locked as resolved and limited conversation to collaborators Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants