-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 for pyproject.toml #5205
Comments
PEP 518 is accepted and specifies that |
Does adding pyproject.toml mean that we can remove other config files?
Until that point I'm not excited.
|
I think that removing other config files would simplify config parsing even more. I would be very glad to change If you agree that There is already lots of deprecated options:
So legacy config files ( |
Note that mypy.ini serves a completely different purpose from setup.py, setup.cfg, and pyproject.toml. The mypy.ini file is read by mypy when it is about to type-check another program. The other files (IIUC) are used to build mypy itself. I don't think we can change mypy.ini much, though we can start removing deprecated flags (after they have been printing a warning for 1-2 release cycles). Please do that in a separate PR. |
Even if If you are talking about to replace Now taking about mypy config files when type-checking other programs, they are all equivalents and fallbacks of the next one ( I will submit a PR to remove that flags later on. |
To put it clear: enable sections like |
Switching mypy.ini to a toml thing sounds like scope creep and we won't have the time and motivation to review PRs related to this, so please don't start on that. The rest is fine of course. |
Seems that I misunderstood that to remove others would be necessary to the overral comunity need to target the same. Sorry.
|
So what exactly is being proposed here? There's a few things I can think of:
|
Pytest seems to be stalled until someone works on it pytest-dev/pytest#1556 An issue for flake8 was opened yesterday https://gitlab.com/pycqa/flake8/issues/428 And the same for coverage https://bitbucket.org/ned/coveragepy/issues/664/allow-configuration-via-pyprojecttoml I think we should add support for reading mypy's configuration from pyproject.toml, but it looks like we will need to wait to use it for our own config. |
The first option. IMHO were some convergence towards master...pslacerda:feature/pep518 But also the second option. @ethanhs, seems that as more and more projects adopt it, more sense has to put all that config files centralized. There is divergent opinions for projects with very large |
Maybe that branch isn't so rudimentary and maybe you allow I submmit this PR. EDIT: there is a bug that nested tables dont flatten correctly here. I need to work more on it. |
If you do want to continue this discussion please do submit the PR. Please understand that doesn't mean it will be accepted. |
Thanks -- I finally understand that TOML is meant as an alternative to mypy.ini. My apologies for not understanding this earlier. There is no particular urgency for this, is there? The PR is nice to have but we'll need to find time to review it carefully. Also, did you add tests? |
Take your time to review, there is no urgency. I adapted some tests and also put my opinions on the PR. |
I've rejected the PR, and I'm going to close this issue. I don't think this solves a real problem for mypy. Sorry! |
I'm saying that mypy is a build/test time requirement in my projects. |
PEP 518 doesn't say that all build/test requirements must use pyproject.toml for their own configuration. It only says that the list of packages to be installed must be specified there (as opposed to in a parameter to the setup() call in setup.py). |
Hey, it would be nice to remove |
There's actually some risk in doing that. http://github.com/python/black only supports |
I don't think that's a reasonable concern. PEP 518 indicates that |
Perhaps not for mypy, but I think having a good standard format and place to store config for tools that are used during development is a boon. PEP 518 does specify a
|
Indeed, MyPy's support of Just sharing. |
Indeed, and someone already has a working PR ... |
PyPA’s position has always been, and likely will continue be that It is also not accurate to say |
I'm not disagreeing with anything you said, but I do think it's worth pointing out that PEP 518 explicitly defines the |
An earlier version of PEP 518 led to a lot of finger-pointing when Black and Towncrier (examples from the top of my head, there may be more) started to use the |
Let's face it, the "PyPA’s stance" is just an opinion of a small number of community members which clearly contradicts the process actually happening in the community and the request for that being highly spread. |
I think a better way to phrase it is the PyPA is not mandating tools use Personally, I want tools to use it. 😉 |
Ok there has been much talk about this issue, and since it is re-opened, I'm guessing that the mypy maintainers would be willing to humor pull-requests from the community. So, maybe it's time to shift the discussion from "gosh I wish this feature were implemented" to "how can this feature be implemented". |
Exactly. The next step here should be a pull request. I'll try to make time to review it, but first we need a pull request. |
I am not familiar with mypy internals. Does mypy have some sort of config IR that is used as a destination for both |
Refer to #5208 (review) |
Closes #5205. This PR will add support to mypy for end users specifying configuration in a pyproject.toml file. I also updated the documentation to indicate that this support has been added, along with some guidelines on adapting the ini configurations to the toml format.
Any plan to do a release with this feature ? |
Hopefully there's a new release within the next month (as always, no promises). |
I hope so, because the docs are already updated and as a new user I've just spent an hour wondering why I couldn't get it to work. Then I found this issue. 🤡 |
I understand this is closed but I'm trying to understand why something I used before doesn't work. I was at least able to do this before:
In my
This would work. The message about missing imports would be gone for the expects library. It no longer does when I'm using 0.910. In fact, it looks like it stopped working in 0.900. If I go back to 0.812, it works fine. I was just calling this out to make sure if this was a deliberate change. |
The syntax in pyproject.toml is a little different, you need to use |
Ah! Much thanks. Yes, I did find it here: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file |
We still need a stup setup.cfg [until](pypa/setuptools#2816) setuptools gets proper editable installs and either flake8 [**finally**](python/mypy#5205) gets the hint and support pyproject or [flakeheaven](https://github.com/flakeheaven/flakeheaven) is usable with vscode.
PEP518 says that
pyproject.toml
is to support the minimum build requirements. I want to consider mypy as part of the minimum build on my package.For example Pip uses a
[tool.towncrier]
section onpyproject.toml
to generate a correctly updatedNEWS.rst
as part of its build. One can considers typing correctness as important to the distributed source pakcage as an well documentedNEWS.rst
. Other example is Black that also has it section onpyproject.toml
.Maybe you think that this is a silly feature request and that
setup.cfg
must be used instead, Pip or Flit or whatever can setup mypy after all. But an TOML module will be added to the standard library sooner or later, than could mypy accept this feature and antecipate TOML supportingpyproject.toml
today?The text was updated successfully, but these errors were encountered: