Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6ce9ea9
Switch to uv for dependency management.
Light2Dark Jun 18, 2026
4dc94bd
Rework CI with uv setup and split jobs.
Light2Dark Jun 18, 2026
7b423a2
Bump pre-commit hook versions.
Light2Dark Jun 18, 2026
e5508e9
move checkout back to workflow
Light2Dark Jun 18, 2026
606de4a
remove uv lock
Light2Dark Jun 20, 2026
05a9972
add uv.lock to gitignore
Light2Dark Jun 20, 2026
56bbae3
move to src layout
Light2Dark Jun 22, 2026
85f94ed
update readme
Light2Dark Jun 24, 2026
d24bb61
update note
Light2Dark Jun 24, 2026
0fc17a5
fix link
Light2Dark Jun 24, 2026
3292e55
add pyrefly typechecker
Light2Dark Jun 26, 2026
dd10432
set venv on path for pre-commit
Light2Dark Jun 26, 2026
f53415f
add comment
Light2Dark Jun 26, 2026
0048b36
Merge pull request #2 from Light2Dark/sham/upgrade-repo-v2
Light2Dark Jun 26, 2026
4a6883e
add logo, docs
Light2Dark Jun 27, 2026
6b57392
Merge pull request #4 from Light2Dark/sham/update-readme-contributing
Light2Dark Jun 27, 2026
6a050bf
update links, remove text
Light2Dark Jun 27, 2026
7846d04
Merge pull request #5 from Light2Dark/sham/docs-addition
Light2Dark Jun 27, 2026
601e107
add pytest-cov
Light2Dark Jun 27, 2026
f749f52
Merge pull request #6 from Light2Dark/sham/add-test-coverage
Light2Dark Jun 27, 2026
5a7c984
check root id is valid
Light2Dark Jun 27, 2026
4bf33d8
validate root_file_id is a folder
Light2Dark Jun 27, 2026
6e169ec
test: add root_file_id integration tests and FS factory fixture
Light2Dark Jun 27, 2026
dbd70b0
Merge pull request #7 from Light2Dark/sham/validate-root-id
Light2Dark Jun 28, 2026
f64def3
validate drive/root consistency and accept drive id or name
Light2Dark Jun 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup
description: Install uv and sync the project environment

inputs:
python-version:
description: Python version for uv to install (defaults to uv's own default)
required: false
default: ""

runs:
using: composite
steps:
- name: Install latest uv
uses: astral-sh/setup-uv@v8.2.0
with:
python-version: ${{ inputs.python-version }}
enable-cache: true

- name: Install dependencies
shell: bash
run: uv sync --all-groups
116 changes: 116 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CI

on:
push:
branches: [master]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: ./.github/actions/setup

# pyrefly-check uses language: system and expects pyrefly on PATH.
- name: Run pre-commit
run: PATH="$PWD/.venv/bin:$PATH" uvx pre-commit run --all-files

typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: ./.github/actions/setup
with:
python-version: "3.13"

- name: Run pyrefly
run: uv run pyrefly check --output-format=github

test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}

- name: Run unit tests
run: uv run pytest -v

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false

- uses: ./.github/actions/setup
with:
python-version: "3.13"

- name: Run tests with coverage
run: |
uv run pytest \
--cov=gdrive_fsspec \
--cov-report=term-missing \
--cov-report=xml

integration:
name: Integration tests
runs-on: ubuntu-latest
# Run only when Drive credentials are available: manual dispatch, pushes to
# master, or PRs from this repo (fork PRs are skipped — they cannot use secrets).
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository)
timeout-minutes: 15
environment:
name: env1

steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false

- uses: ./.github/actions/setup
with:
python-version: "3.13"

- name: Run integration tests
env:
GDRIVE_FSSPEC_DRIVE: gdrivefs-testing
GDRIVE_FSSPEC_CREDENTIALS_PATH: ${{ secrets.GDRIVE_FSSPEC_CREDENTIALS_PATH }}
run: uv run pytest -v -m integration
62 changes: 0 additions & 62 deletions .github/workflows/tests.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ celerybeat-schedule
.venv
venv/
ENV/
uv.lock
.idea/

