{"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":"python","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,"search_vec":"'3.15.0':70 'activ':48 'allow':24 'api':17,71 'autom':74 'automat':51 'branch':60 'build':27 'client':3,10,72 'command':37 'current':67 'data':41 'deploy':52 'develop':25 'evergreen':1,5,16,31,43,73 'evergreen-pi':4 'follow':61 'interact':13 'librari':11,46 'line':38 'maintain':49 'master':59 'merg':56 'object':44 'py':6 'pypi':54 'python':2,9,28 'retriev':40 'scheme':65 'semver':63 'specif':18 'support':19 'tool':29 'use':33 'v2':21 'version':22,64,68","created_at":"2026-04-11T17:31:25.599159+00:00","updated_at":"2026-04-16T14:52:38.420696+00:00","problems":[{"fix":"Ensure the library is installed using pip: `pip install evergreen-py` and that your Python script is run within the correct environment.","cause":"The 'evergreen-py' library is not installed in your current Python environment, or the environment where it's installed is not active. This can also happen if there's a typo in the import statement.","error":"ModuleNotFoundError: No module named 'evergreen'"},{"fix":"Set the `EVERGREEN_USERNAME` and `EVERGREEN_API_KEY` environment variables, or create a valid `.evergreen.yml` file in your home or working directory with your Evergreen credentials.","cause":"Authentication to the Evergreen API failed, likely due to missing or incorrect 'EVERGREEN_USERNAME' or 'EVERGREEN_API_KEY' environment variables, or an invalid `.evergreen.yml` configuration file.","error":"Error fetching project: {e}. Please check your credentials and project ID."},{"fix":"Consult the `evergreen-py` documentation or the Evergreen REST V2 API documentation to confirm the correct method or attribute name and its availability. Double-check for typos.","cause":"You are attempting to access a method or attribute that does not exist on the `EvergreenApi` object, possibly due to a typo, misunderstanding the API's structure, or trying to use functionality not supported by the V2 API.","error":"AttributeError: 'EvergreenApi' object has no attribute 'some_method_or_attribute'"},{"fix":"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 its executable is added to your system's PATH.","cause":"The `patch_from_diff` API function within `evergreen-py` explicitly requires the Evergreen CLI client to be installed and available in your system's PATH. This dependency is not handled by `pip install evergreen-py`.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'evergreen'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.19.1","cli_name":"evergreen","cli_version":"sh: 1: evergreen: not found","type":"library","homepage":null,"github":"https://github.com/evergreen-ci/evergreen.py","docs":null,"changelog":null,"pypi":"https://pypi.org/project/evergreen-py/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}