Giter Club home page Giter Club logo

Comments (7)

sobolevn avatar sobolevn commented on June 12, 2024 3

I like it!

But, I think I need to explain why current format exists (and will be supported in the future).

It main feature is that you can copy-paste "Actual" output from mypy there. I sometime do this:

  1. I write some test
  2. I leave out: empty
  3. I run test
  4. I copy-paste "Actual" output and check it to be correct
  5. Done!

With this format, it will be easier to read, but harder to write.

from pytest-mypy-plugins.

antonagestam avatar antonagestam commented on June 12, 2024

@sobolevn Right, I think that makes sense too, there wouldn't be any need to replace the current format.

Just piling on with some more thoughts here:

Another possible "win" with introducing a higher level of abstraction is that the library could "take the hit" for unstable output from mypy. It would sure take work to implement, but it could possibly be a way forward for addressing issues like #45.

from pytest-mypy-plugins.

zero323 avatar zero323 commented on June 12, 2024

This is a nice idea, but I have a few concerns.

This probably requires more knowledge of the internals than I currently have, but I think it might make sense to allow omitting line numbers. I'm proposing that this example would match if there's revealed type on line nine, followed by an error message on any line after that (strictly greater than line 9).

This shouldn't be hard, but at the cost of further cementing match-in-order logic, which is already pretty blunt tool (#77). Also, but it is probably a lesser concern, it could result in false negatives, when

  • Expected error doesn't happen.
  • Unexpected, but matching error, happens at another line.

Another possible "win" with introducing a higher level of abstraction is that the library could "take the hit" for unstable output from mypy.

At the moment, dealing with changing mypy output is primarily a responsibility of the end users. It is a little bit of pain, but manageable, since you can control mypy version.

In contrast, making more sense out of mypy output within library, might require version specific parser ‒ something that can be hard to maintain, when checker output is not really part of the contract.

Not a big concern in case of the core idea, but can quickly get out of hand if you keep adding features.

from pytest-mypy-plugins.

abelcheung avatar abelcheung commented on June 12, 2024

Another possible "win" with introducing a higher level of abstraction is that the library could "take the hit" for unstable output from mypy. It would sure take work to implement, but it could possibly be a way forward for addressing issues like #45.

@antonagestam I'm also a victim of mypy changing output string over and over. Well, it's kind of expected when people have to deal with plain text output, but still. Pinning mypy version as suggested by @zero323 is a way to deal with such problem.

If you are interested in seeing more fine-grained mypy output, you can take a look at python/mypy#10816 and python/mypy#11396. However don't hold your breath for it — given the people involved in the discussion over time, I am fairly confident that mypy core dev has completely no interest and no intention to make output more accessible.

from pytest-mypy-plugins.

sobolevn avatar sobolevn commented on June 12, 2024

Well, since I am mypy core dev myself, I am pretty interested in this :)

But, this is a complex project that requires quite a lot of details to get it right.
If you have any proposals, please feel free to share them.

from pytest-mypy-plugins.

antonagestam avatar antonagestam commented on June 12, 2024

@abelcheung Oh cool, structured output from mypy directly seems like a much more viable approach.

from pytest-mypy-plugins.

tushar-deepsource avatar tushar-deepsource commented on June 12, 2024

@sobolevn I have a proposal in python/mypy#11396, but there has been zero core dev interaction on that PR. If you can take a look at it, not only will we get structured output but it'll also unlock future endeavours like being able to define a custom output format with a plugin, or to add new fields to the output like exact issue codes.

from pytest-mypy-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.