Codecov Python Uploader

2.1.13 · deprecated · verified Sat Apr 11

The `codecov` Python package provides a command-line interface for uploading code coverage reports to the Codecov.io platform. It integrates with various CI/CD services and testing tools to provide hosted coverage analytics for GitHub, Bitbucket, and GitLab repositories. Currently at version 2.1.13, this specific Python uploader is deprecated in favor of a universal Codecov CLI or GitHub Action, and its release cadence is irregular due to past deprecation and re-instatement events.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the typical workflow: first, generate an XML coverage report (e.g., with `pytest-cov`), then use the `codecov` command-line tool to upload the report to Codecov.io. The upload token (`CODECOV_TOKEN`) is usually required for private repositories and should be stored securely as an environment variable in your CI/CD pipeline. For public repositories, Codecov often auto-detects and uploads without an explicit token when run in supported CI environments.

# 1. Install necessary packages
pip install pytest pytest-cov

# 2. Run tests and generate coverage report (e.g., using pytest-cov)
pytest --cov=. --cov-report=xml

# 3. Upload coverage report to Codecov (usually in a CI environment)
# Replace CODECOV_TOKEN with your actual Codecov upload token for private repos
# For public repos, this is often not needed with CI integrations.
# Set CODECOV_TOKEN as an environment variable in your CI setup.
codecov -t "${CODECOV_TOKEN:-}"

view raw JSON →