Skip to main content

Python package wrapper for Vercel CLI

CI codecov Supported Python Versions

vercel-cli packages the npm vercel CLI for Python environments. It vendors the npm package under vercel_cli/vendor/ and uses the bundled Node.js runtime provided by nodejs-wheel-binaries, so you can run vercel without installing Node.js.

It provides both a command-line interface and a Python API that other libraries can use programmatically instead of resorting to subprocess calls.

Quick start

  • Install:
pip install vercel-cli
  • Use (same arguments and behavior as the official npm CLI):
vercel --version
vercel login
vercel deploy
  • Use programmatically in Python (for libraries that depend on this package):
from vercel_cli import run_vercel

# Deploy current directory
exit_code = run_vercel(["deploy"])

# Deploy specific directory with custom environment
exit_code = run_vercel(
    ["deploy", "--prod"],
    cwd="/path/to/project",
    env={"VERCEL_TOKEN": "my-token"}
)

# Check version
exit_code = run_vercel(["--version"])

What this provides

  • No system Node.js required: The CLI runs via the Node binary from nodejs-wheel-binaries (currently Node 22.x).
  • Vendored npm package: The vercel npm package (production deps only) is checked into vercel_cli/vendor/.
  • Console entrypoint: The vercel command maps to vercel_cli.run:main, which executes vercel_cli/vendor/dist/vc.js with the bundled Node runtime.
  • Python API: The run_vercel() function allows other Python libraries to use Vercel CLI programmatically without subprocess calls, with secure environment variable handling.

Requirements

  • Python 3.8+
  • macOS, Linux, or Windows supported by the Node wheels

How it works

At runtime, vercel_cli.run locates vercel_cli/vendor/dist/vc.js and launches it via the Node executable exposed by nodejs_wheel_binaries. CLI arguments are passed through unchanged, while environment variables are handled securely.

Programmatic usage

When using this package as a dependency in other Python libraries, you can call Vercel CLI commands directly without using subprocess:

from vercel_cli import run_vercel
import tempfile
import os

def deploy_my_app(source_dir: str, token: str) -> bool:
    """Deploy an application to Vercel programmatically."""
    with tempfile.TemporaryDirectory() as temp_dir:
        # Copy your app to temp directory and modify as needed
        # ...

        # Deploy with custom environment
        env = {
            "VERCEL_TOKEN": token,
            "NODE_ENV": "production"
        }

        exit_code = run_vercel(
            ["deploy", "--prod", "--yes"],
            cwd=temp_dir,
            env=env
        )

        return exit_code == 0

# Usage
success = deploy_my_app("./my-app", "my-vercel-token")

The run_vercel() function accepts:

  • args: List of CLI arguments (same as command line)
  • cwd: Working directory for the command
  • env: Environment variables to set (passed directly to the Node.js runtime)

Security considerations

When using the env parameter, only explicitly provided environment variables are passed to the Vercel CLI. This prevents accidental leakage of sensitive environment variables from your Python process while still allowing you to set necessary variables like VERCEL_TOKEN.

Example with secure token handling:

from vercel_cli import run_vercel

# Secure: only VERCEL_TOKEN is passed to the CLI
exit_code = run_vercel(
    ["deploy", "--prod"],
    env={"VERCEL_TOKEN": "your-secure-token"}
)

This approach avoids common security pitfalls of subprocess environment variable handling.

Updating the vendored Vercel CLI (maintainers)

There are two ways to update the vendored npm package under vercel_cli/vendor/:

  1. Manual update to a specific version
# Using the console script defined in pyproject.toml
uv run update-vendor 46.0.2
# or equivalently
uv run python scripts/update_vendor.py 46.0.2

This will:

  • fetch vercel@46.0.2 from npm,
  • verify integrity/shasum,
  • install production dependencies with npm install --omit=dev, and
  • copy the result into vercel_cli/vendor/.
  1. Automatic check-and-release (GitHub Actions)

The workflow .github/workflows/release.yml checks npm latest and, if newer than the vendored version, will:

  • vendor the new version using scripts/check_and_update.py,
  • commit the changes and create a tag v<version>,
  • build distributions, and
  • publish to PyPI (requires PYPI_API_TOKEN).

Versioning

The Python package version is derived dynamically from the vendored package.json via Hatch’s version source:

[tool.hatch.version]
path = "vercel_cli/vendor/package.json"
pattern = '"version"\s*:\s*"(?P<version>[^\\"]+)"'

Development

  • Build backend: hatchling
  • Dependency management: uv (see uv.lock)
  • Tests: pytest with coverage in tests/
  • Lint/format: ruff; type-check: basedpyright

Common commands (using uv):

# Run tests with coverage
uv run pytest --cov=vercel_cli --cov-report=term-missing

# Lint and format
uv run ruff check .
uv run ruff format .

# Type-check
uv run basedpyright

