CI-Info: Continuous Integration Information
ci-info is a Python library that provides information about the current Continuous Integration (CI) environment. It allows developers to detect if code is running on a CI server, identify the specific CI provider (e.g., GitHub Actions, GitLab CI, CircleCI), and check if the current build is for a pull request. The library aims to maintain parity with `watson/ci-info` (a JavaScript equivalent) and is actively developed with a focus on adding new CI provider detections. The latest version is 0.4.0, released in February 2026.
Warnings
- breaking Version 0.3.0 dropped official support for Python 3.5 and 3.6. Users on these Python versions should either remain on `ci-info` version `0.2.x` or upgrade their Python interpreter to 3.7 or newer.
- gotcha The exact string value returned by `ci_info.name()` is not guaranteed to be constant across versions for a specific CI vendor. It is primarily for display and general identification.
- gotcha It is possible for `ci_info.is_ci()` to return `True` while `ci_info.name()` returns `None`. This occurs when generic, vendor-neutral CI environment variables are detected, but no specific CI provider recognized by `ci-info` is found.
Install
-
pip install ci-info
Imports
- is_ci
import ci_info
- name
import ci_info
- is_pr
import ci_info
- info
import ci_info
Quickstart
import ci_info
import os
if ci_info.is_ci():
print(f"Running on CI: {ci_info.name()}")
if ci_info.is_pr():
print("This is a Pull Request build.")
else:
print("This is not a Pull Request build.")
# Example of accessing CI environment variables directly
# os.environ.get('CI_NAME', 'Unknown')
# Get all detected info as a dictionary
all_ci_info = ci_info.info()
print(f"All CI Info: {all_ci_info}")
else:
print("Not running on a CI server.")