Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

pyproject.toml configuration support #447

Closed
wlcx opened this issue Jan 9, 2020 · 24 comments · Fixed by #534
Closed

pyproject.toml configuration support #447

wlcx opened this issue Jan 9, 2020 · 24 comments · Fixed by #534

Comments

@wlcx
Copy link

wlcx commented Jan 9, 2020

Many other python formatting/style tools have added support for the pyproject.toml file's [tool.*] sections for their configuration. Is this something that pydocstyle would be open to supporting?

@sigmavirus24
Copy link
Member

As far as I know, there's 1 formatting/style tool that supports it. What other tools have added support for it? For what it's worth flake8 and pycodestyle have both refused to support this at this time.

@wlcx
Copy link
Author

wlcx commented Jan 9, 2020

That's interesting, I hadn't interpreted PyCQA/pycodestyle#813 as a refusal, rather than just a deferral until wider config refactoring happened.
At least black (https://black.readthedocs.io/en/stable/pyproject_toml.html) and isort (https://timothycrosley.github.io/isort/CHANGELOG/#435-february-24-2019-last-python-27-maintenance-release) both do, and my (limited) impression was that the community seemed to be converging on it as a good option going forward?

@sigmavirus24
Copy link
Member

A very vocal minority are trying to create that impression in my experience but they have no regard for backwards compatibility or the maintenance burden of each of these tools adding yet another new config file location to have to observe and determine precedence of.

@wlcx that is de facto refusal because no one is actually working on pycodestyle

@wlcx
Copy link
Author

wlcx commented Jan 17, 2020

Understood, thanks for elaborating.

@wlcx wlcx closed this as completed Jan 17, 2020
@prokher
Copy link

prokher commented Mar 29, 2020

@sigmavirus24 It seems that in 2020 pyproject.toml becomes mainstream. Please, take a look at the corresponding awesome list: https://github.com/carlosperate/awesome-pyproject . More and more tools supports it. May be it is the time to reconsider.

@sigmavirus24
Copy link
Member

@prokher given the accuracy of the title of the section "Projects discussing the use of pyproject.toml" which conveniently implies that those projects are still open to the idea, I'm not swayed by that list. It's not overwhelming in size. The benefits of adopting pyproject.toml (as I've explained in numerous places) are not overwhelming in anyway and finally as I've said above, the biggest barrier is lack of maintainers who can work on it without breaking things for existing users.

@fabiencelier
Copy link

+1 for this
It would be nice to at least be able to do --config pyproject.toml even if it is not parsed by default and has no precedence

@sambhav
Copy link
Member

sambhav commented Sep 9, 2020

I am happy to reopen the issue at the very least since it seems like there are some discussions going on.

@sambhav sambhav reopened this Sep 9, 2020
@ajcerejeira
Copy link

+1 for this

I have a project where I am using black, isort, pylint, coverage and pytest and have configured all of them within the pyproject.toml file, like so:

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88

[tool.pylint.format]
max-line-length = 88

[tool.pylint.messages_control]
disable = ["C0301",   "C0330", "C0326", "C0415"]

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "config.settings.test"

[tool.coverage.paths]
source = ["src", "*/site-packages"]

[tool.coverage.run]
branch = true

[tool.coverage.report]
show_missing = true
fail_under = 100

It would find it really useful to be able to also define a tool.pydocstyle section there, so that I don't need to have an extra .pydocstyle config file at the root of my project.

@Nytelife26
Copy link

It is possible to use --config=pyproject.toml as of this year, unsure about prior versions. The only restriction being that the configuration key must be named pycodestyle.


Also, @sigmavirus24, it isn't a vocal minority - PEP518 standardized the usage of pyproject.toml. It is an officially accepted standard in the Python community.

I am normally of the "standards are a poor excuse for mediocrity" stance, however, pyproject.toml and unifying toolchain configuration would be a big improvement for the already suffering Python ecosystem.

@sigmavirus24
Copy link
Member

It's a standard for build tools with an allowance for extraneous tools. The tools that can support it without serious maintainer burden have chosen to do so. The rest that have limited or no maintainer time shouldn't. The people talking this up are over-selling the standard (like you are) for ad hominem purposes.

This conversation and issue has been pointlessly circular as users demand things maintainers can't afford to support.

@felix-hilden
Copy link

Please don't go burning yourselves out for this! If it's too much load and maintainer time is so scarce, I think people will understand. Heck, perhaps someone who cares enough will help and ease that load.

I doubt it's anyone's intention to attack the maintainers of pydocstyle or any other tool while discussing this change. In my eyes this discussion has been a honest request for a neat feature. Personally I like having my config in tox.ini and I'd like to see a similar situation with pyproject.toml someday. pydocstyle is great and we want it to be better, that's all. I think.

@Nytelife26
Copy link

Nytelife26 commented Apr 22, 2021 via email

@Nytelife26
Copy link

Actually, another interesting thing I noticed - isort, also under PyCQA, does support pyproject.toml. If these two packages are maintained by the same organization, it makes even more sense to do this for consistency - not to mention it disproves the claim that the maintainers cannot support it, because it has been done elsewhere under the organization.

@sigmavirus24
Copy link
Member

Nobody's overselling anything, nor is any ad hominem involved. Do you know what that means?

There is an ad hominem throughout this issue "This is a standard and must be implemented everywhere" (not an exact quote). It's not an ad hominem character attack on the maintainers, it's a claim repeated over and over and over to get your way. It's not you in particular doing this but you in particular piling on to this. That's the definition of an ad hominem.

Quoting Wikipedia:

Ad hominem (Latin for 'to the person'), short for argumentum ad hominem, refers to several types of arguments, some but not all of which are fallacious. [...] This avoids genuine debate by creating a diversion to some irrelevant but often highly charged issue.

In other words, claiming that the PEP that defines the file and allows for tools to leverage pyproject.toml in some way implies that this and other tools must implement support for it, is trying to use "it's a standard" as a diversion against the very real costs of maintaining that support.

haven't personally attacked any of the maintainers anywhere,

I didn't say you personally attacked anyone. You misread my words.

that's not part of computer science. [...]
This is a discussion - if you don't know what those are, they're also quite common in science.

You ask me to be "more respectful" but have now taken a quite emotional approach to trying to attack me for being:

  • emotional (apparently real scientists are robots) despite being quite detached and simply making observations in my comment,
  • not understanding language,
  • talking down to me as if you're superior

None of which is very respectful in and of itself. Please point out exactly how I was disrespectful.

Either way, in reasonable terms, supporting it shouldn't be too much of a hassle. If anything, as aforementioned, it allows the developers to shave off the overhead involved in supporting individual configuration formats.

I suspect in "computer science" (of which you speak as if you're an expert) you just drop support for things haphazardly. That's not how real software maintenance works. "It shouldn't be too much hassle" exposes your inexperience in supporting a widely used tool or set of tools and doesn't take in to consideration the complexities of existing software.


Please don't go burning yourselves out for this! If it's too much load and maintainer time is so scarce, I think people will understand. Heck, perhaps someone who cares enough will help and ease that load.

I believe it's been said numerous times above that the maintainers don't have the time/energy for this, and still we have folks adding comments that add no new content and continue to repeat false statements. If there ever was an appetite for doing this work, simply explaining to people the current state of affairs takes a quite significant amount of time away from even doing that work. This issue has been open for over a year, no one has said "I'll help do this work" and then kept with it as soon as they realized the complexity of implementing it.

@felix-hilden
Copy link

Sorry to hear that man, I really meant to say something nice. It's painful to see this conversation devolve this way, and to hear such a pessimistic viewpoint - as justifiable as it may be. But I recognise my comment wasn't really adding to the technical conversation. I hope you and the other maintainers get some rest 🌴

@RuRo
Copy link
Contributor

RuRo commented Apr 30, 2021

There is an ad hominem throughout this issue "This is a standard and must be implemented everywhere" (not an exact quote). It's not an ad hominem character attack on the maintainers, it's a claim repeated over and over and over to get your way. It's not you in particular doing this but you in particular piling on to this. That's the definition of an ad hominem.

Quoting Wikipedia:

Ad hominem (Latin for 'to the person'), short for argumentum ad hominem, refers to several types of arguments, some but not all of which are fallacious. [...] This avoids genuine debate by creating a diversion to some irrelevant but often highly charged issue.

In other words, claiming that the PEP that defines the file and allows for tools to leverage pyproject.toml in some way implies that this and other tools must implement support for it, is trying to use "it's a standard" as a diversion against the very real costs of maintaining that support.

haven't personally attacked any of the maintainers anywhere,

I didn't say you personally attacked anyone. You misread my words.

@sigmavirus24 No offence, but I am pretty sure that "ad hominem" does really mean "an argument based on the character of the opponent". The [...] snipped part of the wikipedia quote you yourself provided actually says exactly that.

Typically this term refers to a rhetorical strategy where the speaker attacks the character, motive, or some other attribute of the person making an argument rather than attacking the substance of the argument itself.

And from my understanding the

This avoids genuine debate by creating a diversion to some irrelevant but often highly charged issue.

part is simply a statement of fact and not the definition. All the dictionary entries I can find also seem to agree, that "ad hominem" means either an attack on the character of the opponent or an appeal to prejudices. Wikitionary, Merriam-Webster, Dictionary.com.

Although, it's possible that I'm wrong. English is not my first language, so I might be mistaken in this case.


As I see it, @Nytelife26 first comment was a fairly reasonable and polite argument, attempting to refute the (possibly) outdated notion that this feature would only be useful to a small group of users. While something being a part of a PEP is not a good argument for it being good, it is a good argument for it not being an unpopular or fringe use case. If it has a PEP and is implemented in at least 5 major tools, it's at least big enough to have a civil discussion about.

I agree with you, that his second comment is not very polite to say the least, but it's not like his reaction is completely unprompted. As I see it, his outburst was triggered by the following part of your comment:

The people talking this up are over-selling the standard (like you are) for ad hominem purposes.

From his point of view, he came into this issue to have a civil discussion, but was immediately accused of making a personal attack (maybe you didn't mean that, but that's definitely how he understood you). I would once again reiterate that he could have replied in a more polite of a manner, but from a "who shot first" perspective, you can't blame him too much.


This conversation and issue has been pointlessly circular as users demand things maintainers can't afford to support.

No. As pointed out by other people in this issue, nobody is demanding anything. This is (AFAIK) an open source project. We are (trying) to have a discussion about whether this feature is worth your (and our, as a community of contributors) time and effort.

Every person who leaves a comment on this issue or even just thumbs up the OPs comment is simply voicing their opinion. I don't think that anybody in this thread has come here with bad intentions (like maliciously inflating the public perception of the support for the pyproject.toml file or bullying the maintainers into implementing a feature).

People are offering their help with implementing this feature. People are giving arguments for and against this feature being implemented (developer and maintainer effort being part of this discussion). This is how Open Source is supposed to work, no?

@Nytelife26
Copy link

Nytelife26 commented Apr 30, 2021 via email

@RuRo
Copy link
Contributor

RuRo commented Apr 30, 2021

Although, that does bring one thing to my attention. The tool can already read TOML configuration (mostly) due to its similarity to .cfg, as I highlighted earlier in the thread. It just doesn't fully or officially support it, and it doesn't use the correct configuration header format for pyproject.toml files. Therefore, it would not be overly complex.

@Nytelife26 I've tried it and for my project configuration files it failed, when trying to parse an unrelated part of the configuration. Unfortunately .ini/.cfg is not 100% .toml and it's different enough to the point where I don't think you can just kludge it together to support arbitrary .toml files. And we need arbitrary .toml, since pyproject.toml will also contain the configuration for other tools.

With that said, I do agree that it shouldn't be too complicated. It's not "just enable it, lol" simple, but more like "write a thin wrapper around toml that emulates configparser.RawConfigParser" simple.

I don't know, how close of a superset toml is compared to ini. If it is close enough, then this parser can just replace configparser.RawConfigParser, if it's not, then we can just use it when path.endswith('.toml').

After that, adding the tool.pydocstyle section is indeed "just enable it, lol" simple.

@Nytelife26
Copy link

repeated over and over and over to get your way

We aren't repeating claims, we're making points that relate to the discussion. It feels repetitive because it has been going on for quite some time.

I didn't say you personally attacked anyone. You misread my words.

Your words were "The people talking this up are over-selling the standard (like you are) for ad hominem purposes". Notice the "(like you are)". You are implying that I, too, am engaging in ad hominem, and simply overselling a standard. Do I misread or do you miswrite?

That's the definition of an ad hominem.
[...]
This avoids genuine debate by creating a diversion to some irrelevant but often highly charged issue.

"avoids genuine debate by"
That is a statement of purpose. Ad hominem, or personal attacks, draw discussion away from genuine debate to other abstract factors of the people involved. That is the purpose and result of an ad hominem, not what it is. However, this is GitHub, not a linguistics forum, so I will not partake in any further discussion regarding what people have or have not said. The points I have made so far are sufficient.

other tools must implement support for it
[...]
is trying to use "it's a standard" as a diversion against the very real costs of maintaining that support.

Nobody has to - but your organization already has implemented support for it in its other projects. That alone proves that it can be done and it is not too complex or unmaintainable. If you genuinely believed it was, you would not have already done it.

that's not part of computer science. [...]
This is a discussion - if you don't know what those are, they're also quite common in science.

I do still stand by those statements. Ad hominem and related fallacies belong nowhere near informatics, science, or related fields. It is also important to note that this is a discussion, not a demand.

* emotional (apparently real scientists are robots) despite being quite detached and simply making observations in my comment,

"This conversation and issue has been pointlessly circular"
"demanding things maintainers can't afford to support"
"(like you are)"

Not once did I say real scientists are robots - I didn't even mention them. However, those definitely have undertones. They are not simply observations. They are passive aggressive at best. That is the reasoning for the response I gave you.

* talking down to me as if you're superior

You gave me a passive-aggressive comment with no constructive value, I gave you a reality check. The law of equivalent exchange.

None of which is very respectful in and of itself. Please point out exactly how I was disrespectful.

See the above. Once again, I am done discussing the semantics of language and respect, though. I will not be partaking in further discussion of these things.

you just drop support for things haphazardly. That's not how real software maintenance works.

It isn't haphazardly at all; versioning exists solely so you can make changes while informing existing users of the changes you make in upcoming releases, deprecations included, and so current users are not affected by your changes in future releases until they choose to update.

doesn't take into consideration the complexities of existing software.

It does, because it would reduce the complexity of the existing software, were you to deprecate other formats. Once again, though, I am not sure of their usage rates, so I am uncertain of how appropriate that solution would be.

I believe it's been said numerous times above that the maintainers don't have the time/energy for this

Once again, that is provably wrong. If you can do it in other projects, you evidently can do it.

still we have folks adding comments that add no new content and continue to repeat false statements

No false statements have been made, nor are there comments adding no new content. We are simply making points, and backing them up. That's as good as content gets.

no one has said "I'll help do this work"

I said it earlier, as have other people. A resolution needs to be achieved before effort is put into creating an implementation, though - nobody will work on something to later be told it is not happening.


Apologies, I thought it was due time for a formal response. If you want someone to work on this, let me know. Until then, I will not be participating in anything on this thread other than critical discussion points and the overall verdict.

@Nytelife26
Copy link

Unfortunately .ini/.cfg is not 100% .toml and it's different enough to the point where I don't think you can just kludge it together to support arbitrary .toml files.

I know - TOML is a superset for the most part (of CFG), not a subset. It supports basics, but special types are off the table thus far.

With that said, I do agree that it shouldn't be too complicated. It's not "just enable it, lol" simple, but more like "write a thin wrapper around toml that emulates configparser.RawConfigParser" simple.

That sounds like a good idea. I haven't delved too much into the configuration system used by pydocstyle just yet, but it sounds viable enough to consider.

I don't know, how close of a superset toml is compared to ini. If it is close enough, then this parser can just replace configparser.RawConfigParser, if it's not, then we can just use it when path.endswith('.toml').

It would be better to use an actual TOML parser honestly. We'll see if this gets approved.

After that, adding the tool.pydocstyle section is indeed "just enable it, lol" simple.

Thank you for your contributions.

@RuRo
Copy link
Contributor

RuRo commented May 1, 2021

Consider me nerd-sniped, I've implemented pyproject.toml support.

@fabiencelier
Copy link

Thanks for the work @RuRo 👍

In what version will this be available ?

@Matesanz
Copy link

Matesanz commented Mar 8, 2023

Just to make it clear, on version 2.10.0:

👉 pyproject.toml (mind it is NOT tool.pycodestyle):

[pycodestyle]
max-line-length = 100

👉 command:

pycodestyle /path/to/file.py --config=pyproject.toml

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants