Skip to main content

vercel-drives

Python SDK for Vercel Drives: named persistent filesystems that belong to one project and one region, and mount into sandboxes created with vercel-sandbox.

pip install vercel-drives

Manage Drives

import asyncio

from vercel import drives


async def main() -> None:
    cache, created = await drives.get_or_create_drive(
        name="cache",
        region="sfo1",
        max_size_bytes=10 * 1024**3,
    )
    print(cache.id, cache.region, created)

    # Look up an existing Drive by project-local name or Drive ID.
    cache = await drives.get_drive(name_or_id="cache")

    async for item in drives.query_drives(query=drives.DriveQueryByName(name_prefix="cache")):
        print(item.name, item.max_size_bytes)

    await cache.delete()


asyncio.run(main())

get_or_create_drive omits region by default, leaving placement to the API. Pass CURRENT_REGION to use the current Vercel Function's region.

A missing Drive raises DriveApiError with status_code == 404. A Drive must be unmounted before it can be deleted.

Fork a Drive

A fork copies a Drive's committed data into an independent Drive, inheriting its region and maximum size.

import asyncio

from vercel import drives


async def main() -> None:
    cache = await drives.get_drive(name_or_id="cache")
    forked = await cache.fork(name="cache-fork")
    print(forked.parent_drive_id, forked.root_drive_id)

    # Or fork by name, without a lookup.
    other = await drives.fork_drive(source="cache", name="cache-fork-2")


asyncio.run(main())

Mount a Drive in a sandbox

vercel-sandbox accepts Drive handles, Drive names, and DriveMount values as mounts. A mount is read-write unless it is a snapshot.

import asyncio

from vercel import drives, sandbox


async def main() -> None:
    cache, _ = await drives.get_or_create_drive(name="cache")
    async with sandbox.create_sandbox(
        region=cache.region,
        mounts={
            "/cache": cache,
            # A point-in-time, read-only view of a Drive.
            "/readonly": drives.DriveMount("shared-source", mode="snapshot"),
        },
    ) as box:
        await box.fs.write_text("/cache/message.txt", "hello\n")


asyncio.run(main())

Synchronous API

vercel.drives.sync mirrors every function without await and returns SyncDrive handles.

from vercel.drives import sync as drives

cache, _ = drives.get_or_create_drive(name="cache")
for item in drives.query_drives():
    print(item.name)

Credentials

Requests use the Vercel OIDC token of the deployment, or VERCEL_TOKEN, VERCEL_TEAM_ID, and VERCEL_PROJECT_ID. Locally, vercel env pull provides an OIDC token for a linked project. Drives always belong to the project the credentials resolve to.

To supply credentials yourself, configure the session:

import asyncio

from vercel import drives
from vercel.api import session
from vercel.drives import DriveCredentials, DriveServiceOptions


async def credentials() -> DriveCredentials:
    return DriveCredentials(token="...", team_id="team_...", project_id="prj_...")


async def main() -> None:
    options = DriveServiceOptions(credentials_factory=credentials)
    async with session(service_options=[options]):
        async for item in drives.query_drives():
            print(item.name)


asyncio.run(main())

Metadata

Release files for vercel-drives 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vercel-drives 0.1.0
File Size Uploaded Provenance Actions
vercel_drives-0.1.0.tar.gz 17.5 kB Without provenance Details for vercel_drives-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vercel-drives 0.1.0
File Interpreter ABI Platform Actions
vercel_drives-0.1.0-py3-none-any.whl Python 3 none any Details for vercel_drives-0.1.0-py3-none-any.whl

Total release size: 39.0 kB

Release files / vercel_drives-0.1.0.tar.gz

Download URL vercel_drives-0.1.0.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
189792a58c74e237386759d9536e2aff2635e7de6790a9536c1bca9372e82992
BLAKE2b-256 checksum
How to use checksums
a312c7ba2d5d6fcc69a2a4f7e7d41644bb3b1f9ce336a890a95241c84893fcd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / vercel_drives-0.1.0-py3-none-any.whl

Download URL vercel_drives-0.1.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4971e3c85804ae9e020c59658f96b9a2cc47253634a0f6a2f4957a64460302f0
BLAKE2b-256 checksum
How to use checksums
7c37752f901747d8c9781489c80c960b6e42a943e46b8c7b650f3b7105329654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for vercel-drives 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page