-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add package extension on RecipesBase #143
base: main
Are you sure you want to change the base?
Conversation
src/plots.jl
Outdated
macro enable(typ) | ||
esc(expr_enable(typ)) | ||
end | ||
|
||
# Compat | ||
macro enable_geo_plots(typ) | ||
esc(expr_enable(typ)) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, this is no longer available as a "name" to import from GeoInterface / some other package. Do you want to keep the package GeoInterfaceRecipes and just load that code path as the extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The macro is exported by GeoInterface now, so it should be usable. I've answered your other question in the general comments.
This at least fixes #110 (for people that forget to do I still have to check whether this can be used to deprecate GeoInterfaceRecipes completely, and how that would work. Essentially, as soon as a package uses RecipesBase, it would trigger this package extension, but if it triggers in an extension on RecipesBase, then the macro would not be available. |
Co-authored-by: Anshul Singhvi <[email protected]>
I'm also not sure about defining |
Yeah the other solution that I considered is just duplicating the code. I'm pretty unsure about include, as it's a standalone package, even though it's in a monorepo here right? |
Can we just do the Then we don't have the circular dep on the sub-packages but we can use the same code and not break anything. It does end up using a bit more compilation and memory as its the same code used twice, but I think that's ok. Edit: we may need to move code out of the modules into separate files for this to work. |
GIMakieExt is circular but RecipesExt could work |
Oh of course because Makie depends directly on GeoInterface.jl via GeometryOps.jl, forgot for a second. Maybe... could we just move the GeometryBasics.jl geointerface code to an extension in GeoInterface.jl? We need to solve this somehow |
I think we tried to in a GeometryBasics PR but I ended up not wanting to do that for some reason. We can in theory just have Makie depend on GeoInterfaceMakie too... |
While it seems to work locally, I at least get cache misses for precompiling. I don't think it's intended for code to be included outside of the ext folder/file.
|
Ok, moved all the conversion code to the extension so it doesn't slow down GeoInterface itself by default. Only the macro stubs are now left in. GeoInterfaceRecipes is now empty, it imports RecipesBase and GeoInterface and only re-exports the enable macros. It depends on Julia 1.9 and this version of GeoInterface, so if someone loads this new version it will trigger the package extension. If you have an older version, even though the package extension will trigger, you should get the macro from GeoInterfaceRecipes itself. This effectively deprecates GeoInterfaceRecipes. I will test this with ArchGDAL (it depends directly on GeoInterfaceRecipes). |
Cool! Now we need to figure out how to do this with Makie. If we move the GeoInterface code in GeometryBasics to an extension here instead that should work too? There will be some juggling to do to not break things in the handover |
It should work, although I'm not that familiar with the triangle of Makie(Core?)/GeometryBasics/GeoInterface. But thinking about it, it might clash on the @enable macro if you also load RecipesBase, since we moved the stub to the shared GeoInterface here. |
Oh no the Probably we need to define e.g. |
We need two, or weird stuff with Module dispatch in the macro (1.10+). So I would go with
|
Yeah thats what I mean |
What's the motivation for |
Yes isn't the idea that |
|
I get the feeling that the number of geometries that are GeoInterface enabled but don't have Now that the macros will actually be accessible it seems reasonable to do, at least to me... |
I was also hoping |
Ah fair enough, my two major gripes were
The latter is indeed rarer, and not that important. And geoplot is a new thing indeed, so let's say that this was just a nice exercise in hacking RecipesBase. I'll revert the |
That will probably continue to be an issue AFAICT, we can document it better though.
My understanding is that this PR makes it so that this should not be an issue? |
|
||
[deps] | ||
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" | ||
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" | ||
|
||
[compat] | ||
GeoInterface = "1" | ||
GeoInterface = "1.3.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GeoInterface = "1.3.7" | |
GeoInterface = "1.3.8" |
This moves all the plots related code, including the macro(!) into GeoInterface. This now works:
Since we now export the macros, I think the existing GeoInterfacesRecipes continues to work, even though it's now empty.