Codync
免費、開源的 1:1 替代方案,取代 Grok Bot 與 Muse。從 iPhone、Mac 或 Linux 桌面將 Claude Code、Codex、Cursor 與 40+ 程式碼代理人作為持續機器人傳訊。群組聊天、主題串…
AI 翻譯
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Catch breaking API changes in CI: diff your OpenAPI schema for Django, FastAPI and Flask
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗Catch breaking API changes in CI, for Django, FastAPI and Flask.
A developer renames a serializer field, makes a parameter required, or changes
id from int to string. Tests pass, the deploy goes out, and the mobile app
(which can't be force-updated) starts crashing. API changes get reviewed as
Python diffs, not as contract diffs.
api-contract generates the OpenAPI schema from your app, compares it with a
committed snapshot, classifies each change as breaking, potentially
breaking or safe, and fails the build on breaking ones. It names the
serializer, model or handler behind each change.
| Framework | Schema from |
|---|---|
| Django REST framework | drf-spectacular |
| Django | django-ninja |
| FastAPI | FastAPI itself |
| Flask | APIFlask, flask-smorest, flask-openapi3; a route inventory for plain Flask |
| Anything else | an OpenAPI 3.0/3.1 or Swagger 2.0 JSON or YAML file |
Two small specs: the new one changes total from number to string, adds a
required currency field to a request, adds an enum value, and adds an
endpoint. The snapshot was taken from old.yaml
(api-contract snapshot --source file:old.yaml), and source points at
new.yaml.
$ api-contract check
API contract: 4 changes (2 breaking)
BREAKING
POST /api/orders/ new required request field "currency"
id: POST /api/orders/:request:currency:required-request-field-added
GET /api/orders/{id}/ response field "total" type changed: number -> string
id: GET /api/orders/{}/:response:200:total:type-changed
POTENTIALLY BREAKING
GET /api/orders/{id}/ response field "status" enum value added: "on_hold"
id: GET /api/orders/{}/:response:200:status:response-enum-value-added:"on_hold"
SAFE
POST /api/coupons/ new endpoint
Fix the change, or acknowledge it:
api-contract allow 'POST /api/orders/:request:currency:required-request-field-added' --reason "..." --expires 2026-11-24
$ echo $?
1
With a Django, FastAPI or Flask project, each change also gets an at: line:
POST /orders response field "total" removed
at: app.main.Order (app/main.py:7)
id: POST /orders:response:201:total:response-field-removed
pip install --pre "api-contract[django]"
The --pre is needed while releases are pre-releases (0.1.0aN).
Alternatively, install a tagged release straight from git:
pip install "git+https://github.com/Pythondeveloper6/[email protected]"
(Extras with git: "api-contract[fastapi] @ git+https://github.com/Pythondeveloper6/[email protected]".)
Pick the extra for your stack:
| Extra | Installs | For |
|---|---|---|
django | Django, DRF, drf-spectacular | Django REST framework (not django-ninja: that is ninja) |
ninja | Django, django-ninja | django-ninja |
fastapi | FastAPI | FastAPI |
flask | Flask only | Not enough on its own: pick one of the three below, which bring Flask with them |
apiflask | APIFlask | APIFlask |
smorest | flask-smorest | flask-smorest |
flask-openapi3 | flask-openapi3 | flask-openapi3 |
Combine them if you need to: "api-contract[fastapi,flask-openapi3]". With no
extra you can still compare file: sources. Python 3.10 or newer.
The loader imports your app, so run api-contract in the environment where
your project's dependencies are installed.
Every framework follows the same steps: add [tool.api-contract] to
pyproject.toml, write a snapshot, commit it, and run check in CI. FastAPI
as the example:
api-contract init # detects the framework, writes the config, the first
# snapshot and a GitHub Actions workflow
or by hand:
# pyproject.toml
[tool.api-contract]
source = "fastapi:app.main:app" # module:FastAPI instance, or an app factory
api-contract snapshot # writes api-contract.json; commit it
api-contract check --against origin/main # exit 1 on a breaking change vs the target branch
snapshot refuses to overwrite a snapshot with breaking changes unless you
say why (--accept "reason", recorded in the allowlist), so a break can't be
approved by regenerating the file.
When a change is intentional, acknowledge it instead of weakening the rules:
api-contract allow "GET /api/orders/{id}/:response:200:total:type-changed" \
--reason "Mobile 4.2+ reads total_display instead" --expires 2026-12-01
Django (manage.py api_contract), Flask and plain file: sources work the
same way; see the Quickstart.
uses: Pythondeveloper6/api-contract@<tag> checks against
the base branch, writes the job summary and keeps one PR comment updated.pytest --api-contract, or the api_contract_check fixture./v1/* frozen while /v2/ evolves, removal allowed after an
x-sunset date.coverage (how much is declared), --usage access.log (traffic per change), verify-samples (recorded responses vs the
contract), explain <change> (how to ship it compatibly).Full documentation: https://pythondeveloper6.github.io/api-contract/ (an MkDocs Material site; run
mkdocs serve after pip install -e ".[docs]").
[tool.api-contract] key.manage.py api_contract.init, the GitHub Action, --against, pytest, GitLab CI, pre-commit, expiry reminders.--against in CI, refused snapshots.Changes between versions are in CHANGELOG.md.
A runnable end-to-end example is in
examples/orders-contract.
A complete GitHub Actions workflow is in
examples/github-actions.yml.
The loader imports your application, so run it only on code you trust, and give
CI read-only permissions. It makes no network calls. See the
security page and
SECURITY.md
to report a vulnerability.
It compares declared schemas, so behaviour the schema does not describe (semantics, side effects, undeclared fields) is not caught. This is an alpha: see Limitations and the stability policy.
Issues and pull requests are welcome. make install && make test lint typecheck docs
sets up and checks everything; details in the
contributing guide.
MIT