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

Undo global context #408

Closed
snowman2 opened this issue Aug 20, 2019 · 6 comments · Fixed by #412
Closed

Undo global context #408

snowman2 opened this issue Aug 20, 2019 · 6 comments · Fixed by #412

Comments

@snowman2
Copy link
Member

Due to #403, I think the solution to #374, is to:

  1. Undo: updated to only have one PJ_CONTEXT per pyproj session #376
  2. Use fix in PROJ: C API: add proj_context_set_autoclose_database() to automatically close database (fixes #1565) OSGeo/PROJ#1566
@jorisvandenbossche
Copy link
Contributor

The problem with this proposed solution is that it depends on a future release of PROJ, I think? (meaning, problem to solve it now. I don't know when a next PROJ release would occur, and that also would bump the minimal required version?)

@snowman2
Copy link
Member Author

The version bump will be necessary for adding support for:
OSGeo/PROJ#1547

If this fix is merged in soon, the next PROJ release is scheduled for September 1.

@snowman2
Copy link
Member Author

I haven't been able to to come up with a clean solution without the change in PROJ. But, if you think of one, I would be happy to give it a go.

@jorisvandenbossche
Copy link
Contributor

The version bump will be necessary for adding support for:
OSGeo/PROJ#1547

But that could be optional? Or is there a reason you need this in pyproj?

I haven't been able to to come up with a clean solution without the change in PROJ.

Short term, it seems like choosing between segfaults on windows or crashes with many CRS objects? (although I didn't follow both closely) In the last release you fixed the second which caused the first, correct? It could also be chosen the other way around (but again, don't know which of the two affects most end-users)

@snowman2
Copy link
Member Author

But that could be optional? Or is there a reason you need this in pyproj?

Provide pathway to address #401 and #389

It could also be chosen the other way around

Yeah, I went ahead with it as is for 2.3.0 so there is at least one version with a fix in it for the second problem. Next step in the plan is to undo global context in 2.3.1 (to have fix for first problem) and then in 2.4.0 using the PROJ fix to resolve the second problem.

Side note: Looks like 2.3.0 works fine in windows with conda-forge. Just wheels have issues.

@snowman2
Copy link
Member Author

One thought I had was to add an optional kwarg context when creating the Proj, CRS, Transformer objects. Then, a user could pass in their own ContextManager. This could allow for a semi-global context when many of the objects are being created. But, if it is not passed in, a new ContextManager is created in its stead.

This could be accomplished by making the ContextManager public:
https://github.com/pyproj4/pyproj/blob/master/pyproj/_datadir.pyx

This would provide a solution for both use cases and would not require pinning to the new version of PROJ yet. That being said, I am still thinking I might pin to the new version soon due to the new features included.

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 a pull request may close this issue.

2 participants