-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
ENH: add support to read, write, list and remove /vsimem/
files
#457
Merged
brendan-ward
merged 37 commits into
geopandas:main
from
theroggy:ENH-make-it-possible-to-use-/vsimem-
Sep 27, 2024
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
7e327b9
ENH: add support to use /vsimem/ input files
theroggy 0c1458b
ENH: make it possible to use /vsimem files
theroggy 8f7733d
Update CHANGES.md
theroggy 949e30f
temporarily add pyproj as dependency in CI
theroggy 72c5248
Try to fix directory creation issue for gdal <3.8
theroggy 4786a2b
Update _io.pyx
theroggy c7c7a2c
Update _io.pyx
theroggy 4d69b9a
Support vsimem files in a directory for gdal<3.8
theroggy 82b08d4
Textual improvements
theroggy 33f55a6
improve directory name for vsimem fixture
theroggy 8d281cf
Skip arrow write test for gdal < 3.8
theroggy d9ad3d7
fix vsimem listlayers test
theroggy b728332
rename is_tmp_vsimem to use_tmp_vsimem
theroggy 3621218
Rename is_tmp_vsi to use_tmp_vsimem
theroggy 1b15004
Rename input params in _ogr.pxd to path
theroggy 504cc3d
Merge remote-tracking branch 'upstream/main' into ENH-make-it-possibl…
theroggy 2c5f522
Merge main
theroggy 149a0ad
sort dependencies (to trigger tests)
theroggy 9870fdf
Update lint.yml
theroggy 37cd30e
Merge remote-tracking branch 'upstream/main' into ENH-make-it-possibl…
theroggy e4ab48d
Apply feedback: small changes
theroggy 68a595a
Apply feedback: small change
theroggy cfdfd7c
Fix test
theroggy a997cef
Let get_ogr_vsimem_write_path return if a tmp vsimem file is used
theroggy d610f00
Apply feedback, textual changes
theroggy 63a8cb6
Apply feedback: textual change
theroggy 2c11d77
Parametrize test_vsimem_rmtree_error
theroggy 07b500a
Add doc to test_get_vsi_path_or_buffer_obj_to_string
theroggy 8806612
Move vsimem_rmtree_toplevel to util + tests to new test_util.py
theroggy c3a01e5
Fix test_vsimem_rmtree_error
theroggy a12f78d
Merge remote-tracking branch 'upstream/main' into ENH-make-it-possibl…
theroggy 774a6e8
Remove 0.9.1 in changelog
theroggy bf2b455
Feedback: textual changes + merge some vsimem tests
theroggy bc8edd2
Rollback changes to test_vsimem_rmtree_error
theroggy 6436be1
Update test_core.py
theroggy bd51c70
Use requires_arrow_write_api to skip write arrow test
theroggy 76cf286
Remove unreachable code regarding use_tmp_vsimem
theroggy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cdef str get_ogr_vsimem_write_path(object path_or_fp, str driver) | ||
cdef tuple get_ogr_vsimem_write_path(object path_or_fp, str driver) | ||
cdef str read_buffer_to_vsimem(bytes bytes_buffer) | ||
cdef read_vsimem_to_buffer(str path, object out_buffer) | ||
cdef delete_vsimem_file(str path) | ||
cpdef vsimem_rmtree_toplevel(str path) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we explicitly want to expose those functions publicly (top-level) to our users as well? (are there specific use cases we are thinking of?)
Because if this is mostly for the tests, we can also import from
pyogrio.core
orpyogrio.util
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.
I struggled with this as well. Some of them may be useful in order to leverage GDAL's VSI interface. That said, if you are using a different package to create VSI resources (e.g., the
gdal
package used directly), maybe you should use that other package to handle any related cleanup.If we do want to keep this public, want to put these in the top-level interface? Maybe we should move the VSI related functions to
vsi.py
and expose these there, so that they are available, but compartmentalized for advanced usage a bit better?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.
I think it is practical/logical when it is possible to create files in e.g. /vsimem/ that the functions to remove them again are available as well without having to install another package...
Putting them in a seperate interface is possible, but I don't really see an obvious advantage.
pyogrio
doesn't have that many functions, and I was quite happy that the hierarchy was removed inshapely
following the "Flat is better than nested" philosophy :-).