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

Announcement issue for plugin API changes #6617

Open
msullivan opened this issue Apr 3, 2019 · 3 comments

Comments

@msullivan
Copy link
Collaborator

commented Apr 3, 2019

The mypy plugin interface is experimental, unstable, and prone to change. In particular, there are no guarantees about backwards compatibility. Backwards incompatible changes may be made without a deprecation period.

We will, however, attempt to announce breaking changes in this issue, so that plugin developers can subscribe to this issue and be notified.

Breaking changes fall into three broad categories:

  1. Changes to the actual plugin API itself
  2. Changes to parts of the "implicit plugin API"---that is, internals that plugins are likely to use (representation of types, etc).
  3. Changes to things that really aren't plausibly part of the plugin API (but, of course, that some plugins might be using anyway...)

Issues in category 1 will be consistently announced here, issues in category 3 will probably be announced here only if problems are reported, and issues in category 2 will be somewhere in the middle.

@msullivan

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 3, 2019

And we'll start this off with a belated category 3 announcement:

The default wheels for mypy 0.700 are compiled with mypyc. This breaks monkey-patching of mypy internals.

If you are the author of a mypy plugin that relies on monkey-patching mypy internals, get in touch with us and we can probably find a better approach. (For example, #6598 added hooks needed by the django plugin.)

msullivan added a commit that referenced this issue Apr 3, 2019

Add some more plugin docs
 * Link to plugin changes announcement issue (#6617)
 * Document get_additional_deps()

msullivan added a commit that referenced this issue Apr 5, 2019

Add some more plugin docs (#6618)
 * Link to plugin changes announcement issue (#6617)
 * Document get_additional_deps()

@ethanhs ethanhs pinned this issue Apr 10, 2019

@gvanrossum gvanrossum unpinned this issue Apr 24, 2019

@gvanrossum gvanrossum pinned this issue Apr 24, 2019

@gvanrossum

This comment has been minimized.

Copy link
Member

commented Apr 24, 2019

(Sorry for the accidental unpin. Fixed now.)

@JelleZijlstra JelleZijlstra unpinned this issue May 3, 2019

@ilevkivskyi ilevkivskyi pinned this issue May 25, 2019

@JukkaL

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

The new semantic analyzer requires changes to some plugins, especially those that modify classes. In particular, hooks may be executed multiple times for the same definitions. PR #7135 added documentation about how to support the new semantic analyzer.

Note that mypy 0.720 (to be released soon) will enable the semantic analyzer by default, and the next release after that will remove the old semantic analyzer.

PRs #7136, #7132, #7096, #6987, #6984, #6724 and #6515 contain examples of changes that may be needed to plugins.

To test that a plugin works with the semantic analyzer, you should have test cases that cause mypy to analyze things twice. The easiest way to achieve is to add a forward reference to a type at module top level:

forwardref: C   # Forward reference to C causes deferral
class C: pass

# ... followed by whatever you want to test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.