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

pyplot/pycall API updates #1932

Closed
stevengj opened this issue Feb 28, 2019 · 11 comments
Closed

pyplot/pycall API updates #1932

stevengj opened this issue Feb 28, 2019 · 11 comments

Comments

@stevengj
Copy link
Contributor

PyCall 1.90.0 and PyPlot 2.8.0 are now released, which change o[:foo] and o["foo"] to o.foo and o."foo", respectively, for python objects o.

The old getindex methods still work but are deprecated, so you'll want to put out a new Plots.jl release that uses the new methods and REQUIREs the new versions to avoid having zillions of deprecation messages.

@mkborregaard
Copy link
Member

Thanks. Yeah, the disadvantage with Plots' conditional package loading is that we can't depend on different versions of the backend packages. So, we'll tag a Plots 0.24.0 with the change, and everyone will just have to update to the newest PyCall and PyPlot versions to use the backend.

@stevengj
Copy link
Contributor Author

You can check for e.g. isdefined(PyCall, :_setproperty!) if you want to check explicitly whether the user has a PyCall with JuliaPy/PyCall.jl#517.

@mkborregaard
Copy link
Member

mkborregaard commented Feb 28, 2019

Ah, that's nice!
I'm not 100% certain this is needed though - I added #1933 for this, but there was only a single place to fix, and pyplot(); scatter(1:10) works without deprecation warnings on PyCall 1.90.0 and PyPlot 2.8.0 for the released version of Plots.
You wouldn't have some code that will recreate the problem I can use to test?

@mkborregaard
Copy link
Member

I'll merge #1933 since it appears harmless. Thanks!

@stevengj
Copy link
Contributor Author

stevengj commented Mar 1, 2019

#1933 doesn't close this. You still have lots of other deprecated usages like pycolors["LinearSegmentedColormap"][:from_list] or pypath["Path"]or pynp["ma"][:masked_invalid]

o["foo"] should be replaced with o."foo".

@mkborregaard mkborregaard reopened this Mar 1, 2019
@mkborregaard
Copy link
Member

Oh :-O on it

@daschw
Copy link
Member

daschw commented Mar 15, 2019

@stevengj Is there a way to still do something like

letter = axis[:letter]
lfrom, lto = axis_limits(axis)
ax[Symbol("set_", letter, "lim")](lfrom, lto)

with the new API?

@diegozea
Copy link
Contributor

I think you can call getproperty explicitly in those cases: getproperty(ax, Symbol("set_", letter, "lim"))

@daschw
Copy link
Member

daschw commented Mar 15, 2019

Thanks a lot @diegozea !

@stevengj
Copy link
Contributor Author

Note also that in many of these cases you might want to switch from a.foo to a."foo" — if you know you want a PyObject result, it is faster if you skip the automatic conversion.

@daschw
Copy link
Member

daschw commented Mar 15, 2019

Thanks!

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

No branches or pull requests

4 participants