globusfs 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ python-version: ["3.10", "3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - run: pip install -e ".[dev]"
21
+ - run: ruff check .
22
+ - run: ruff format --check .
23
+ # Network tests hit a third-party public collection whose backend is
24
+ # intermittently degraded; they are informative, not gating.
25
+ - name: Unit tests
26
+ run: pytest -m "not network" -q
27
+
28
+ network:
29
+ runs-on: ubuntu-latest
30
+ continue-on-error: true
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: actions/setup-python@v5
34
+ with:
35
+ python-version: "3.12"
36
+ - run: pip install -e ".[dev]"
37
+ - name: Characterization tests against a live Globus collection
38
+ run: pytest -m network -q -rs
@@ -0,0 +1,41 @@
1
+ name: Release
2
+
3
+ # Publishes to PyPI on a version tag. Uses trusted publishing (OIDC),
4
+ # so there is no API token stored anywhere -- PyPI verifies the identity
5
+ # of this specific workflow in this specific repo.
6
+ on:
7
+ push:
8
+ tags: ["v*"]
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v5
16
+ - uses: actions/setup-python@v6
17
+ with:
18
+ python-version: "3.12"
19
+ - run: pip install build
20
+ - run: python -m build
21
+ # Fail early on malformed metadata rather than at upload.
22
+ - run: pip install twine && twine check dist/*
23
+ - uses: actions/upload-artifact@v4
24
+ with:
25
+ name: dist
26
+ path: dist/
27
+
28
+ publish:
29
+ needs: build
30
+ runs-on: ubuntu-latest
31
+ # Must match the environment name registered with the PyPI publisher.
32
+ environment: pypi
33
+ permissions:
34
+ # Required for trusted publishing; grants nothing else.
35
+ id-token: write
36
+ steps:
37
+ - uses: actions/download-artifact@v4
38
+ with:
39
+ name: dist
40
+ path: dist/
41
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
globusfs-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sam Foreman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.5
2
+ Name: globusfs
3
+ Version: 0.1.0
4
+ Summary: fsspec filesystem for Globus collections
5
+ Project-URL: Homepage, https://github.com/saforem2/globusfs
6
+ Project-URL: Source, https://github.com/saforem2/globusfs
7
+ Project-URL: Issues, https://github.com/saforem2/globusfs/issues
8
+ Author-email: Sam Foreman <saforem2@gmail.com>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 Sam Foreman
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: data,filesystem,fsspec,globus,hpc
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Science/Research
34
+ Classifier: Programming Language :: Python :: 3
35
+ Classifier: Topic :: System :: Filesystems
36
+ Requires-Python: >=3.10
37
+ Requires-Dist: aiohttp
38
+ Requires-Dist: fsspec>=2023.1
39
+ Provides-Extra: auth
40
+ Requires-Dist: globus-sdk>=3.30; extra == 'auth'
41
+ Provides-Extra: dev
42
+ Requires-Dist: pytest; extra == 'dev'
43
+ Requires-Dist: pytest-asyncio; extra == 'dev'
44
+ Requires-Dist: requests; extra == 'dev'
45
+ Requires-Dist: ruff>=0.14; extra == 'dev'
46
+ Description-Content-Type: text/markdown
47
+
48
+ # globusfs
49
+
50
+ An [fsspec](https://filesystem-spec.readthedocs.io/) filesystem for
51
+ [Globus](https://www.globus.org/) collections.
52
+
53
+ > **Status: working.** Verified against three live collections —
54
+ > including **ALCF Eagle** (`alcf#dtn_eagle`, 747 project directories),
55
+ > where `ls`, `glob`, `info`, `open()` with mid-file seek, and sparse
56
+ > ranged reads all work against production Lustre. Writes (`PUT`/`DELETE`)
57
+ > round-trip on Globus Tutorial Collection 1. Anonymous pyarrow column
58
+ > projection works on a public collection — one column of sixty, a few KB
59
+ > instead of 360 KB — while that collection was intermittently returning
60
+ > backend-fault 404s.
61
+
62
+ ```python
63
+ import globusfs
64
+
65
+ # Browser login once; tokens persist to ~/.globusfs/tokens.json
66
+ fs = globusfs.filesystem("<collection-uuid>")
67
+
68
+ fs.ls("/")
69
+ with fs.open("data/file.parquet", "rb") as f:
70
+ ...
71
+ ```
72
+
73
+ Public collections need no credentials — and no `globus-sdk`:
74
+
75
+ ```python
76
+ import fsspec, pyarrow.parquet as pq
77
+
78
+ fs = fsspec.filesystem(
79
+ "globus",
80
+ collection_id="isaac",
81
+ https_url="https://g-05a4b6.2d513.8443.data.globus.org",
82
+ )
83
+
84
+ with fs.open("isaac/ability/ALL_2007-01.parquet", "rb") as f:
85
+ # Reads only the bytes this column needs, over HTTP range requests.
86
+ table = pq.ParquetFile(f).read(columns=["author"])
87
+ ```
88
+
89
+ ## Why
90
+
91
+ Globus is how large scientific datasets actually move between facilities,
92
+ but there is no fsspec backend for it — so pyarrow, pandas, dask, and
93
+ grain can't read a Globus collection the way they read `s3://` or
94
+ `gs://`. This fills that gap with one backend that serves all of them.
95
+
96
+ ## How it works
97
+
98
+ Globus Connect Server exposes two services, and this needs both:
99
+
100
+ | Concern | Service | Why |
101
+ |---|---|---|
102
+ | Reading bytes | HTTPS collection endpoint | Serves full HTTP range semantics: 206, `Content-Range`, mid-file seeks, multipart |
103
+ | Listing / metadata | Transfer API | The HTTPS interface has no directory listings |
104
+
105
+ The read path subclasses `fsspec`'s `HTTPFileSystem`, which already
106
+ speaks exactly the range dialect GCS serves.
107
+
108
+ ### Server quirks this works around
109
+
110
+ Verified against a live collection:
111
+
112
+ - **Backend flakiness surfaces as a `404`.** GCS load-balances across
113
+ GridFTP backends; a failing one returns `ENDPOINT_ERROR` / `GCS Manager
114
+ Internal Error` rendered as HTTP 404 — byte-identical in status to a
115
+ genuinely missing file, and sticky for the life of a connection.
116
+ Observed failure rates on the public test collection swung from 0/20 to
117
+ 20/20 within minutes, hitting files, directories, and the collection
118
+ root alike. Retries need a *fresh* connection, and the only way to tell
119
+ a transient error from a real miss is to parse the body. **A client
120
+ that treats 404 as "absent" will report healthy data as missing.**
121
+ - **Suffix ranges (`bytes=-8`) return `416`**, which is how parquet
122
+ readers typically seek to the footer. Because `info()` knows the true
123
+ size, readers can use absolute offsets instead.
124
+ - **`HEAD` is unusable.** A HEAD 404 carries no body — and the body is
125
+ the *only* thing distinguishing a backend fault from a real miss. So
126
+ HEAD results are permanently ambiguous. Size and existence come from
127
+ the Transfer API, or from a ranged `GET` (which does return a body and
128
+ carries the total in `Content-Range`).
129
+ - **The HTTPS interface has no directory listings at all** — hence the
130
+ Transfer API for metadata.
131
+
132
+ ## Known ALCF collections
133
+
134
+ Resolved via `endpoint_search`; ALCF's docs list names, not UUIDs.
135
+
136
+ | Collection | UUID | Type |
137
+ |---|---|---|
138
+ | `alcf#dtn_eagle` | `05d2c76a-e867-4f67-aa57-76edeb0beda0` | mapped |
139
+ | `alcf#dtn_flare` | `f39a7a0f-5bfc-46ce-9615-ba9f8592814f` | mapped |
140
+ | `alcf#dtn_grand` | `3caddd4a-bb35-4c3d-9101-d9a0ad7f3a30` | mapped |
141
+ | Globus Tutorials on ALCF Eagle | `a6f165fa-aee2-4fe5-95f3-97429c28bf82` | guest, public |
142
+
143
+ Eagle's collection root is already `/eagle/projects`, so paths are
144
+ project-relative: `fs.ls("/datascience")`, not `/eagle/projects/datascience`.
145
+
146
+ Expect roughly **2 s per metadata or read operation** through the DTN —
147
+ fine for sparse reads and exploration, not for per-record access in a
148
+ training loop. See the note on training workloads below.
149
+
150
+ ## Credentials
151
+
152
+ Token acquisition is pluggable, because it varies more than anything
153
+ else: a public collection needs nothing, a portal already has a token,
154
+ an interactive user needs a browser.
155
+
156
+ | Provider | Use |
157
+ |---|---|
158
+ | `AnonymousCredentials` | Public collections (default) |
159
+ | `StaticToken` | A token you already hold |
160
+ | `CallableToken` | Fetch on demand — the pickle-safe option |
161
+ | `AppCredentials` | Wraps `globus_sdk` `UserApp`/`ClientApp` |
162
+
163
+ Two constraints worth knowing, both from the globus-sdk docs:
164
+
165
+ - **`GlobusApp` is not thread-safe**, but fsspec shares one filesystem
166
+ across threads. `AppCredentials` serializes every call through a lock.
167
+ - **fsspec pickles filesystems to worker processes.** A live token in the
168
+ constructor args would be copied into every worker payload, so
169
+ `StaticToken` refuses to pickle; use `CallableToken` reading from the
170
+ environment or shared storage so workers re-read rather than receive.
171
+
172
+ Also set `request_refresh_tokens=True` — it defaults to `False`, and
173
+ without it a long run dies when the access token expires mid-epoch.
174
+
175
+ ## A note on training workloads
176
+
177
+ This is built for *remote and sparse* reads: column projection,
178
+ exploration, data not yet staged. For distributed training, staging with
179
+ Globus Transfer to node-local scratch beats per-record HTTPS on every
180
+ axis — no per-record latency, no token expiry mid-epoch, and it works
181
+ with formats like ArrayRecord whose readers do their own seeking.
182
+
183
+ ## Tests
184
+
185
+ Characterization tests hit a real public collection and are marked
186
+ `network`:
187
+
188
+ ```bash
189
+ pytest # everything
190
+ pytest -m "not network" # offline only
191
+ ```
192
+
193
+ ## License
194
+
195
+ MIT
@@ -0,0 +1,148 @@
1
+ # globusfs
2
+
3
+ An [fsspec](https://filesystem-spec.readthedocs.io/) filesystem for
4
+ [Globus](https://www.globus.org/) collections.
5
+
6
+ > **Status: working.** Verified against three live collections —
7
+ > including **ALCF Eagle** (`alcf#dtn_eagle`, 747 project directories),
8
+ > where `ls`, `glob`, `info`, `open()` with mid-file seek, and sparse
9
+ > ranged reads all work against production Lustre. Writes (`PUT`/`DELETE`)
10
+ > round-trip on Globus Tutorial Collection 1. Anonymous pyarrow column
11
+ > projection works on a public collection — one column of sixty, a few KB
12
+ > instead of 360 KB — while that collection was intermittently returning
13
+ > backend-fault 404s.
14
+
15
+ ```python
16
+ import globusfs
17
+
18
+ # Browser login once; tokens persist to ~/.globusfs/tokens.json
19
+ fs = globusfs.filesystem("<collection-uuid>")
20
+
21
+ fs.ls("/")
22
+ with fs.open("data/file.parquet", "rb") as f:
23
+ ...
24
+ ```
25
+
26
+ Public collections need no credentials — and no `globus-sdk`:
27
+
28
+ ```python
29
+ import fsspec, pyarrow.parquet as pq
30
+
31
+ fs = fsspec.filesystem(
32
+ "globus",
33
+ collection_id="isaac",
34
+ https_url="https://g-05a4b6.2d513.8443.data.globus.org",
35
+ )
36
+
37
+ with fs.open("isaac/ability/ALL_2007-01.parquet", "rb") as f:
38
+ # Reads only the bytes this column needs, over HTTP range requests.
39
+ table = pq.ParquetFile(f).read(columns=["author"])
40
+ ```
41
+
42
+ ## Why
43
+
44
+ Globus is how large scientific datasets actually move between facilities,
45
+ but there is no fsspec backend for it — so pyarrow, pandas, dask, and
46
+ grain can't read a Globus collection the way they read `s3://` or
47
+ `gs://`. This fills that gap with one backend that serves all of them.
48
+
49
+ ## How it works
50
+
51
+ Globus Connect Server exposes two services, and this needs both:
52
+
53
+ | Concern | Service | Why |
54
+ |---|---|---|
55
+ | Reading bytes | HTTPS collection endpoint | Serves full HTTP range semantics: 206, `Content-Range`, mid-file seeks, multipart |
56
+ | Listing / metadata | Transfer API | The HTTPS interface has no directory listings |
57
+
58
+ The read path subclasses `fsspec`'s `HTTPFileSystem`, which already
59
+ speaks exactly the range dialect GCS serves.
60
+
61
+ ### Server quirks this works around
62
+
63
+ Verified against a live collection:
64
+
65
+ - **Backend flakiness surfaces as a `404`.** GCS load-balances across
66
+ GridFTP backends; a failing one returns `ENDPOINT_ERROR` / `GCS Manager
67
+ Internal Error` rendered as HTTP 404 — byte-identical in status to a
68
+ genuinely missing file, and sticky for the life of a connection.
69
+ Observed failure rates on the public test collection swung from 0/20 to
70
+ 20/20 within minutes, hitting files, directories, and the collection
71
+ root alike. Retries need a *fresh* connection, and the only way to tell
72
+ a transient error from a real miss is to parse the body. **A client
73
+ that treats 404 as "absent" will report healthy data as missing.**
74
+ - **Suffix ranges (`bytes=-8`) return `416`**, which is how parquet
75
+ readers typically seek to the footer. Because `info()` knows the true
76
+ size, readers can use absolute offsets instead.
77
+ - **`HEAD` is unusable.** A HEAD 404 carries no body — and the body is
78
+ the *only* thing distinguishing a backend fault from a real miss. So
79
+ HEAD results are permanently ambiguous. Size and existence come from
80
+ the Transfer API, or from a ranged `GET` (which does return a body and
81
+ carries the total in `Content-Range`).
82
+ - **The HTTPS interface has no directory listings at all** — hence the
83
+ Transfer API for metadata.
84
+
85
+ ## Known ALCF collections
86
+
87
+ Resolved via `endpoint_search`; ALCF's docs list names, not UUIDs.
88
+
89
+ | Collection | UUID | Type |
90
+ |---|---|---|
91
+ | `alcf#dtn_eagle` | `05d2c76a-e867-4f67-aa57-76edeb0beda0` | mapped |
92
+ | `alcf#dtn_flare` | `f39a7a0f-5bfc-46ce-9615-ba9f8592814f` | mapped |
93
+ | `alcf#dtn_grand` | `3caddd4a-bb35-4c3d-9101-d9a0ad7f3a30` | mapped |
94
+ | Globus Tutorials on ALCF Eagle | `a6f165fa-aee2-4fe5-95f3-97429c28bf82` | guest, public |
95
+
96
+ Eagle's collection root is already `/eagle/projects`, so paths are
97
+ project-relative: `fs.ls("/datascience")`, not `/eagle/projects/datascience`.
98
+
99
+ Expect roughly **2 s per metadata or read operation** through the DTN —
100
+ fine for sparse reads and exploration, not for per-record access in a
101
+ training loop. See the note on training workloads below.
102
+
103
+ ## Credentials
104
+
105
+ Token acquisition is pluggable, because it varies more than anything
106
+ else: a public collection needs nothing, a portal already has a token,
107
+ an interactive user needs a browser.
108
+
109
+ | Provider | Use |
110
+ |---|---|
111
+ | `AnonymousCredentials` | Public collections (default) |
112
+ | `StaticToken` | A token you already hold |
113
+ | `CallableToken` | Fetch on demand — the pickle-safe option |
114
+ | `AppCredentials` | Wraps `globus_sdk` `UserApp`/`ClientApp` |
115
+
116
+ Two constraints worth knowing, both from the globus-sdk docs:
117
+
118
+ - **`GlobusApp` is not thread-safe**, but fsspec shares one filesystem
119
+ across threads. `AppCredentials` serializes every call through a lock.
120
+ - **fsspec pickles filesystems to worker processes.** A live token in the
121
+ constructor args would be copied into every worker payload, so
122
+ `StaticToken` refuses to pickle; use `CallableToken` reading from the
123
+ environment or shared storage so workers re-read rather than receive.
124
+
125
+ Also set `request_refresh_tokens=True` — it defaults to `False`, and
126
+ without it a long run dies when the access token expires mid-epoch.
127
+
128
+ ## A note on training workloads
129
+
130
+ This is built for *remote and sparse* reads: column projection,
131
+ exploration, data not yet staged. For distributed training, staging with
132
+ Globus Transfer to node-local scratch beats per-record HTTPS on every
133
+ axis — no per-record latency, no token expiry mid-epoch, and it works
134
+ with formats like ArrayRecord whose readers do their own seeking.
135
+
136
+ ## Tests
137
+
138
+ Characterization tests hit a real public collection and are marked
139
+ `network`:
140
+
141
+ ```bash
142
+ pytest # everything
143
+ pytest -m "not network" # offline only
144
+ ```
145
+
146
+ ## License
147
+
148
+ MIT
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "globusfs"
7
+ version = "0.1.0"
8
+ description = "fsspec filesystem for Globus collections"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "Sam Foreman", email = "saforem2@gmail.com" }]
13
+ keywords = ["globus", "fsspec", "filesystem", "hpc", "data"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Science/Research",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: System :: Filesystems",
19
+ ]
20
+ dependencies = [
21
+ # HTTPFileSystem (the ranged-read path we subclass) lives in fsspec but
22
+ # needs aiohttp, which fsspec does not pull in on its own.
23
+ "fsspec>=2023.1",
24
+ "aiohttp",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/saforem2/globusfs"
29
+ Source = "https://github.com/saforem2/globusfs"
30
+ Issues = "https://github.com/saforem2/globusfs/issues"
31
+
32
+ [project.optional-dependencies]
33
+ # Only needed for Transfer-API listing and GlobusApp-backed credentials.
34
+ # Anonymous reads work without it, which is what keeps the test fixture
35
+ # usable in CI with no secrets.
36
+ auth = ["globus-sdk>=3.30"]
37
+ dev = ["pytest", "pytest-asyncio", "ruff>=0.14", "requests"]
38
+
39
+ # fsspec discovers backends through this entry point group, so
40
+ # `fsspec.open("globus://...")` works after a plain install with no
41
+ # explicit register_implementation() call by the user.
42
+ [project.entry-points."fsspec.specs"]
43
+ globus = "globusfs:GlobusFileSystem"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/globusfs"]
47
+
48
+ [tool.pytest.ini_options]
49
+ markers = [
50
+ "network: hits the public ISAAC collection; deselect with -m 'not network'",
51
+ ]
@@ -0,0 +1,29 @@
1
+ """fsspec filesystem for Globus collections."""
2
+
3
+ from .core import GlobusFileSystem
4
+ from .credentials import (
5
+ AnonymousCredentials,
6
+ AppCredentials,
7
+ CallableToken,
8
+ GlobusCredentials,
9
+ StaticToken,
10
+ )
11
+ from .errors import GlobusFSError, TransientBackendError
12
+ from .login import filesystem, login
13
+ from .transfer import TransferMetadata
14
+
15
+ __version__ = "0.1.0"
16
+
17
+ __all__ = [
18
+ "AnonymousCredentials",
19
+ "AppCredentials",
20
+ "CallableToken",
21
+ "GlobusCredentials",
22
+ "GlobusFSError",
23
+ "GlobusFileSystem",
24
+ "StaticToken",
25
+ "TransferMetadata",
26
+ "TransientBackendError",
27
+ "filesystem",
28
+ "login",
29
+ ]