Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# AGENTS.md

## Cursor Cloud specific instructions

This repo is the **Resend Python SDK** — a client library (published to PyPI as `resend`).
There is **no server, database, or long-running service**; the only external dependency is the
Resend REST API (`https://api.resend.com`), which the unit tests mock. Standard dev commands live
in `tox.ini` (envs: `format`, `lint`, `mypy`, `py`); the update script pre-installs the toolchain.

Non-obvious caveats for this environment:

- **Use `python3`, not `python`** (there is no `python` shim). Console scripts like `tox` install
to `~/.local/bin`, which may not be on `PATH`; call `python3 -m <tool>` or add it to `PATH`.
- **`flake8<5.0.0` (pinned in `tox.ini`) is incompatible with Python 3.12** (the system default),
failing with `'EntryPoints' object has no attribute 'get'`. CI only lints/type-checks/tests on
Python 3.8–3.11. **Python 3.11 is installed** for this reason. Force tox to use it via basepython
overrides:
- Lint: `tox -e lint -x testenv:lint.basepython=python3.11`
- Mypy: `tox -e mypy -x testenv:mypy.basepython=python3.11`
- Tests: `tox -e py -x testenv:py.basepython=python3.11`
Comment on lines +18 to +20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The documented tox commands still fail when ~/.local/bin is not on PATH, the setup described immediately above. Use module invocation consistently so the commands work without a PATH change.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AGENTS.md, line 18:

<comment>The documented tox commands still fail when `~/.local/bin` is not on `PATH`, the setup described immediately above. Use module invocation consistently so the commands work without a PATH change.</comment>

<file context>
@@ -0,0 +1,25 @@
+  failing with `'EntryPoints' object has no attribute 'get'`. CI only lints/type-checks/tests on
+  Python 3.8–3.11. **Python 3.11 is installed** for this reason. Force tox to use it via basepython
+  overrides:
+  - Lint:  `tox -e lint -x testenv:lint.basepython=python3.11`
+  - Mypy:  `tox -e mypy -x testenv:mypy.basepython=python3.11`
+  - Tests: `tox -e py -x testenv:py.basepython=python3.11`
</file context>
Suggested change
- Lint: `tox -e lint -x testenv:lint.basepython=python3.11`
- Mypy: `tox -e mypy -x testenv:mypy.basepython=python3.11`
- Tests: `tox -e py -x testenv:py.basepython=python3.11`
- Lint: `python3 -m tox -e lint -x testenv:lint.basepython=python3.11`
- Mypy: `python3 -m tox -e mypy -x testenv:mypy.basepython=python3.11`
- Tests: `python3 -m tox -e py -x testenv:py.basepython=python3.11`

- Tests/mypy also run fine directly on Python 3.12 (`python3 -m pytest --doctest-modules tests`);
**only flake8 requires 3.11**. `tox` defaults `basepython` to the interpreter it runs under
(3.12), so the overrides above are needed to match CI.
- The `examples/` scripts hit the **real** Resend API and require `RESEND_API_KEY` (and optionally
`RESEND_API_URL` to point at a different base URL). They are not needed for tests/lint/build.
Comment on lines +24 to +25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The webhook receiver example is not an API client example: it starts a local Flask server and uses RESEND_WEBHOOK_SECRET, so this guidance sends agents to configure an unnecessary API key and omits its Flask dependency. Distinguish this example from API-calling scripts.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AGENTS.md, line 24:

<comment>The webhook receiver example is not an API client example: it starts a local Flask server and uses `RESEND_WEBHOOK_SECRET`, so this guidance sends agents to configure an unnecessary API key and omits its Flask dependency. Distinguish this example from API-calling scripts.</comment>

<file context>
@@ -0,0 +1,25 @@
+- Tests/mypy also run fine directly on Python 3.12 (`python3 -m pytest --doctest-modules tests`);
+  **only flake8 requires 3.11**. `tox` defaults `basepython` to the interpreter it runs under
+  (3.12), so the overrides above are needed to match CI.
+- The `examples/` scripts hit the **real** Resend API and require `RESEND_API_KEY` (and optionally
+  `RESEND_API_URL` to point at a different base URL). They are not needed for tests/lint/build.
</file context>
Suggested change
- The `examples/` scripts hit the **real** Resend API and require `RESEND_API_KEY` (and optionally
`RESEND_API_URL` to point at a different base URL). They are not needed for tests/lint/build.
- Most `examples/` scripts hit the **real** Resend API and require `RESEND_API_KEY` (and optionally
`RESEND_API_URL` to point at a different base URL). `examples/webhook_receiver.py` instead runs a
local Flask server and uses `RESEND_WEBHOOK_SECRET`. They are not needed for tests/lint/build.

Loading