# Spyder project settings
Expand All @@ -105,5 +106,5 @@ ENV/
# mypy
.mypy_cache/

/gdrive_fsspec/_version.py
/src/gdrive_fsspec/_version.py
/tmp/*
17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@ exclude: >
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.2
rev: v0.15.16
hooks:
# Run the linter.
- id: ruff
args: [ --fix, "--show-fixes"]
args: [--fix, --show-fixes]
- id: ruff-format
types_or: [python]
- repo: https://github.com/facebook/pyrefly-pre-commit
rev: 1.1.1 # Note: this is the version of the pre-commit hook, NOT the pyrefly version used for type checking
hooks:
- id: pyrefly-check
name: Pyrefly (type checking)
pass_filenames: false # Recommended to do full repo checks. However, you can change this to `true` to only check changed files
language: system # Use system-installed pyrefly
- repo: https://github.com/codespell-project/codespell
rev: v2.4.0
rev: v2.4.2
hooks:
- id: codespell
85 changes: 85 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Contributing to gdrive-fsspec

Thanks for your interest in contributing! This guide covers local setup, running tests, and the checks CI runs on pull requests.

## Prerequisites

Install `uv` and `pre-commit`:

- [`uv` install docs](https://docs.astral.sh/uv/getting-started/installation/)
- [`pre-commit` install docs](https://pre-commit.com/#install)

## Setup

1. Fork the repository on GitHub, then clone your fork:

```sh
git clone git@github.com:<your-username>/gdrive-fsspec.git
cd gdrive-fsspec
```

2. Create the virtual environment and install dependencies:

```sh
uv sync --all-groups
```

3. Install pre-commit hooks:

```sh
pre-commit install
```

## Running checks locally

CI runs the same checks you can run before pushing:

**Lint** (ruff, codespell, formatting, and more via pre-commit):

```sh
pre-commit run --all-files
```

**Type checking** (pyrefly):

```sh
uv run pyrefly check
```

**Unit tests** (default; no Google Drive credentials needed):

```sh
uv run pytest -v
```

**Coverage** (same unit tests; reports missing lines):

```sh
uv run pytest --cov=gdrive_fsspec --cov-report=term-missing
```

## Integration tests

Integration tests use a real Google Drive account and a directory named `gdrive_fsspec_testdir` on Drive.

```sh
uv run pytest -v -m integration
```

Set these environment variables before running them:

- `GDRIVE_FSSPEC_CREDENTIALS_PATH` — path to a service-account JSON, or the JSON string (starting with `{`). Required when using `service_account` (the default).
- `GDRIVE_FSSPEC_CREDENTIALS_TYPE` — token type (`service_account` default; use `cache` or `browser` for user OAuth).
- `GDRIVE_FSSPEC_DRIVE` — **Shared Drive name**. Required for service-account upload tests.

Service accounts cannot own files in Google Drive and have no storage quota. Uploads must target a [Shared Drive](https://developers.google.com/workspace/drive/api/guides/about-shareddrives) where the service account is a member with at least **Contributor** access. See [Google's storage-limit errors](https://developers.google.com/workspace/drive/api/guides/handle-errors#storage-limit).

For a personal Drive (no Shared Drive), use user OAuth instead: `GDRIVE_FSSPEC_CREDENTIALS_TYPE=cache` after a one-time `browser` login.

To run **all** tests (unit + integration), override the default marker filter:

```sh
uv run pytest -v -m ""
```

> **Note:** Integration tests do not run on PRs from forks, because those workflows cannot use repository secrets. They run on pushes to `master` and same-repo PRs. Google Drive has no good emulator; see [this discussion](https://github.com/fsspec/gdrive-fsspec/issues/23#issuecomment-2030367587).
Loading
Loading