From 61e4cb294ae9c829b8d8284c4b897e6c8921c7a8 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Tue, 16 Dec 2025 14:07:03 -0500 Subject: [PATCH 01/19] Add GHA config --- .github/workflows/tests.yaml | 3 +++ README.md | 3 ++- gdrive_fsspec/core.py | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 55b2dfe..d05b8a9 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,6 +42,9 @@ jobs: - name: run tests timeout-minutes: 15 run: pytest -vv + env: + gdrive_fsspec_CREDENTIALS_PATH: "${{ secrets.GDRIVE_SERVICE_ACCOUNT }}" + gdrive_fsspec_DRIVE: gdrivefs-testing pytest lint: name: lint diff --git a/README.md b/README.md index 628667e..b882fbb 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,8 @@ See ``GoogleDriveFileSystem`` docstring for more details. ### Running tests The tests require defining the following environment variables: -- gdrive_fsspec_CREDENTIALS_PATH: location of a credentials.json +- gdrive_fsspec_CREDENTIALS_PATH: location of a credentials.json or the json blob itself + (starting with "{") - gdrive_fsspec_CREDENTIALS_TYPE: token type ("service_account" default) - gdrive_fsspec_DRIVE: shared drive to use. diff --git a/gdrive_fsspec/core.py b/gdrive_fsspec/core.py index b31e951..09d3e77 100644 --- a/gdrive_fsspec/core.py +++ b/gdrive_fsspec/core.py @@ -154,7 +154,10 @@ def _connect_cache(self): def _connect_service_account(self): if isinstance(self.creds, str): - creds = json.load(open(self.creds)) + if self.creds[0] != "{": + creds = json.load(open(self.creds)) + else: + creds = json.loads(self.creds) else: creds = self.creds return service_account.Credentials.from_service_account_info( From 4e3f7963a7d4a8d26585dc1871b9da59140b96d2 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Tue, 16 Dec 2025 14:09:45 -0500 Subject: [PATCH 02/19] alt --- .github/workflows/tests.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d05b8a9..3c8b5cb 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,10 +41,7 @@ jobs: - name: run tests timeout-minutes: 15 - run: pytest -vv - env: - gdrive_fsspec_CREDENTIALS_PATH: "${{ secrets.GDRIVE_SERVICE_ACCOUNT }}" - gdrive_fsspec_DRIVE: gdrivefs-testing pytest + run: "gdrive_fsspec_CREDENTIALS_PATH=${{ secrets.GDRIVE_SERVICE_ACCOUNT }} gdrive_fsspec_DRIVE=gdrivefs-testing pytest -vv" lint: name: lint From 90ceb50cddd576c9f3d14b870debf9738bc915ee Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Tue, 16 Dec 2025 14:16:12 -0500 Subject: [PATCH 03/19] alt2 --- .github/workflows/tests.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3c8b5cb..832fbbe 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,7 +41,12 @@ jobs: - name: run tests timeout-minutes: 15 - run: "gdrive_fsspec_CREDENTIALS_PATH=${{ secrets.GDRIVE_SERVICE_ACCOUNT }} gdrive_fsspec_DRIVE=gdrivefs-testing pytest -vv" + env: + gdrive_fsspec_CREDENTIALS_PATH: ${{ secrets.GDRIVE_SERVICE_ACCOUNT }} + gdrive_fsspec_DRIVE: gdrivefs-testing + run: | + env + pytest -vv" lint: name: lint From 749507bb4fa07bd5bcc6c81cc1fa0c3524142966 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Tue, 16 Dec 2025 14:30:39 -0500 Subject: [PATCH 04/19] with env --- .github/workflows/tests.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 832fbbe..a36a5b2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,6 +17,8 @@ jobs: tests: timeout-minutes: 45 runs-on: ${{ matrix.os }} + environment: env1 + strategy: fail-fast: false matrix: @@ -42,11 +44,8 @@ jobs: - name: run tests timeout-minutes: 15 env: - gdrive_fsspec_CREDENTIALS_PATH: ${{ secrets.GDRIVE_SERVICE_ACCOUNT }} gdrive_fsspec_DRIVE: gdrivefs-testing - run: | - env - pytest -vv" + run: pytest -vv" lint: name: lint From 9f8e3af4e0db4f275fafc96e634c5a668f9cb71b Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Tue, 16 Dec 2025 14:37:23 -0500 Subject: [PATCH 05/19] stray --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a36a5b2..f0798a1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -45,7 +45,7 @@ jobs: timeout-minutes: 15 env: gdrive_fsspec_DRIVE: gdrivefs-testing - run: pytest -vv" + run: pytest -vv lint: name: lint From aac36be6ba76055fd95a58bda14728d871c41d10 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Sat, 20 Dec 2025 13:48:52 -0500 Subject: [PATCH 06/19] debug --- .github/workflows/tests.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f0798a1..ac03177 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -40,12 +40,15 @@ jobs: run: | pip install --upgrade pip wheel pip install -e . pytest + pip list - name: run tests timeout-minutes: 15 env: gdrive_fsspec_DRIVE: gdrivefs-testing - run: pytest -vv + run: | + env + pytest -vv lint: name: lint From 4d5e2ae7719beea15b58318e9c8505025ee604af Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Sat, 20 Dec 2025 13:52:11 -0500 Subject: [PATCH 07/19] add secret --- .github/workflows/tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ac03177..ad600a3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -46,6 +46,7 @@ jobs: timeout-minutes: 15 env: gdrive_fsspec_DRIVE: gdrivefs-testing + GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} run: | env pytest -vv From 66d304c7d5cec0b29612a085bce281ad496e8a48 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Sat, 20 Dec 2025 14:12:26 -0500 Subject: [PATCH 08/19] match --- .github/workflows/tests.yaml | 2 +- gdrive_fsspec/core.py | 2 +- gdrive_fsspec/tests/test_core.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ad600a3..72d06e8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -45,7 +45,7 @@ jobs: - name: run tests timeout-minutes: 15 env: - gdrive_fsspec_DRIVE: gdrivefs-testing + GDRIVE_FSSPEC_DRIVE: gdrivefs-testing GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} run: | env diff --git a/gdrive_fsspec/core.py b/gdrive_fsspec/core.py index 09d3e77..564769b 100644 --- a/gdrive_fsspec/core.py +++ b/gdrive_fsspec/core.py @@ -215,7 +215,7 @@ def rm_file(self, path, file_id=None): listing = self.dircache[par] i = [i for i, li in enumerate(listing) if li["name"] == path][0] listing.pop(i) - self.dircache.pop(path) + self.dircache.pop(path, None) def rm(self, path, recursive=True, maxdepth=None): if recursive is False and self.isdir(path) and self.ls(path): diff --git a/gdrive_fsspec/tests/test_core.py b/gdrive_fsspec/tests/test_core.py index 8fd112d..50fee52 100644 --- a/gdrive_fsspec/tests/test_core.py +++ b/gdrive_fsspec/tests/test_core.py @@ -7,9 +7,9 @@ testdir = "gdrive_fsspec_testdir" kwargs = { - "creds": os.getenv("gdrive_fsspec_CREDENTIALS_PATH"), - "token": os.getenv("gdrive_fsspec_CREDENTIALS_TYPE", "service_account"), - "drive": os.getenv("gdrive_fsspec_DRIVE"), + "creds": os.getenv("GDRIVE_FSSPEC_CREDENTIALS_PATH"), + "token": os.getenv("GDRIVE_FSSPEC_CREDENTIALS_TYPE", "service_account"), + "drive": os.getenv("GDRIVE_FSSPEC_DRIVE"), } From 456062e4381f88a38046b36e035b5f2dda4008bd Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 09:39:34 -0500 Subject: [PATCH 09/19] try without en afetr all --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 72d06e8..2966757 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,7 +17,7 @@ jobs: tests: timeout-minutes: 45 runs-on: ${{ matrix.os }} - environment: env1 + #environment: env1 strategy: fail-fast: false From 0766f412a7219abae62aa38b8b4186dbcb59f402 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 09:41:19 -0500 Subject: [PATCH 10/19] only env --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 2966757..72d06e8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,7 +17,7 @@ jobs: tests: timeout-minutes: 45 runs-on: ${{ matrix.os }} - #environment: env1 + environment: env1 strategy: fail-fast: false From cfe800429446fb9b98b44c28dadf2446f87ad767 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:18:08 -0500 Subject: [PATCH 11/19] debug --- .github/workflows/tests.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 72d06e8..a3f8178 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,6 +14,18 @@ permissions: contents: read jobs: + one: + environment: env1 + steps: + - name: Set up Python + uses: actions/setup-python@v4 + - name: oi + env: + GDRIVE_FSSPEC_DRIVE: gdrivefs-testing + GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} + run: | + python -c 'import os;print({k: len(v) for k, v in os.environ.items()})' + tests: timeout-minutes: 45 runs-on: ${{ matrix.os }} From a3dd87cc1d0276994a920ba22471058d07e6cbe8 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:21:08 -0500 Subject: [PATCH 12/19] add --- .github/workflows/tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a3f8178..23d7ee8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -16,6 +16,7 @@ permissions: jobs: one: environment: env1 + runs-on: "ubuntu-latest" steps: - name: Set up Python uses: actions/setup-python@v4 From ffafada4d8b125b621afa481ce9ba155d86ef34f Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:25:48 -0500 Subject: [PATCH 13/19] conf --- .github/workflows/tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 23d7ee8..6576b10 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -30,7 +30,8 @@ jobs: tests: timeout-minutes: 45 runs-on: ${{ matrix.os }} - environment: env1 + environment: + name: env1 strategy: fail-fast: false From 994f6c6125836fe6f1184b78169ba46907c44e47 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:28:01 -0500 Subject: [PATCH 14/19] change name --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6576b10..5992e3e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -23,7 +23,7 @@ jobs: - name: oi env: GDRIVE_FSSPEC_DRIVE: gdrivefs-testing - GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} + GDRIVE_FSSPEC_CREDENTIALS: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} run: | python -c 'import os;print({k: len(v) for k, v in os.environ.items()})' From 5011796f75775900f6a2c8f42e608dc561cd0be8 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:35:32 -0500 Subject: [PATCH 15/19] other --- .github/workflows/tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5992e3e..ae5d0d1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,7 +15,8 @@ permissions: jobs: one: - environment: env1 + environment: + name: env1 runs-on: "ubuntu-latest" steps: - name: Set up Python From e71dbdd1e706a1d8227bfa36d23a0a07062d7c05 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:38:03 -0500 Subject: [PATCH 16/19] another --- .github/workflows/tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ae5d0d1..390c4e0 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -25,6 +25,7 @@ jobs: env: GDRIVE_FSSPEC_DRIVE: gdrivefs-testing GDRIVE_FSSPEC_CREDENTIALS: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} + ANOTHER: ${{ secrets.other }} run: | python -c 'import os;print({k: len(v) for k, v in os.environ.items()})' From 6fb2e1a346dc786ef4ca5aea1e4667efabb1880f Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:41:05 -0500 Subject: [PATCH 17/19] remove --- .github/workflows/tests.yaml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 390c4e0..ac2a086 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,21 +14,6 @@ permissions: contents: read jobs: - one: - environment: - name: env1 - runs-on: "ubuntu-latest" - steps: - - name: Set up Python - uses: actions/setup-python@v4 - - name: oi - env: - GDRIVE_FSSPEC_DRIVE: gdrivefs-testing - GDRIVE_FSSPEC_CREDENTIALS: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} - ANOTHER: ${{ secrets.other }} - run: | - python -c 'import os;print({k: len(v) for k, v in os.environ.items()})' - tests: timeout-minutes: 45 runs-on: ${{ matrix.os }} @@ -63,9 +48,7 @@ jobs: env: GDRIVE_FSSPEC_DRIVE: gdrivefs-testing GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }} - run: | - env - pytest -vv + run: pytest -vv lint: name: lint From 114c0dd0baa92d6c24e4cefc1f0531a2cf8b405b Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 11:47:53 -0500 Subject: [PATCH 18/19] no concurrent --- .github/workflows/tests.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ac2a086..136ff5b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -19,6 +19,9 @@ jobs: runs-on: ${{ matrix.os }} environment: name: env1 + concurrency: + group: run_one + cancel-in-progress: true strategy: fail-fast: false From 3e9bbaef6ba11279e1d1f931f6cbccf5d16c261c Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 26 Dec 2025 15:09:17 -0500 Subject: [PATCH 19/19] just one --- .github/workflows/tests.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 136ff5b..aead1d2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -19,15 +19,12 @@ jobs: runs-on: ${{ matrix.os }} environment: name: env1 - concurrency: - group: run_one - cancel-in-progress: true strategy: fail-fast: false matrix: os: [ubuntu-latest] - pyv: ["3.10", "3.11", "3.12", "3.13", "3.14"] + pyv: ["3.13"] steps: - uses: actions/checkout@v3