|
| 1 | +# AGENTS.md — AI / automation context |
| 2 | + |
| 3 | +## Project |
| 4 | + |
| 5 | +||| |
| 6 | +|---|---| |
| 7 | +|**Name**|**`contentstack-management`** (PyPI) — **Contentstack Management Python SDK**| |
| 8 | +|**Purpose**| Python client for the **Content Management API (CMA)**: organizations, stacks, content types, entries, assets, webhooks, workflows, OAuth, and related resources. Uses **`requests`** via **`_APIClient`**. | |
| 9 | +|**Repository**|[contentstack/contentstack-management-python](https://github.com/contentstack/contentstack-management-python.git)| |
| 10 | + |
| 11 | +## Tech stack |
| 12 | + |
| 13 | +| Area | Details | |
| 14 | +|------|---------| |
| 15 | +|**Language**|**Python** ≥ 3.9 (`setup.py``python_requires`) | |
| 16 | +|**HTTP**|**`requests`**, **`requests-toolbelt`**, **`urllib3`**| |
| 17 | +|**Tests**|**pytest** — **`tests/unit`**, **`tests/api`**, **`tests/mock`**| |
| 18 | +|**Lint**|**pylint** (see `requirements.txt`) | |
| 19 | +|**Secrets / hooks**|**Talisman**, **Snyk** (see **README.md** development setup) | |
| 20 | + |
| 21 | +## Source layout |
| 22 | + |
| 23 | +| Path | Role | |
| 24 | +|------|------| |
| 25 | +|`contentstack_management/contentstack.py`|**`Client`**, **`Region`**, endpoint construction, **`user_agents`**, optional **OAuth** wiring | |
| 26 | +|`contentstack_management/_api_client.py`|**`_APIClient`** — HTTP calls, retries, optional **OAuth** interceptor | |
| 27 | +|`contentstack_management/stack/stack.py`|**Stack**-scoped CMA operations | |
| 28 | +|`contentstack_management/*/`| Domain modules (entries, assets, webhooks, taxonomies, …) | |
| 29 | +|`contentstack_management/__init__.py`| Public exports | |
| 30 | +|`tests/cred.py`|**`get_credentials()`** — **dotenv** + env vars for API/mock tests | |
| 31 | + |
| 32 | +## Common commands |
| 33 | + |
| 34 | +```bash |
| 35 | +pip install -e ".[dev]" |
| 36 | +# or: pip install -r requirements.txt && pip install pytest pytest-cov |
| 37 | + |
| 38 | +pytest tests/unit/ -v |
| 39 | +pytest tests/api/ -v # live CMA — needs .env (see tests/cred.py) |
| 40 | +pytest tests/mock/ -v |
| 41 | +pytest tests/ -v |
| 42 | +coverage run -m pytest tests/unit/ |
| 43 | +``` |
| 44 | + |
| 45 | +## Environment variables (API / integration tests) |
| 46 | + |
| 47 | +Loaded via **`tests/cred.py`** (`load_dotenv()`). Examples include **`HOST`**, **`APIKEY`**, **`AUTHTOKEN`**, **`MANAGEMENT_TOKEN`**, **`ORG_UID`**, and resource UIDs (**`CONTENT_TYPE_UID`**, **`ENTRY_UID`**, …). See that file for the full list. |
| 48 | + |
| 49 | +Do not commit secrets. |
| 50 | + |
| 51 | +## Further guidance |
| 52 | + |
| 53 | +-**Cursor rules:**[`.cursor/rules/README.md`](.cursor/rules/README.md) |
| 54 | +-**Skills:**[`skills/README.md`](skills/README.md) |
| 55 | + |
| 56 | +Product docs: [Content Management API](https://www.contentstack.com/docs/developers/apis/content-management-api/). |
0 commit comments