Skip to content

Py3fy webagg/nbagg. #10708

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

Merged
merged 1 commit into from
Mar 24, 2018
Merged

Py3fy webagg/nbagg. #10708

merged 1 commit into from
Mar 24, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Mar 7, 2018

(The locking of RendererAgg is already done by the super class, and thus
redundant here.)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added the Py3k label Mar 7, 2018
@anntzer anntzer added this to the v3.0 milestone Mar 7, 2018
@jklymak
Copy link
Member

jklymak commented Mar 8, 2018

Do we not test any of NBAgg?

@anntzer
Copy link
Contributor Author

anntzer commented Mar 8, 2018

No idea whether we do...

@QuLogic
Copy link
Member

QuLogic commented Mar 16, 2018

I think that might be what the notebook in the web_backend directory is for?

@anntzer
Copy link
Contributor Author

anntzer commented Mar 19, 2018

Now there are some tests :)

try:
self.figure.draw(renderer)
super().draw()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... this is pretty different. Does it do the same thing? Why just call super draw instead of the figure? Just trying to understand, not saying its wrong....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using Agg, this resolves to https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_agg.py#L414 which gets a cleared renderer, handles the locking and calls self.figure.draw(self.renderer).

Of course the not-so-secret objective here is to make it possible to swap in mplcairo's renderer. For that, the idea is as usual to push as much the renderer-specific code back to the super-class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I did find super().draw() a bit opaque.; ie. why not just self.draw()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well that would be an infinite loop...
super().draw() means (approximately) "call the draw method but don't look it up on this class, look it up on the base class [in this case, FigureCanvasAgg] instead" (check up e.g. "python super mro" for details)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops. duh.

@jklymak
Copy link
Member

jklymak commented Mar 21, 2018

If you rebase this so your new tests are included, will the codecov go up? Did you test this w/ your new tests?

(The locking of RendererAgg is already done by the super class, and thus
redundant here.)
@anntzer
Copy link
Contributor Author

anntzer commented Mar 21, 2018

rebased.
The tests actually touch a completely different part of webagg (because I don't know enough websockets to actually trigger a draw...) so I doubt that changes anything.

@jklymak jklymak merged commit 2164417 into matplotlib:master Mar 24, 2018
@anntzer anntzer deleted the py3webagg branch March 24, 2018 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants