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

remove pygplates.py? #307

Open
michaelchin opened this issue Jan 20, 2025 · 5 comments
Open

remove pygplates.py? #307

michaelchin opened this issue Jan 20, 2025 · 5 comments
Assignees

Comments

@michaelchin
Copy link
Contributor

@jcannon-gplates

Do you think we should remove the file pygplates.py from gplately? Or you want to keep it as an empty file with only one line "from pygplates import *"?

Either way or other ways are all fine with me.

@jcannon-gplates
Copy link
Contributor

I had originally thought about removing it entirely, but then @brmather reminded that some users might be using it.

Having it as an empty file with just one line from pygplates import * sounds good to me. In order to avoid breaking users code.

@jcannon-gplates
Copy link
Contributor

Also we should get rid of all uses of gplately.pygplates (eg, from .pygplates import FeatureCollection as _FeatureCollection) from within GPlately, and instead just use regular pygplates (via import pygplates). That means that gplately.pygplates is only for users - and we could deprecate it (to be removed at some point in the future).

For example, there's a few places where _FeatureCollection and _RotationModel are used in GPlately (we can instead just use pygplates.FeatureCollection and pygplates.RotationModel).

And remove any uses of .filenames on them (which was just added to support pickling, but no longer needed since pyGPlates 1.0.0rc1).

And this function could probably just get removed:

gplately/gplately/gpml.py

Lines 275 to 292 in a1a6de2

def _load_FeatureCollection(geometry):
if isinstance(geometry, _FeatureCollection):
return geometry
elif isinstance(geometry, pygplates.FeatureCollection):
geometry.filenames = []
return geometry
elif _is_string(geometry) and type(geometry) is list:
fc = _FeatureCollection()
for geom in geometry:
fc.add(_FeatureCollection(geom))
fc.filenames = list(geometry)
return fc
elif _is_string(geometry):
return _FeatureCollection(geometry)
elif geometry is None:
return None
else:
raise ValueError("geometry is an invalid type", type(geometry))

...or replaced with something like:

def _load_FeatureCollection(geometry): 
    features = pygplates.FeaturesFunctionArgument(geometry).get_features()
    return pygplates.FeatureCollection(features)

...which can parse a bunch of things as covered here.

@jcannon-gplates
Copy link
Contributor

Let me know if you want me to do this? I'm fine either way.

@michaelchin
Copy link
Contributor Author

Let me know if you want me to do this? I'm fine either way.

It would be great if you would like to help with this. I will focus on documentation this week and will take the whole next week off.

@jcannon-gplates
Copy link
Contributor

Sounds good 👍. Enjoy next week!

@jcannon-gplates jcannon-gplates self-assigned this Jan 20, 2025
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

2 participants