# Build wheel and sdist
uv run --with build python -m build

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vercel_cli-59.0.0.tar.gz (36.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vercel_cli-59.0.0-py3-none-any.whl (36.8 MB view details)

Uploaded Python 3

File details

Details for the file vercel_cli-59.0.0.tar.gz.

File metadata

  • Download URL: vercel_cli-59.0.0.tar.gz
  • Upload date:
  • Size: 36.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for vercel_cli-59.0.0.tar.gz
Algorithm Hash digest
SHA256 08ce78c79899fa55cd975a8e37d7b75bea19e79a6e96adba1dd8bfb0d8fd2c51
MD5 829e3efa257ec2bd83894a04202e1481
BLAKE2b-256 901858b477efe3d5d1c75f30411c7632195f0d9bb5fcad167a93a6dbb1fe135a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vercel_cli-59.0.0.tar.gz:

Publisher: release.yml on nuage-studio/vercel-cli-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vercel_cli-59.0.0-py3-none-any.whl.

File metadata

  • Download URL: vercel_cli-59.0.0-py3-none-any.whl
  • Upload date:
  • Size: 36.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for vercel_cli-59.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5d3caf1c7861a1f88174bad8a96e0823b200fed1d8e9c22a1c917f48a9eecb6
MD5 1b8cac9ae375daebb96bc49d5eb1be61
BLAKE2b-256 0bb58437741029cebea036887027d260403b6268f698f83ee90d24fd7eb4cead

See more details on using hashes here.

Provenance

The following attestation bundles were made for vercel_cli-59.0.0-py3-none-any.whl:

Publisher: release.yml on nuage-studio/vercel-cli-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

59.7.0

2 files

59.5.0

2 files

59.3.0

2 files

59.1.4

2 files

59.1.3

2 files

This release

59.0.0 This release

2 files

58.10.0

2 files

58.9.4

2 files

58.9.1

2 files

58.9.0

2 files

58.8.0

2 files

58.7.1

2 files

58.5.1

2 files

58.4.4

2 files

58.4.0

2 files

58.1.0

2 files

58.0.0

2 files

57.0.0

2 files

56.5.0

2 files

56.4.1

2 files

56.3.2

2 files

56.3.1

2 files

56.2.1

2 files

56.2.0

2 files

56.1.0

2 files

55.0.0

2 files

54.21.1

2 files

54.21.0

2 files

54.20.1

2 files

54.20.0

2 files

54.18.7

2 files

54.18.6

2 files

54.18.5

2 files

54.18.2

2 files

54.18.1

2 files

54.18.0

2 files

54.17.3

2 files

54.17.0

2 files

54.15.1

2 files

54.15.0

2 files

54.14.5

2 files

54.14.2

2 files

54.14.0

2 files

54.13.0

2 files

54.12.2

2 files

54.11.1

2 files

54.10.3

2 files

54.10.2

2 files

54.9.1

2 files

54.9.0

2 files

54.7.1

2 files

54.6.1

2 files

54.5.1

2 files

54.5.0

2 files

54.4.1

2 files

54.3.0

2 files

54.2.0

2 files

54.1.0

2 files

54.0.0

2 files

53.4.0

2 files

53.3.2

2 files

53.3.1

2 files

53.2.0

2 files

53.1.1

2 files

53.1.0

2 files

53.0.1

2 files

52.2.0

2 files

52.0.0

2 files

51.8.0

2 files

51.7.0

2 files

51.6.1

2 files

51.4.0

2 files

51.2.1

2 files

51.2.0

2 files

50.44.0

2 files

50.43.0

2 files

50.42.0

2 files

50.41.0

2 files

50.40.0

2 files

50.39.0

2 files

50.38.3

2 files

50.38.2

2 files

50.37.3

2 files

50.37.1

2 files

50.37.0

2 files

50.35.0

2 files

50.34.3

2 files

50.34.2

2 files

50.33.1

2 files

50.33.0

2 files

50.32.5

2 files

50.32.3

2 files

50.31.1

2 files

50.29.0

2 files

50.28.0

2 files

50.27.1

2 files

50.26.0

2 files

50.25.6

2 files

50.25.4

2 files

50.25.3

2 files

50.25.1

2 files

50.23.2

2 files

50.22.1

2 files

50.22.0

2 files

50.19.1

2 files

50.18.2

2 files

50.18.0

2 files

50.17.1

2 files

50.16.0

2 files

50.15.1

2 files

50.15.0

2 files

50.14.0

2 files

50.13.2

2 files

50.13.1

2 files

50.12.3

2 files

50.11.0

2 files

50.10.0

2 files

50.9.6

2 files

50.9.5

2 files

50.9.1

2 files

50.8.0

2 files

50.6.0

2 files

50.5.0

2 files

50.4.9

2 files

50.4.8

2 files

50.4.6

2 files

50.4.5

2 files

50.4.4

2 files

50.4.0

2 files

50.3.2

2 files

50.3.0

2 files

50.1.6

2 files

50.1.4

2 files

50.1.3

2 files

50.1.2

2 files

50.1.0

2 files

50.0.1

2 files

50.0.0

2 files

49.2.0

2 files

49.1.2

2 files

49.1.1

2 files

49.1.0

2 files

48.12.1

2 files

48.12.0

2 files

48.11.0

2 files

48.10.14

2 files

48.10.11

2 files

48.10.10

2 files

48.10.6

2 files

48.10.4

2 files

48.10.3

2 files

48.10.2

2 files

48.10.0

2 files

48.9.1

2 files

48.9.0

2 files

48.8.2

2 files

48.8.0

2 files

48.7.1

2 files

48.6.7

2 files

48.6.6

2 files

48.6.0

2 files

48.5.0

2 files

48.4.1

2 files

48.4.0

2 files

48.3.0

2 files

48.2.9

2 files

48.2.6

2 files

48.2.2

2 files

48.2.0

2 files

48.1.6

2 files

48.1.4

2 files

48.1.1

2 files

48.1.0

2 files

48.0.3

2 files

48.0.2

2 files

48.0.1

2 files

48.0.0

2 files

47.1.4

2 files

47.1.3

2 files

47.0.7

2 files

47.0.5

2 files

47.0.4

2 files

47.0.1

2 files

46.1.1

2 files

46.1.0

2 files

41.1.0

2 files

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