or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

api-communication.mdcoverage-processing.mdindex.mdmain-workflow.mdrepository-integration.md
tile.json

tessl/pypi-python-coveralls

Python interface to coveralls.io API for uploading code coverage results

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/python-coveralls@2.9.x

To install, run

npx @tessl/cli install tessl/pypi-python-coveralls@2.9.0

index.mddocs/

Python Coveralls

A Python interface to the coveralls.io API for uploading code coverage results from Python projects. The library handles authentication, processes coverage data files, extracts git repository information, and uploads formatted coverage reports to coveralls.io with support for various coverage tools and CI services.

Package Information

  • Package Name: python-coveralls
  • Language: Python
  • Installation: pip install python-coveralls

Core Imports

import coveralls

For programmatic usage:

from coveralls import api, control, repository
from coveralls.control import coveralls
from coveralls.api import post, build_file
from coveralls.repository import repo

Basic Usage

Command-Line Usage

The simplest way to upload coverage results after running your test suite:

# Run your tests with coverage
python -m pytest --cov=mypackage

# Upload to coveralls.io
coveralls

Programmatic Usage

import coveralls

# Upload coverage using the main workflow function
exit_code = coveralls.wear()

# Or with custom arguments
args = coveralls.parse_args()
args.base_dir = '/path/to/project'
args.repo_token = 'your_repo_token'
exit_code = coveralls.wear(args)

Architecture

The package is organized into distinct functional modules:

  • Main Module (coveralls): Entry point with command-line interface and main workflow coordination
  • Control Module (coveralls.control): Coverage data processing and integration with coverage.py
  • Report Module (coveralls.report): Coverage report generation in coveralls.io format
  • API Module (coveralls.api): HTTP communication with coveralls.io API
  • Repository Module (coveralls.repository): Git and Mercurial repository information extraction

Capabilities

Main Workflow and CLI

Primary entry point providing command-line interface and orchestrating the complete coverage upload workflow from data collection to API submission.

def wear(args=None): ...
def parse_args(): ...

Main Workflow

Coverage Processing

Extended coverage functionality that integrates with coverage.py to generate coveralls-specific reports with line-by-line coverage data and source file information.

class coveralls(Coverage):
    def coveralls(base_dir, ignore_errors=False, merge_file=None): ...

class CoverallsReporter(Reporter):
    def report(base_dir, ignore_errors=False, merge_file=None): ...

Coverage Processing

API Communication

HTTP interface for communicating with the coveralls.io API, handling authentication, request formatting, and response processing.

def post(url, repo_token, service_job_id, service_name, git, source_files, parallel, skip_ssl_verify=False): ...
def build_file(repo_token, service_job_id, service_name, git, source_files, parallel): ...

API Communication

Repository Integration

Version control system integration for extracting git and mercurial repository information including commit details, branch information, and remote URLs.

def repo(root): ...
def gitrepo(root): ...
def hgrepo(root): ...

Repository Integration

Configuration

Environment Variables

# Authentication
COVERALLS_REPO_TOKEN: str  # Repository token for authentication

# CI Service Integration  
COVERALLS_SERVICE_NAME: str  # CI service name (default: 'travis-ci')
COVERALLS_PARALLEL: bool    # Enable parallel builds
TRAVIS_JOB_ID: str         # Travis CI job identifier
TRAVIS_BRANCH: str         # Git branch from Travis CI
CIRCLE_BRANCH: str         # Git branch from Circle CI

Configuration Files

The package supports YAML configuration files and coverage.py configuration:

# .coveralls.yml
repo_token: "your_repo_token"
service_name: "travis-ci"
parallel: true

Types

class Arguments:
    """Parsed command-line arguments and configuration."""
    coveralls_url: str
    base_dir: str
    data_file: str | None
    config_file: str | None
    coveralls_yaml: str
    ignore_errors: bool
    merge_file: str | None
    nogit: bool
    skip_ssl_verify: bool
    repo_token: str
    service_name: str
    service_job_id: str
    parallel: bool

class GitInfo:
    """Git repository information."""
    head: dict[str, str]  # commit info (id, author_name, author_email, etc.)
    branch: str
    remotes: list[dict[str, str]]  # remote info (name, url)

class SourceFile:
    """Coverage information for a single source file."""
    name: str               # relative file path
    source: str             # file content
    coverage: list[int | None]  # line-by-line coverage (None=non-executable, 0=missed, 1=hit)