{"id":3480,"library":"evergreen-py","title":"Evergreen Python Client","description":"evergreen-py is a Python client library for interacting with the Evergreen API, specifically supporting its V2 version. It allows developers to build Python tools for Evergreen or use it on the command line to retrieve data about Evergreen objects. The library is actively maintained with automatic deployments to PyPI on merges to the master branch, following a semver versioning scheme. The current version is 3.15.0.","status":"active","version":"3.15.0","language":"en","source_language":"en","source_url":"https://github.com/evergreen-ci/evergreen.py","tags":["API client","Evergreen","automation"],"install":[{"cmd":"pip install evergreen-py","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Requires Python 3.9-3.13","package":"Python","optional":false}],"imports":[{"symbol":"EvgAuth","correct":"from evergreen.api import EvgAuth"},{"symbol":"EvergreenApi","correct":"from evergreen.api import EvergreenApi"}],"quickstart":{"code":"import os\nfrom evergreen.api import EvgAuth, EvergreenApi\n\n# It's recommended to set EVERGREEN_USERNAME and EVERGREEN_API_KEY as environment variables\nusername = os.environ.get('EVERGREEN_USERNAME', 'your_evergreen_username')\napi_key = os.environ.get('EVERGREEN_API_KEY', 'your_evergreen_api_key')\n\n# Ensure credentials are provided (replace with actual credentials or env vars)\nif not username or not api_key:\n    print(\"Please set EVERGREEN_USERNAME and EVERGREEN_API_KEY environment variables or provide them directly.\")\nelse:\n    auth = EvgAuth(username, api_key)\n    api = EvergreenApi.get_api(auth)\n    try:\n        project = api.project_by_id('mongodb-mongo-master')\n        print(f\"Project Display Name: {project.display_name}\")\n    except Exception as e:\n        print(f\"Error fetching project: {e}. Please check your credentials and project ID.\")","lang":"python","description":"This quickstart demonstrates how to authenticate with the Evergreen API and fetch a project by its ID. It's crucial to provide your Evergreen username and API key, ideally via environment variables, or through an `.evergreen.yml` file."},"warnings":[{"fix":"Ensure `EVERGREEN_USERNAME` and `EVERGREEN_API_KEY` are set in your environment, or configure an `.evergreen.yml` file in your home directory or current working directory with your credentials.","message":"Authentication requires an Evergreen username and API key. These are typically provided via an `.evergreen.yml` file or by setting `EVERGREEN_USERNAME` and `EVERGREEN_API_KEY` environment variables. Without these, API calls will fail.","severity":"gotcha","affected_versions":"All"},{"fix":"If you intend to use `patch_from_diff`, you must manually download and install the Evergreen CLI client for your operating system from the Evergreen website (e.g., `https://evergreen.mongodb.com/clients/linux_amd64/evergreen`) and ensure it's accessible in your PATH.","message":"The `patch_from_diff` API function within `evergreen-py` explicitly requires the Evergreen CLI to be installed and available in the system's PATH. This is not a dependency installed by `pip install evergreen-py`.","severity":"gotcha","affected_versions":"All"},{"fix":"Refer to the Evergreen REST V2 Usage documentation for supported API capabilities and ensure your interactions align with V2 specifications.","message":"The `evergreen-py` library specifically supports the V2 version of the Evergreen API. Functionality from older API versions may not be available or behave differently.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}