{"id":3437,"library":"coveralls","title":"Coveralls Python","description":"Coveralls Python (coveralls-python) is a Python library that provides seamless integration with coverage.py to send code coverage statistics to Coveralls.io. It supports various Continuous Integration (CI) systems and allows for detailed online reporting of test coverage for Python projects. Currently at version 4.1.0, it is actively maintained with several releases per year to keep up with Python and `coverage.py` updates.","status":"active","version":"4.1.0","language":"python","source_language":"en","source_url":"https://github.com/TheKevJames/coveralls-python","tags":["coverage","testing","ci","code quality","coveralls.io"],"install":[{"cmd":"pip install coveralls","lang":"bash","label":"Basic installation"},{"cmd":"pip install coveralls[yaml]","lang":"bash","label":"For .coveralls.yml configuration"}],"dependencies":[{"reason":"Required for collecting code coverage data.","package":"coverage","optional":false},{"reason":"Required for reading configuration from a .coveralls.yml file.","package":"pyyaml","optional":true},{"reason":"Used for the command-line interface; replaced 'docopt' in 4.1.0.","package":"typer","optional":false}],"imports":[],"quickstart":{"code":"import os\n\n# Simulate running tests with coverage.py\n# In a real scenario, you'd run your tests like:\n# coverage run -m pytest\n# For this example, we assume coverage.py has already generated .coverage data.\n\n# Set the Coveralls repository token (replace with your actual token or use env var)\n# This is often handled automatically in supported CI environments.\n# For local testing or unsupported CIs, ensure COVERALLS_REPO_TOKEN is set.\n# You can find this token on your project's dashboard in coveralls.io.\nos.environ['COVERALLS_REPO_TOKEN'] = os.environ.get('COVERALLS_REPO_TOKEN', 'your_coveralls_repo_token_here')\n\n# Run the coveralls command-line tool\nimport subprocess\ntry:\n    # Typically, you'd run 'coverage run -m pytest' first, then 'coveralls'\n    # For this example, we simulate the submission step after coverage data is assumed to exist.\n    print(\"Attempting to submit coverage to Coveralls.io...\")\n    # The actual command would be: subprocess.run([\"coveralls\"], check=True)\n    # We'll mock the output for a runnable example without actual submission.\n    mock_output = \"Submitting coverage to coveralls.io...\\nCoverage submitted! Job #123.456 https://coveralls.io/jobs/1234567890\"\n    print(mock_output)\n    # For an actual run:\n    # result = subprocess.run([\"coveralls\"], capture_output=True, text=True, check=True)\n    # print(result.stdout)\n    # print(result.stderr)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error submitting coverage: {e.stderr}\")\nexcept FileNotFoundError:\n    print(\"Error: 'coveralls' command not found. Ensure coveralls is installed and in your PATH.\")\n","lang":"python","description":"After installing `coveralls` and collecting coverage data with `coverage.py` (e.g., by running `coverage run -m pytest`), you can submit the results to Coveralls.io. For non-CI environments or unsupported CI systems, ensure the `COVERALLS_REPO_TOKEN` environment variable is set."},"warnings":[{"fix":"Review your `coverage.py` configuration (e.g., `.coveragerc`) for the `ignore_errors` setting and adjust if you relied on the previous error-muting behavior.","message":"In version 4.0.0, the behavior of `config.ignore_errors` changed. When `config.ignore_errors` is Falsey, failures to parse Python files or look up file sources will now interrupt and early exit collection, matching default `coverage.py` behavior. Previously, these errors were manually muted or only reported after collecting multiple failures.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Review all your configuration sources (CI settings, environment variables, `.coveralls.yml`, CLI flags) and ensure they produce the desired outcome under the new precedence rules.","message":"In version 3.0.0, the configuration precedence was reversed. The new order (latest value used) is: CI Config, `COVERALLS_*` env vars, `.coveralls.yml` file, CLI flags. If you have the same fields set in multiple locations, verify your configuration after upgrading.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Consider migrating to an officially maintained Coveralls integration (e.g., GitHub Action) if you encounter issues with newer Python or `coverage.py` versions. Generate Cobertura XML reports with `coverage xml` and submit them via the official tools.","message":"For Python 3.13+ and `coverage.py` v7+, the official Coveralls documentation recommends switching to their GitHub Action, CircleCI Orb, or Universal Coverage Reporter CLI tool, as direct `coveralls-python` integration may have lapsed support for the latest `coverage.py` formats.","severity":"gotcha","affected_versions":"All versions with Python 3.13+ and/or coverage.py v7+"},{"fix":"Always install the latest `coveralls` version. If encountering issues, consult the `coveralls-python` and `coverage.py` release notes for compatibility details and ensure your `coverage.py` version is supported.","message":"The `coveralls` package depends on `coverage.py`. There have been known incompatibilities with specific `coverage.py` versions (e.g., v6.0.0-v6.1.1 were excluded in `coveralls` v3.3.1). Ensure you are using compatible versions of both libraries. `coveralls` v4.0.1 specifically added support for `coverage` v7.5+.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Obtain your repository token from Coveralls.io and set it as an environment variable `COVERALLS_REPO_TOKEN` before running the `coveralls` command. Alternatively, configure it in a `.coveralls.yml` file (requires `coveralls[yaml]`).","message":"The `COVERALLS_REPO_TOKEN` environment variable (or `repo_token` in `.coveralls.yml`) is crucial for submitting coverage data outside of officially supported CI environments like TravisCI or GitHub Actions. Without it, submissions will fail.","severity":"gotcha","affected_versions":"All versions (outside of specific CI environments)"},{"fix":"Add `relative_files = True` to your `coverage.py` configuration file. For `pyproject.toml`, ensure `coverage[toml]` is installed.","message":"To avoid 'not a git repository' errors, particularly in CI environments, ensure `relative_files = True` is configured in your `coverage.py` configuration (e.g., in the `[run]` section of `.coveragerc`, `setup.cfg`, `tox.ini`, or `[tool.coverage.run]` in `pyproject.toml`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to a supported Python version (>=3.10) for `coveralls` 4.x. If you must use older Python versions, pin `coveralls` to a compatible older version.","message":"Python 3.8 and 3.9 support was dropped in `coveralls` v4.0.2. Earlier versions dropped support for Python 3.7 and below, and Python 2.7/3.4.","severity":"deprecated","affected_versions":"<4.0.2 (for Python 3.8/3.9), <3.x (for older Python versions)"}],"env_vars":null,"search_vec":"'4.1.0':47 'activ':50 'allow':33 'ci':30,67 'code':20,68 'continu':28 'coverag':21,40,65 'coverage.py':17,63 'coveral':1,3,6 'coveralls-python':5 'coveralls.io':24,70 'current':44 'detail':35 'integr':15,29 'keep':58 'librari':11 'maintain':51 'onlin':36 'per':55 'project':43 'provid':13 'python':2,4,7,10,42,61 'qualiti':69 'releas':54 'report':37 'seamless':14 'send':19 'sever':53 'statist':22 'support':26 'system':31 'test':39,66 'updat':64 'various':27 'version':46 'year':56","created_at":"2026-04-11T17:29:04.754491+00:00","updated_at":"2026-04-16T03:57:54.585254+00:00","problems":[{"fix":"Ensure the `COVERALLS_REPO_TOKEN` environment variable is correctly set in your CI configuration with the exact token from your Coveralls.io repository settings. For GitHub Actions, confirm `GITHUB_TOKEN` is passed correctly and consider setting `COVERALLS_SERVICE_NAME: github-actions` in your `.coveralls.yml` or as an environment variable.","cause":"This error, often accompanied by 'Couldn't find a repository matching this job,' indicates that the Coveralls API could not link the incoming coverage report to an existing repository, usually due to a missing, incorrect, or expired `COVERALLS_REPO_TOKEN`, or a misconfigured `service_name` in CI environments.","error":"422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs"},{"fix":"Verify that your `coverage.py` report (e.g., `.coverage` file or `lcov.info`) is generated in the expected location relative to your repository's root, and that the paths within the report correctly map to your source files. For GitHub Actions, use the `base-path` input option of the Coveralls GitHub Action to adjust file paths if needed.","cause":"Coveralls reports 0% coverage when it successfully receives a coverage report but cannot locate the referenced source files within your repository, often due to mismatched file paths between the coverage report and the Git tree, or if the `source_files` array in the JSON payload is empty.","error":"My build shows 0%, but I know I have some coverage."},{"fix":"Update `coveralls-python` to its latest version (`pip install --upgrade coveralls`) to ensure compatibility with recent `coverage.py` versions. If the issue persists, consider pinning `coverage.py` to an older, compatible version (e.g., `coverage<6`) or switch to an officially maintained integration that uses standard report formats like Cobertura XML.","cause":"This `ImportError` (or similar errors like `cannot import name 'FnmatchMatcher'` or `TypeError: Reporter() takes no arguments`) typically occurs due to an incompatibility between the installed version of `coveralls-python` and newer, incompatible versions of `coverage.py` (e.g., `coverage.py` v6 or v7+ introduces breaking changes to its internal API).","error":"ImportError: cannot import name 'Reporter' from 'coverage.report'"},{"fix":"Ensure `coveralls` is installed in your current Python environment by running `pip install coveralls`. If you suspect conflicts, uninstall any existing `coveralls` or `python-coveralls` packages (`pip uninstall coveralls python-coveralls`) and then reinstall only `coveralls`.","cause":"This error means that the Python interpreter cannot find the `coveralls.cli` module, indicating that the `coveralls` package is either not installed in the active environment, installed incorrectly, or there's a conflict with an old or different `coveralls` package (e.g., `python-coveralls`).","error":"ModuleNotFoundError: No module named 'coveralls.cli'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"coveralls","cli_version":"4.1.0","type":"library","homepage":"https://coveralls.io","github":"https://github.com/TheKevJames/coveralls-python","docs":"https://coveralls-python.rtfd.io/","changelog":"https://github.com/TheKevJames/coveralls-python/blob/master/CHANGELOG.md","pypi":"https://pypi.org/project/coveralls/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-11","next_check":"2026-07-10","install_tag":null}}