Registry / http-networking / evergreen-py

evergreen-py

JSON →
library3.19.1pypypi✓ verified 28d ago

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.

pip install evergreen-py
INSTALL
IMPORT
SIG · EVERGREEN-PY
E
evergreen-py
http-networkingpythonv3.19.1
Install
4.5s avg
Import
1027ms
Disk
36MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.19.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.066s · 36.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 4.5s · import 0.988s · 37MB
36MB installed
● package 36MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EvgAuth
✓ from evergreen.api import EvgAuth
EvergreenApi
✓ from evergreen.api import EvergreenApi

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.

import os from evergreen.api import EvgAuth, EvergreenApi # It's recommended to set EVERGREEN_USERNAME and EVERGREEN_API_KEY as environment variables username = os.environ.get('EVERGREEN_USERNAME', 'your_evergreen_username') api_key = os.environ.get('EVERGREEN_API_KEY', 'your_evergreen_api_key') # Ensure credentials are provided (replace with actual credentials or env vars) if not username or not api_key: print("Please set EVERGREEN_USERNAME and EVERGREEN_API_KEY environment variables or provide them directly.") else: auth = EvgAuth(username, api_key) api = EvergreenApi.get_api(auth) try: project = api.project_by_id('mongodb-mongo-master') print(f"Project Display Name: {project.display_name}") except Exception as e: print(f"Error fetching project: {e}. Please check your credentials and project ID.")
evergreen --version
Debug
Known issues
gotchaAuthentication 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.
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.
affects: All
gotchaThe `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`.
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.
affects: All
gotchaThe `evergreen-py` library specifically supports the V2 version of the Evergreen API. Functionality from older API versions may not be available or behave differently.
fix
Refer to the Evergreen REST V2 Usage documentation for supported API capabilities and ensure your interactions align with V2 specifications.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'evergreen'
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.
fix
Ensure the library is installed using pip: `pip install evergreen-py` and that your Python script is run within the correct environment.
Error fetching project: {e}. Please check your credentials and project ID.
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.
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.
AttributeError: 'EvergreenApi' object has no attribute 'some_method_or_attribute'
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.
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.
FileNotFoundError: [Errno 2] No such file or directory: 'evergreen'
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`.
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.
Upgrade
Version history
3.19.1latest on PyPI · released Jun 29, 2026
Audit
Dependencies
PythonrequiredRequires Python 3.9-3.13
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
evergreen-py — pip install evergreen-py · libregistry