|
| 1 | +# AGENTS.md — AI / automation context |
| 2 | + |
| 3 | +## Project |
| 4 | + |
| 5 | +| | | |
| 6 | +|---|---| |
| 7 | +| **Name** | **`contentstack_utils`** (PyPI) — **Contentstack Python Utils SDK** | |
| 8 | +| **Purpose** | Utilities for **Contentstack** headless CMS: **RTE / embedded** rendering (`Utils`, `Options`), **GQL** helpers, **editable tags** on entries, HTML/metadata helpers. Often used alongside the **`Contentstack`** Python delivery package. | |
| 9 | +| **Repository** | [contentstack/contentstack-utils-python](https://github.com/contentstack/contentstack-utils-python.git) | |
| 10 | + |
| 11 | +## Tech stack |
| 12 | + |
| 13 | +| Area | Details | |
| 14 | +|------|---------| |
| 15 | +| **Language** | **Python** (`python_requires` in `setup.py`; classifiers list 3.6–3.9; dev tooling in `requirements.txt` may need a newer interpreter) | |
| 16 | +| **Package** | **`setuptools`** — `find_packages()`, `contentstack_utils/` | |
| 17 | +| **Runtime deps** | **`lxml`** (XML/HTML parsing in `utils.py` and helpers) | |
| 18 | +| **Tests** | **pytest** + **pytest-cov**, **pytest-html** (optional HTML report) | |
| 19 | +| **Lint / format** | **ruff**, **black**, **flake8**, **isort** (see `requirements.txt`) | |
| 20 | + |
| 21 | +## Source layout |
| 22 | + |
| 23 | +| Path | Role | |
| 24 | +|------|------| |
| 25 | +| `contentstack_utils/utils.py` | **`Utils`** — `render_content`, embedded/RTE flows; extends **`Automate`** | |
| 26 | +| `contentstack_utils/render/options.py` | **`Options`** for rendering | |
| 27 | +| `contentstack_utils/helper/` | **Metadata**, **NodeToHtml**, **converter** (e.g. `convert_style`) | |
| 28 | +| `contentstack_utils/embedded/` | **ItemType**, **StyleType** | |
| 29 | +| `contentstack_utils/gql.py` | **GQL** helpers | |
| 30 | +| `contentstack_utils/automate.py` | **`Automate`** base for automation-style rendering | |
| 31 | +| `contentstack_utils/entry_editable.py` | **`addEditableTags`**, **`addTags`**, **`getTag`**; re-exported via **`Utils`** static methods and package **`__init__`** | |
| 32 | +| `contentstack_utils/__init__.py` | Public exports — keep **`__all__`** aligned with documented API | |
| 33 | +| `tests/` | pytest modules (`test_*.py`), mocks under `tests/mocks/` | |
| 34 | + |
| 35 | +## Common commands |
| 36 | + |
| 37 | +```bash |
| 38 | +python -m venv .venv && source .venv/bin/activate # or equivalent on Windows |
| 39 | +pip install -r requirements.txt |
| 40 | +pip install -e . |
| 41 | +pytest |
| 42 | +pytest --html=tests/test-report/test-report.html --self-contained-html |
| 43 | +coverage run -m pytest && coverage report -m |
| 44 | +``` |
| 45 | + |
| 46 | +## Security |
| 47 | + |
| 48 | +- Do not commit **API keys**, **delivery tokens**, or other secrets. Examples in **`README.md`** use placeholders only. |
| 49 | + |
| 50 | +## Further guidance |
| 51 | + |
| 52 | +- **Cursor rules:** [`.cursor/rules/README.md`](.cursor/rules/README.md) |
| 53 | +- **Skills:** [`skills/README.md`](skills/README.md) |
| 54 | + |
| 55 | +Product docs: [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/). |
0 commit comments