-
Notifications
You must be signed in to change notification settings - Fork 4
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
Kyle/fsspec integration #60
Closed
martindurant
wants to merge
24
commits into
developmentseed:kyle/fsspec-integration
from
martindurant:kyle/fsspec-integration
Closed
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
05c1f5d
Streaming list results (#35)
kylebarron ba3e83c
Update package description (#36)
kylebarron f5a5c29
Optionally return list result as arrow (#38)
kylebarron b581ce4
Return buffer protocol object from `get_range` and `get_ranges` (#39)
kylebarron 6b6f666
Support range in GetOptions (#40)
kylebarron 1d403ea
Rename package to object-store-py (#41)
kylebarron 70a0de9
Fix typing and docs website (#42)
kylebarron 5f50fda
Rename to obstore (#45)
kylebarron f3644a6
Update docs website CSS (#46)
kylebarron ae2de0e
Add custom exceptions (#48)
kylebarron 6e6dc10
Add put options (#50)
kylebarron 245bf50
remove `range` from `GetOptions` for now (#51)
kylebarron ff99c42
bump to 0.2.0-beta.1 (#52)
kylebarron cd50634
Fix python package name (#53)
kylebarron eba5019
Bump to 0.2 (#56)
kylebarron c318a53
boto3 region name can be None (#59)
kylebarron bf4f5e0
Add test fixtures
martindurant fdd2a79
Merge branch 'kyle/fsspec-integration' of https://github.com/developm…
martindurant 9779d3b
Add __repr__ to store classes (#61)
kylebarron e1ed765
Use `moto` for S3 tests (#62)
kylebarron 6495836
Merge branch 'main' into kyle/fsspec-integration
martindurant 68a2d1f
Simple file override
martindurant ec9c559
silghtly more
martindurant 956b1c0
lint
martindurant 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,68 @@ | ||
import boto3 | ||
import os | ||
|
||
import pytest | ||
pytest.importorskip("moto") | ||
from moto.moto_server.threaded_moto_server import ThreadedMotoServer | ||
|
||
from object_store_rs.store import S3Store | ||
import object_store_rs as obs | ||
import pyarrow.parquet as pq | ||
from object_store_rs.fsspec import AsyncFsspecStore | ||
|
||
# session = boto3.Session() | ||
|
||
store = obs.store.HTTPStore.from_url("https://github.com") | ||
fs = AsyncFsspecStore(store) | ||
url = "opengeospatial/geoparquet/raw/refs/heads/main/examples/example.parquet" | ||
test = pq.read_metadata(url, filesystem=fs) | ||
ip = "localhost" | ||
port = 5555 | ||
endpoint_uri = f"http://{ip}:{port}" | ||
test_bucket_name = "test" | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def s3_base(): | ||
server = ThreadedMotoServer(ip_address=ip, port=port) | ||
server.start() | ||
os.environ["AWS_SECRET_ACCESS_KEY"] = "foo" | ||
os.environ["AWS_ACCESS_KEY_ID"] = "foo" | ||
os.environ["AWS_ENDPOINT_URL"] = endpoint_uri | ||
|
||
print("server up") | ||
yield | ||
print("moto done") | ||
server.stop() | ||
|
||
|
||
@pytest.fixture() | ||
def s3(s3_base): | ||
from botocore.session import Session | ||
session = Session() | ||
client = session.create_client("s3", endpoint_url=endpoint_uri) | ||
client.create_bucket(Bucket=test_bucket_name, ACL="public-read") | ||
client.put_object(Bucket=test_bucket_name, Key="afile", Body=b"hello world") | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def reset_s3_fixture(): | ||
import requests | ||
# We reuse the MotoServer for all tests | ||
# But we do want a clean state for every test | ||
try: | ||
requests.post(f"{endpoint_uri}/moto-api/reset") | ||
except: | ||
pass | ||
|
||
|
||
@pytest.fixture() | ||
def fs(s3): | ||
return AsyncFsspecStore(S3Store.from_env(test_bucket_name)) | ||
|
||
|
||
def test_list(fs): | ||
out = fs.ls("", detail=False) | ||
breakpoint() | ||
1 | ||
|
||
|
||
def test_remote_parquet(): | ||
store = obs.store.HTTPStore.from_url("https://github.com") | ||
fs = AsyncFsspecStore(store) | ||
url = "opengeospatial/geoparquet/raw/refs/heads/main/examples/example.parquet" | ||
pq.read_metadata(url, filesystem=fs) |
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.
Why remove the
ObjectStore
typing here?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.
It wasn't importing, and this is only typing. Perhaps something with my environment.
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.
Yeah it's a type-only object. Perhaps it should be changed in the future to be an actual Python object that can be imported at runtime. The
from __future__ import annotations
should allow this to not be evaluated.