aiollm-core 0.15.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aiollm_core-0.15.0/.claude/skills/ai-api-docs/SKILL.md +63 -0
- aiollm_core-0.15.0/.claude/skills/ai-api-provider/SKILL.md +95 -0
- aiollm_core-0.15.0/.claude/skills/ai-api-release/SKILL.md +98 -0
- aiollm_core-0.15.0/.gitattributes +63 -0
- aiollm_core-0.15.0/.github/workflows/docs.yml +53 -0
- aiollm_core-0.15.0/.github/workflows/publish.yml +43 -0
- aiollm_core-0.15.0/.github/workflows/tests.yml +186 -0
- aiollm_core-0.15.0/.gitignore +33 -0
- aiollm_core-0.15.0/.pre-commit-config.yaml +46 -0
- aiollm_core-0.15.0/.python-version +1 -0
- aiollm_core-0.15.0/CHANGELOG.md +1392 -0
- aiollm_core-0.15.0/CHANGES/.gitkeep +0 -0
- aiollm_core-0.15.0/CHANGES/README.md +17 -0
- aiollm_core-0.15.0/CLAUDE.md +91 -0
- aiollm_core-0.15.0/CONTRIBUTING.md +253 -0
- aiollm_core-0.15.0/LICENSE +21 -0
- aiollm_core-0.15.0/PKG-INFO +167 -0
- aiollm_core-0.15.0/README.md +118 -0
- aiollm_core-0.15.0/docs/assets/aiollm.png +0 -0
- aiollm_core-0.15.0/docs/assets/aiollm_dark.png +0 -0
- aiollm_core-0.15.0/docs/changelog.md +1 -0
- aiollm_core-0.15.0/docs/contributing.md +1 -0
- aiollm_core-0.15.0/docs/guide/design.md +73 -0
- aiollm_core-0.15.0/docs/guide/errors.md +177 -0
- aiollm_core-0.15.0/docs/guide/extending.md +45 -0
- aiollm_core-0.15.0/docs/guide/files.md +189 -0
- aiollm_core-0.15.0/docs/guide/generation.md +116 -0
- aiollm_core-0.15.0/docs/guide/methods.md +265 -0
- aiollm_core-0.15.0/docs/guide/providers.md +107 -0
- aiollm_core-0.15.0/docs/guide/request-flow.md +32 -0
- aiollm_core-0.15.0/docs/guide/resources.md +101 -0
- aiollm_core-0.15.0/docs/guide/sessions.md +177 -0
- aiollm_core-0.15.0/docs/guide/streaming.md +159 -0
- aiollm_core-0.15.0/docs/guide/tools.md +392 -0
- aiollm_core-0.15.0/docs/guide/uploads.md +50 -0
- aiollm_core-0.15.0/docs/index.md +9 -0
- aiollm_core-0.15.0/docs/reference/adapters.md +3 -0
- aiollm_core-0.15.0/docs/reference/anthropic.md +11 -0
- aiollm_core-0.15.0/docs/reference/client.md +3 -0
- aiollm_core-0.15.0/docs/reference/http.md +5 -0
- aiollm_core-0.15.0/docs/reference/index.md +10 -0
- aiollm_core-0.15.0/docs/reference/methods.md +3 -0
- aiollm_core-0.15.0/docs/reference/openai.md +11 -0
- aiollm_core-0.15.0/docs/reference/resources.md +3 -0
- aiollm_core-0.15.0/docs/reference/response.md +5 -0
- aiollm_core-0.15.0/docs/reference/serialization.md +3 -0
- aiollm_core-0.15.0/docs/reference/session.md +5 -0
- aiollm_core-0.15.0/docs/reference/testing.md +33 -0
- aiollm_core-0.15.0/docs/reference/types.md +7 -0
- aiollm_core-0.15.0/docs/sse-ndjson-plan.md +110 -0
- aiollm_core-0.15.0/docs/testing-plan-stages.png +0 -0
- aiollm_core-0.15.0/docs/testing-plan.md +376 -0
- aiollm_core-0.15.0/docs/unification.md +209 -0
- aiollm_core-0.15.0/mkdocs.yml +119 -0
- aiollm_core-0.15.0/pyproject.toml +338 -0
- aiollm_core-0.15.0/src/aiollm/__init__.py +278 -0
- aiollm_core-0.15.0/src/aiollm/__meta__.py +5 -0
- aiollm_core-0.15.0/src/aiollm/adapters/__init__.py +43 -0
- aiollm_core-0.15.0/src/aiollm/adapters/base.py +302 -0
- aiollm_core-0.15.0/src/aiollm/adapters/protocols.py +134 -0
- aiollm_core-0.15.0/src/aiollm/adapters/stop.py +26 -0
- aiollm_core-0.15.0/src/aiollm/adapters/validation.py +305 -0
- aiollm_core-0.15.0/src/aiollm/client/__init__.py +23 -0
- aiollm_core-0.15.0/src/aiollm/client/base.py +354 -0
- aiollm_core-0.15.0/src/aiollm/client/binding.py +140 -0
- aiollm_core-0.15.0/src/aiollm/client/protocols.py +99 -0
- aiollm_core-0.15.0/src/aiollm/client/validators.py +98 -0
- aiollm_core-0.15.0/src/aiollm/enums.py +245 -0
- aiollm_core-0.15.0/src/aiollm/exceptions.py +123 -0
- aiollm_core-0.15.0/src/aiollm/http/__init__.py +33 -0
- aiollm_core-0.15.0/src/aiollm/http/api.py +118 -0
- aiollm_core-0.15.0/src/aiollm/http/auth.py +88 -0
- aiollm_core-0.15.0/src/aiollm/http/exceptions/__init__.py +71 -0
- aiollm_core-0.15.0/src/aiollm/http/exceptions/aiohttp.py +125 -0
- aiollm_core-0.15.0/src/aiollm/http/exceptions/protocols.py +32 -0
- aiollm_core-0.15.0/src/aiollm/http/exceptions/resolver.py +221 -0
- aiollm_core-0.15.0/src/aiollm/http/exceptions/response.py +35 -0
- aiollm_core-0.15.0/src/aiollm/http/exceptions/status.py +217 -0
- aiollm_core-0.15.0/src/aiollm/http/exceptions/transport.py +142 -0
- aiollm_core-0.15.0/src/aiollm/http/headers.py +176 -0
- aiollm_core-0.15.0/src/aiollm/http/protocols.py +112 -0
- aiollm_core-0.15.0/src/aiollm/methods/__init__.py +23 -0
- aiollm_core-0.15.0/src/aiollm/methods/base.py +969 -0
- aiollm_core-0.15.0/src/aiollm/methods/fields.py +595 -0
- aiollm_core-0.15.0/src/aiollm/methods/path.py +90 -0
- aiollm_core-0.15.0/src/aiollm/methods/protocols.py +125 -0
- aiollm_core-0.15.0/src/aiollm/py.typed +0 -0
- aiollm_core-0.15.0/src/aiollm/resources/__init__.py +63 -0
- aiollm_core-0.15.0/src/aiollm/resources/base.py +40 -0
- aiollm_core-0.15.0/src/aiollm/resources/files.py +247 -0
- aiollm_core-0.15.0/src/aiollm/resources/generation.py +258 -0
- aiollm_core-0.15.0/src/aiollm/resources/protocols.py +567 -0
- aiollm_core-0.15.0/src/aiollm/resources/stream.py +115 -0
- aiollm_core-0.15.0/src/aiollm/resources/tool_runner.py +986 -0
- aiollm_core-0.15.0/src/aiollm/resources/usecases.py +441 -0
- aiollm_core-0.15.0/src/aiollm/response/__init__.py +23 -0
- aiollm_core-0.15.0/src/aiollm/response/aiohttp.py +148 -0
- aiollm_core-0.15.0/src/aiollm/response/buffered.py +26 -0
- aiollm_core-0.15.0/src/aiollm/response/parse/__init__.py +25 -0
- aiollm_core-0.15.0/src/aiollm/response/parse/buffered.py +240 -0
- aiollm_core-0.15.0/src/aiollm/response/parse/lines.py +140 -0
- aiollm_core-0.15.0/src/aiollm/response/parse/protocols.py +74 -0
- aiollm_core-0.15.0/src/aiollm/response/parse/sse.py +154 -0
- aiollm_core-0.15.0/src/aiollm/response/parse/stream.py +596 -0
- aiollm_core-0.15.0/src/aiollm/response/protocols.py +58 -0
- aiollm_core-0.15.0/src/aiollm/response/stream.py +266 -0
- aiollm_core-0.15.0/src/aiollm/serialization/__init__.py +25 -0
- aiollm_core-0.15.0/src/aiollm/serialization/json.py +39 -0
- aiollm_core-0.15.0/src/aiollm/serialization/normalize.py +240 -0
- aiollm_core-0.15.0/src/aiollm/serialization/protocols.py +61 -0
- aiollm_core-0.15.0/src/aiollm/serialization/traversal.py +58 -0
- aiollm_core-0.15.0/src/aiollm/serialization/values.py +192 -0
- aiollm_core-0.15.0/src/aiollm/session/__init__.py +45 -0
- aiollm_core-0.15.0/src/aiollm/session/aiohttp.py +525 -0
- aiollm_core-0.15.0/src/aiollm/session/base.py +455 -0
- aiollm_core-0.15.0/src/aiollm/session/body/__init__.py +11 -0
- aiollm_core-0.15.0/src/aiollm/session/body/aiohttp.py +485 -0
- aiollm_core-0.15.0/src/aiollm/session/body/protocols.py +41 -0
- aiollm_core-0.15.0/src/aiollm/session/factory.py +87 -0
- aiollm_core-0.15.0/src/aiollm/session/loop.py +51 -0
- aiollm_core-0.15.0/src/aiollm/session/protocols.py +158 -0
- aiollm_core-0.15.0/src/aiollm/session/retry/__init__.py +31 -0
- aiollm_core-0.15.0/src/aiollm/session/retry/policy.py +179 -0
- aiollm_core-0.15.0/src/aiollm/session/retry/protocols.py +39 -0
- aiollm_core-0.15.0/src/aiollm/session/retry/runner.py +241 -0
- aiollm_core-0.15.0/src/aiollm/session/retry/state.py +27 -0
- aiollm_core-0.15.0/src/aiollm/testing/__init__.py +42 -0
- aiollm_core-0.15.0/src/aiollm/testing/aiohttp.py +238 -0
- aiollm_core-0.15.0/src/aiollm/testing/contract/__init__.py +39 -0
- aiollm_core-0.15.0/src/aiollm/testing/contract/clients.py +244 -0
- aiollm_core-0.15.0/src/aiollm/testing/contract/files.py +427 -0
- aiollm_core-0.15.0/src/aiollm/testing/contract/generation.py +1404 -0
- aiollm_core-0.15.0/src/aiollm/testing/doubles.py +372 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/__init__.py +27 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/api.py +26 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/client.py +104 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/files.py +182 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/generation.py +564 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/methods.py +209 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/resolver.py +66 -0
- aiollm_core-0.15.0/src/aiollm/testing/echo/types.py +270 -0
- aiollm_core-0.15.0/src/aiollm/testing/extension.py +148 -0
- aiollm_core-0.15.0/src/aiollm/testing/extension_api.json +139 -0
- aiollm_core-0.15.0/src/aiollm/testing/plugin.py +225 -0
- aiollm_core-0.15.0/src/aiollm/testing/recording.py +88 -0
- aiollm_core-0.15.0/src/aiollm/testing/wire.py +491 -0
- aiollm_core-0.15.0/src/aiollm/types/__init__.py +55 -0
- aiollm_core-0.15.0/src/aiollm/types/base.py +60 -0
- aiollm_core-0.15.0/src/aiollm/types/files.py +896 -0
- aiollm_core-0.15.0/src/aiollm/types/matchers.py +497 -0
- aiollm_core-0.15.0/src/aiollm/types/protocols.py +25 -0
- aiollm_core-0.15.0/src/aiollm/types/requests/__init__.py +59 -0
- aiollm_core-0.15.0/src/aiollm/types/requests/base.py +20 -0
- aiollm_core-0.15.0/src/aiollm/types/requests/content.py +313 -0
- aiollm_core-0.15.0/src/aiollm/types/requests/generation.py +1017 -0
- aiollm_core-0.15.0/src/aiollm/types/requests/upload.py +29 -0
- aiollm_core-0.15.0/src/aiollm/types/responses/__init__.py +45 -0
- aiollm_core-0.15.0/src/aiollm/types/responses/base.py +17 -0
- aiollm_core-0.15.0/src/aiollm/types/responses/events.py +233 -0
- aiollm_core-0.15.0/src/aiollm/types/responses/files.py +40 -0
- aiollm_core-0.15.0/src/aiollm/types/responses/generation.py +167 -0
- aiollm_core-0.15.0/src/aiollm/types/unknown.py +74 -0
- aiollm_core-0.15.0/tests/__init__.py +0 -0
- aiollm_core-0.15.0/tests/conftest.py +18 -0
- aiollm_core-0.15.0/tests/docs/__init__.py +0 -0
- aiollm_core-0.15.0/tests/docs/payloads.py +276 -0
- aiollm_core-0.15.0/tests/docs/test_examples.py +1379 -0
- aiollm_core-0.15.0/tests/docs/test_unification.py +452 -0
- aiollm_core-0.15.0/tests/downstream/__init__.py +0 -0
- aiollm_core-0.15.0/tests/downstream/test_extension_api.py +48 -0
- aiollm_core-0.15.0/tests/integration/__init__.py +0 -0
- aiollm_core-0.15.0/tests/integration/test_aiohttp_events.py +264 -0
- aiollm_core-0.15.0/tests/integration/test_aiohttp_hardening.py +585 -0
- aiollm_core-0.15.0/tests/integration/test_aiohttp_requests.py +638 -0
- aiollm_core-0.15.0/tests/integration/test_aiohttp_streams.py +277 -0
- aiollm_core-0.15.0/tests/integration/test_aiohttp_uploads.py +403 -0
- aiollm_core-0.15.0/tests/integration/test_close_delimited.py +112 -0
- aiollm_core-0.15.0/tests/integration/test_logging.py +308 -0
- aiollm_core-0.15.0/tests/integration/test_upload_attempts.py +364 -0
- aiollm_core-0.15.0/tests/session/__init__.py +0 -0
- aiollm_core-0.15.0/tests/session/test_base_session.py +915 -0
- aiollm_core-0.15.0/tests/session/test_session_factory.py +40 -0
- aiollm_core-0.15.0/tests/test_doubles.py +260 -0
- aiollm_core-0.15.0/tests/test_layout.py +55 -0
- aiollm_core-0.15.0/tests/testing/__init__.py +0 -0
- aiollm_core-0.15.0/tests/testing/echo_payloads.py +72 -0
- aiollm_core-0.15.0/tests/testing/test_echo.py +76 -0
- aiollm_core-0.15.0/tests/testing/test_echo_contracts.py +202 -0
- aiollm_core-0.15.0/tests/testing/test_wire.py +255 -0
- aiollm_core-0.15.0/tests/typing/__init__.py +0 -0
- aiollm_core-0.15.0/tests/typing/check_public_api.py +721 -0
- aiollm_core-0.15.0/tests/unit/__init__.py +0 -0
- aiollm_core-0.15.0/tests/unit/methods/__init__.py +0 -0
- aiollm_core-0.15.0/tests/unit/methods/test_inference.py +496 -0
- aiollm_core-0.15.0/tests/unit/methods/test_missing.py +565 -0
- aiollm_core-0.15.0/tests/unit/methods/test_path_params.py +345 -0
- aiollm_core-0.15.0/tests/unit/methods/test_query_body.py +575 -0
- aiollm_core-0.15.0/tests/unit/public_api.json +345 -0
- aiollm_core-0.15.0/tests/unit/test_api.py +93 -0
- aiollm_core-0.15.0/tests/unit/test_base_client.py +554 -0
- aiollm_core-0.15.0/tests/unit/test_body_builder.py +475 -0
- aiollm_core-0.15.0/tests/unit/test_content_parts.py +214 -0
- aiollm_core-0.15.0/tests/unit/test_decoder_properties.py +132 -0
- aiollm_core-0.15.0/tests/unit/test_error_resolver.py +416 -0
- aiollm_core-0.15.0/tests/unit/test_event_decoders.py +311 -0
- aiollm_core-0.15.0/tests/unit/test_event_stream.py +618 -0
- aiollm_core-0.15.0/tests/unit/test_exceptions.py +372 -0
- aiollm_core-0.15.0/tests/unit/test_extension_api.py +111 -0
- aiollm_core-0.15.0/tests/unit/test_files.py +374 -0
- aiollm_core-0.15.0/tests/unit/test_generation_api.py +224 -0
- aiollm_core-0.15.0/tests/unit/test_generation_request.py +59 -0
- aiollm_core-0.15.0/tests/unit/test_generation_stream.py +188 -0
- aiollm_core-0.15.0/tests/unit/test_headers_auth.py +164 -0
- aiollm_core-0.15.0/tests/unit/test_layers.py +330 -0
- aiollm_core-0.15.0/tests/unit/test_matchers.py +276 -0
- aiollm_core-0.15.0/tests/unit/test_options.py +60 -0
- aiollm_core-0.15.0/tests/unit/test_parsers.py +259 -0
- aiollm_core-0.15.0/tests/unit/test_provider.py +158 -0
- aiollm_core-0.15.0/tests/unit/test_public_api.py +90 -0
- aiollm_core-0.15.0/tests/unit/test_resource_protocol_import.py +17 -0
- aiollm_core-0.15.0/tests/unit/test_resources.py +1216 -0
- aiollm_core-0.15.0/tests/unit/test_retry.py +414 -0
- aiollm_core-0.15.0/tests/unit/test_serialization.py +472 -0
- aiollm_core-0.15.0/tests/unit/test_stream.py +451 -0
- aiollm_core-0.15.0/tests/unit/test_stream_terminal.py +338 -0
- aiollm_core-0.15.0/tests/unit/test_tool_from_callable.py +281 -0
- aiollm_core-0.15.0/tests/unit/test_tool_runner.py +1596 -0
- aiollm_core-0.15.0/tests/unit/test_upload_lifecycle.py +828 -0
- aiollm_core-0.15.0/uv.lock +2562 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-api-docs
|
|
3
|
+
description: Write or update aiollm documentation - the MkDocs guide pages, README, docstrings (which become the reference pages), CHANGELOG and docs/unification.md - so that every statement matches the code and every Python example is titled and executed by a test. Use it in the aiollm repository whenever behaviour, an option, an error or a public name changes, when the owner asks to document something, fix the docs, add an example, or check that the site still matches the code («доки», «документация», «пример в доках»).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# aiollm docs
|
|
7
|
+
|
|
8
|
+
The code is the source of truth about what the library does; the docs must
|
|
9
|
+
say exactly that. Every Python block on the site runs in a test, so an
|
|
10
|
+
example that drifts from the code fails CI instead of misleading a user.
|
|
11
|
+
|
|
12
|
+
## Where things go
|
|
13
|
+
|
|
14
|
+
- `README.md`: status line, short pitch, install, quick start; its intro is
|
|
15
|
+
shared with `docs/index.md` through a snippet.
|
|
16
|
+
- `docs/guide/*.md`: how to use a feature (methods, uploads, streaming,
|
|
17
|
+
errors, sessions, providers, generation, resources, extending, design).
|
|
18
|
+
- Reference pages: generated by mkdocstrings from docstrings - a Google-style
|
|
19
|
+
docstring is user documentation; fix it there, not on a page.
|
|
20
|
+
- `docs/unification.md`: one row per shared field and error case
|
|
21
|
+
(`tests/docs/test_unification.py` checks the rows and the errors).
|
|
22
|
+
- `CHANGELOG.md`: what a user sees, under `[Unreleased]`, breaking entries
|
|
23
|
+
with migration steps.
|
|
24
|
+
- `CLAUDE.md`: invariants and conventions for agents only.
|
|
25
|
+
- Historical plans (`testing-plan.md`, `sse-ndjson-plan.md`) are not edited.
|
|
26
|
+
|
|
27
|
+
## Checking a statement
|
|
28
|
+
|
|
29
|
+
Before writing a sentence about behaviour, find the code that does it
|
|
30
|
+
(`file:line`) or run a probe. If the text and the code disagree, the code
|
|
31
|
+
wins - unless it looks like a bug, then tell the owner instead of documenting
|
|
32
|
+
the bug.
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
- Every ```` ```python ```` block needs `title="name.py"` on the fence line,
|
|
37
|
+
unique across README and `docs/`.
|
|
38
|
+
- `tests/docs/test_examples.py` runs blocks in one module, like a reader
|
|
39
|
+
pasting them: add the title as a constant, put it in `TESTED`, and write a
|
|
40
|
+
test that runs it (often after `QUICK_START`) and asserts what the example
|
|
41
|
+
claims (the request sent, the body map, the result).
|
|
42
|
+
- Names the examples may use without defining them: `ModelList`, `Model`,
|
|
43
|
+
`Transcription`, `data`, `chunks`, `session` (see the `examples` fixture).
|
|
44
|
+
- A block that is not meant to run is not a Python block: use `text`.
|
|
45
|
+
|
|
46
|
+
## Checks
|
|
47
|
+
|
|
48
|
+
The examples and the providers' pages need both providers, installed from
|
|
49
|
+
their `master` without their dependencies (they pin another core; the next
|
|
50
|
+
`uv sync` removes them):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv sync --all-groups
|
|
54
|
+
uv pip install --no-deps "aiollm-openai @ git+https://github.com/aiollm-org/aiollm_openai@master" "aiollm-anthropic @ git+https://github.com/aiollm-org/aiollm_anthropic@master"
|
|
55
|
+
uv run --no-sync pytest tests/docs
|
|
56
|
+
uv run --no-sync rumdl check README.md CHANGELOG.md docs
|
|
57
|
+
uv run --no-sync mkdocs build --strict
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
A page about a provider's own methods follows that provider's code: read it
|
|
61
|
+
in its repository. The site is published from `master` and every Monday by
|
|
62
|
+
`.github/workflows/docs.yml`. Report
|
|
63
|
+
in Russian: pages changed, examples added and their tests, checks run.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-api-provider
|
|
3
|
+
description: Add a new AI provider package for aiollm (e.g. OpenRouter, Gemini) in its own repository - api.py with PROVIDER, resolver.py with the error table, client.py with SessionFactory and BaseProviderClient, the first endpoints, the shared contract cases of the test kit and the extension API check, modelled on the echo provider and the two providers. Use it whenever the owner asks to support a new provider or vendor, or asks what adding one would take. A new endpoint of OpenAI or Anthropic is that provider repository's own ai-api-endpoint.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# aiollm provider
|
|
7
|
+
|
|
8
|
+
A provider is a flat package `aiollm_<name>`, published as `aiollm-<name>`,
|
|
9
|
+
in a repository of its own, that takes from the core only the extension API
|
|
10
|
+
(`aiollm/testing/extension_api.json`). The smallest worked example is the
|
|
11
|
+
echo provider of the test kit (`src/aiollm/testing/echo/` and
|
|
12
|
+
`tests/testing/test_echo_contracts.py`); the full ones are
|
|
13
|
+
[aiollm_openai](https://github.com/aiollm-org/aiollm_openai) and
|
|
14
|
+
[aiollm_anthropic](https://github.com/aiollm-org/aiollm_anthropic), whose
|
|
15
|
+
layout, CI and `CLAUDE.md` a new repository copies. The steps are in
|
|
16
|
+
`docs/guide/extending.md` and the conventions in `CLAUDE.md`. Read them
|
|
17
|
+
first - this skill is the order of work and the checks that make a provider
|
|
18
|
+
complete.
|
|
19
|
+
|
|
20
|
+
## 0. Agree first
|
|
21
|
+
|
|
22
|
+
Adding a provider adds a repository, a package and its public surface:
|
|
23
|
+
propose it (`change-proposal`) with what upstream offers (from its
|
|
24
|
+
official OpenAPI file, SDK types and API reference), the auth scheme, error
|
|
25
|
+
format and stream format, which shared resources it will support, and any
|
|
26
|
+
name the core would have to add to the extension API. Code starts on the
|
|
27
|
+
owner's go; the repository, its ruleset and its PyPI publisher are set up
|
|
28
|
+
by the owner.
|
|
29
|
+
|
|
30
|
+
## 1. What the core needs first
|
|
31
|
+
|
|
32
|
+
A name the provider must import and the extension API lacks is added to
|
|
33
|
+
`extension_api.json` in a core pull request first, never imported around
|
|
34
|
+
it. The core's `downstream` job and `tests/downstream/` list the providers
|
|
35
|
+
it checks; a new one is added there once its repository exists.
|
|
36
|
+
|
|
37
|
+
## 2. Repository skeleton
|
|
38
|
+
|
|
39
|
+
Copied from aiollm_openai: `pyproject.toml` (dist `aiollm-<name>`, the core
|
|
40
|
+
pinned to a commit, `aiollm[testing]` in the test group, the `codegen`
|
|
41
|
+
group, ruff's isort section for the core), `src/aiollm_<name>/__meta__.py`,
|
|
42
|
+
`.github/workflows/` (`tests.yml`, `core-master.yml`, `publish.yml`,
|
|
43
|
+
`upstream.yml`), `CHANGES/`, `CLAUDE.md`, `CONTRIBUTING.md` and its skills.
|
|
44
|
+
|
|
45
|
+
## 3. Package (`src/aiollm_<name>/`)
|
|
46
|
+
|
|
47
|
+
1. `api.py`: `BaseAPI(base_url, version)` and `PROVIDER: Final =
|
|
48
|
+
Provider("<name>")` (an open value: nothing changes in the core).
|
|
49
|
+
2. `resolver.py`: `BaseErrorResolver` subclass with `provider = PROVIDER`,
|
|
50
|
+
`error_statuses` (in-band code/type → status), `get_error_code` or
|
|
51
|
+
`classify_status` for codes such as quota vs rate limit; in-band failures
|
|
52
|
+
are never transient.
|
|
53
|
+
3. `client.py`: module-level `session_factory = SessionFactory(AiohttpSession,
|
|
54
|
+
auth_factory=..., api=..., error_resolver=...)`, and a `BaseProviderClient`
|
|
55
|
+
subclass with `provider`, `session_factory`, `api_key_env`, `auth_headers`
|
|
56
|
+
and each resource as `name = bind_resource(Resource[...], Adapter)`
|
|
57
|
+
(`adapter_factory=` for an adapter with options, read from the client);
|
|
58
|
+
`__init__` types `**session_kwargs`, keeps the adapter options and calls
|
|
59
|
+
`super().__init__()`, which builds adapters before the session. The
|
|
60
|
+
generation adapter has `with_options` with the provider's options
|
|
61
|
+
`TypedDict` (`types/options.py`), and the client binds
|
|
62
|
+
`GenerationResource[Raw, Event, Options]`.
|
|
63
|
+
4. `__init__.py` re-exports the client (the one `__init__` allowed to import a
|
|
64
|
+
transport), sorted `__all__`.
|
|
65
|
+
|
|
66
|
+
## 4. First endpoints
|
|
67
|
+
|
|
68
|
+
Types and request parameters generated by aiollm-codegen from the pinned
|
|
69
|
+
upstream schema (`scripts/generate_types.py`), the snapshot of the wire
|
|
70
|
+
contracts (`tests/contracts/`, checked with `aiollm.testing.wire`), the
|
|
71
|
+
hand-written method classes and adapters; the providers' own
|
|
72
|
+
`ai-api-endpoint` skill is the order of work.
|
|
73
|
+
|
|
74
|
+
## 5. Tests
|
|
75
|
+
|
|
76
|
+
- `conftest.py` loads `aiollm.testing.plugin` and names the provider's key
|
|
77
|
+
in `provider_key_envs`.
|
|
78
|
+
- `test_generation_contract.py`, `test_files_contract.py` (when it has a
|
|
79
|
+
Files API: a `BaseFilesAdapter` bound as `files`) and
|
|
80
|
+
`test_client_contract.py`: a case and a subclass of `GenerationContract`,
|
|
81
|
+
`FilesContract` and `ClientContract` of `aiollm.testing.contract`. A
|
|
82
|
+
scenario that would need a branch for the provider gets a case field in
|
|
83
|
+
the core instead; the scenarios never name a provider.
|
|
84
|
+
- `test_extension_api.py`: `check_extension_api("aiollm_<name>") == []`.
|
|
85
|
+
- `test_client.py` keeps only what is the provider's own;
|
|
86
|
+
`typing/check_public_api.py` and `public_api.json` as in the two
|
|
87
|
+
providers.
|
|
88
|
+
|
|
89
|
+
## 6. Docs, release
|
|
90
|
+
|
|
91
|
+
In the core: a `docs/guide/providers.md` section, a reference page and its
|
|
92
|
+
nav entry, a column of `docs/unification.md` for every shared field and error
|
|
93
|
+
case, the README feature list, and the provider in the `lint and types`,
|
|
94
|
+
`downstream` and `docs.yml` installs. In the provider: its README and
|
|
95
|
+
`ai-api-release` fragment. Then `definition-of-done`. Report in Russian.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-api-release
|
|
3
|
+
description: Changelog fragments and releases of aiollm with towncrier - every feature or fix PR adds a fragment to CHANGES/ and never touches the version; a separate release PR picks the SemVer version from the fragments (before 1.0 a breaking change bumps the minor), builds the CHANGELOG section, bumps __meta__.py, README and CLAUDE.md and the compare links. Use it in the aiollm repository whenever a change is about to be committed or put in a PR (to write its fragment), when the owner says «релиз», «выпусти версию», «подними версию», asks which version the pending changes need or what the next release holds. Tags are never created.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# aiollm changelog and releases
|
|
7
|
+
|
|
8
|
+
The project uses towncrier so that parallel pull requests never fight over
|
|
9
|
+
`CHANGELOG.md`: a change carries its own note as a file in `CHANGES/`, and
|
|
10
|
+
only a release turns the notes into a section and moves the version. Two
|
|
11
|
+
jobs, never mixed in one PR: **a change** adds a fragment; **a release**
|
|
12
|
+
consumes them. Max approves each release and pushes the tags himself.
|
|
13
|
+
|
|
14
|
+
## A. Every change: write a fragment
|
|
15
|
+
|
|
16
|
+
When a branch changes anything a user of the library sees (behaviour, a
|
|
17
|
+
public name, an error, a default, docs that state a guarantee, supported
|
|
18
|
+
Pythons), add one fragment per change before the commit:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
uv run towncrier create +<slug>.<type>.md --content "<text>"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- Name: `<PR number>.<type>.md`, or `+<slug>.<type>.md` while the PR does
|
|
25
|
+
not exist (rename it to the number once it does, if the owner wants the
|
|
26
|
+
link; an orphan fragment is fine too).
|
|
27
|
+
- Types, in Keep a Changelog's order: `added`, `changed`, `deprecated`,
|
|
28
|
+
`removed`, `fixed`, `security`.
|
|
29
|
+
- One Markdown paragraph about what a user sees, not file names. A
|
|
30
|
+
breaking change starts with `**Breaking:**` and says how to migrate.
|
|
31
|
+
- Do **not** touch `__meta__.py`, the version lines or `CHANGELOG.md` in a
|
|
32
|
+
change PR.
|
|
33
|
+
|
|
34
|
+
CI's `changelog` job (`towncrier check`) fails a PR that adds no fragment
|
|
35
|
+
and does not change `CHANGELOG.md`. A PR no user would notice (tests, CI,
|
|
36
|
+
internal refactoring, agent files) gets the `no changelog` label instead -
|
|
37
|
+
ask the owner to set it, or say in the PR body that it needs it.
|
|
38
|
+
|
|
39
|
+
Preview what the next release holds: `uv run towncrier build --draft`.
|
|
40
|
+
|
|
41
|
+
## B. A release: only when the owner asks
|
|
42
|
+
|
|
43
|
+
### 1. Pick the version
|
|
44
|
+
|
|
45
|
+
- Start from fresh `master` on a branch `release-X.Y.Z`.
|
|
46
|
+
- Read the current version in `src/aiollm/__meta__.py` and the pending
|
|
47
|
+
fragments (`uv run towncrier build --draft --version next`).
|
|
48
|
+
- Before 1.0: any `**Breaking:**` fragment → **minor** (0.6.0 → 0.7.0);
|
|
49
|
+
otherwise **patch** (0.6.0 → 0.6.1). From 1.0: major/minor/patch.
|
|
50
|
+
- No fragments → nothing to release; say so.
|
|
51
|
+
|
|
52
|
+
### 2. Build and bump
|
|
53
|
+
|
|
54
|
+
- `git add CHANGES` (so towncrier can `git rm` the fragments), then
|
|
55
|
+
`uv run towncrier build --version X.Y.Z --yes`: it writes the section
|
|
56
|
+
below `<!-- towncrier release notes start -->`, under the empty
|
|
57
|
+
`## [Unreleased]`, and deletes the fragments.
|
|
58
|
+
- `uv run rumdl fmt CHANGELOG.md`: towncrier's Markdown template leaves a
|
|
59
|
+
double blank line before the previous release, which rumdl rejects.
|
|
60
|
+
- Compare links at the bottom of `CHANGELOG.md`: `[Unreleased]:
|
|
61
|
+
.../compare/vX.Y.Z...HEAD` and a new `[X.Y.Z]:
|
|
62
|
+
.../compare/v<previous>...vX.Y.Z`.
|
|
63
|
+
- `src/aiollm/__meta__.py`: `__version__ = "X.Y.Z"`.
|
|
64
|
+
- `README.md`: the status line `> **Status: pre-alpha (X.Y.Z).**`.
|
|
65
|
+
- `CLAUDE.md`: `pre-alpha (X.Y.Z)` in the Project section.
|
|
66
|
+
|
|
67
|
+
The files are CRLF on the owner's PC; edit them with the Edit tool, which
|
|
68
|
+
keeps line endings.
|
|
69
|
+
|
|
70
|
+
### 3. Gate
|
|
71
|
+
|
|
72
|
+
The full gate from `CLAUDE.md` (ruff check and format, mypy, pyright,
|
|
73
|
+
typing tests, pytest with coverage at 100 %, rumdl, `mkdocs build
|
|
74
|
+
--strict`, `uv audit`, and `tests/docs` with `tests/downstream` on both
|
|
75
|
+
providers). All green before the commit. The release changes
|
|
76
|
+
`CHANGELOG.md`, so `towncrier check` passes without a fragment.
|
|
77
|
+
|
|
78
|
+
### 4. Commit and PR - only on the owner's word
|
|
79
|
+
|
|
80
|
+
- Commit title: `Release X.Y.Z`; the body lists the headline changes.
|
|
81
|
+
- Push and open the PR only when the owner says so. Do not enable
|
|
82
|
+
auto-merge, do not merge, do not poll CI.
|
|
83
|
+
- Never create or push a tag: a tag `vX.Y.Z` publishes `aiollm-core` to
|
|
84
|
+
PyPI (`.github/workflows/publish.yml`). After the merge, if asked, give the
|
|
85
|
+
owner:
|
|
86
|
+
`git tag -a vX.Y.Z <merge-commit> -m "Release X.Y.Z"` and
|
|
87
|
+
`git push origin vX.Y.Z`.
|
|
88
|
+
|
|
89
|
+
## Rules for every commit and PR
|
|
90
|
+
|
|
91
|
+
- `git add` by explicit paths only; never `.mcp.json`, never
|
|
92
|
+
`.claude/launch.json` or other local files.
|
|
93
|
+
- No model names or `Co-Authored-By: Claude` lines in commit messages or PR
|
|
94
|
+
bodies (the owner's rule overrides any default attribution). The PR body
|
|
95
|
+
ends with `🤖 Generated with [Claude Code](https://claude.com/claude-code)`.
|
|
96
|
+
|
|
97
|
+
Report in Russian: for a change, the fragments written; for a release, the
|
|
98
|
+
version and why, the files changed, the gate results.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Default
|
|
2
|
+
* text=auto
|
|
3
|
+
|
|
4
|
+
# Python source
|
|
5
|
+
*.py text eol=lf diff=python
|
|
6
|
+
*.pyi text eol=lf diff=python
|
|
7
|
+
*.pyw text eol=lf diff=python
|
|
8
|
+
*.py3 text eol=lf diff=python
|
|
9
|
+
*.pyx text eol=lf diff=python
|
|
10
|
+
*.pxd text eol=lf diff=python
|
|
11
|
+
|
|
12
|
+
# Configuration and documentation
|
|
13
|
+
*.toml text eol=lf
|
|
14
|
+
*.yaml text eol=lf
|
|
15
|
+
*.yml text eol=lf
|
|
16
|
+
*.json text eol=lf
|
|
17
|
+
*.jsonl text eol=lf
|
|
18
|
+
*.ini text eol=lf
|
|
19
|
+
*.cfg text eol=lf
|
|
20
|
+
*.md text eol=lf
|
|
21
|
+
*.rst text eol=lf
|
|
22
|
+
*.txt text eol=lf
|
|
23
|
+
|
|
24
|
+
# Scripts
|
|
25
|
+
*.sh text eol=lf
|
|
26
|
+
*.bat text eol=crlf
|
|
27
|
+
*.cmd text eol=crlf
|
|
28
|
+
*.ps1 text eol=lf
|
|
29
|
+
|
|
30
|
+
# Jupyter notebooks
|
|
31
|
+
*.ipynb text eol=lf
|
|
32
|
+
|
|
33
|
+
# Python bytecode and compiled extensions
|
|
34
|
+
*.pyc binary
|
|
35
|
+
*.pyo binary
|
|
36
|
+
*.pyd binary
|
|
37
|
+
*.so binary
|
|
38
|
+
*.dll binary
|
|
39
|
+
*.dylib binary
|
|
40
|
+
|
|
41
|
+
# Serialized objects and databases
|
|
42
|
+
*.p binary
|
|
43
|
+
*.pkl binary
|
|
44
|
+
*.pickle binary
|
|
45
|
+
*.db binary
|
|
46
|
+
*.sqlite binary
|
|
47
|
+
*.sqlite3 binary
|
|
48
|
+
|
|
49
|
+
# Archives and distributions
|
|
50
|
+
*.pyz binary
|
|
51
|
+
*.zip binary
|
|
52
|
+
*.whl binary
|
|
53
|
+
*.gz binary
|
|
54
|
+
*.tar binary
|
|
55
|
+
*.7z binary
|
|
56
|
+
|
|
57
|
+
# Images
|
|
58
|
+
*.png binary
|
|
59
|
+
*.jpg binary
|
|
60
|
+
*.jpeg binary
|
|
61
|
+
*.gif binary
|
|
62
|
+
*.webp binary
|
|
63
|
+
*.ico binary
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
# Weekly too: the reference pages of the providers are built from
|
|
7
|
+
# their master, which moves without a push here.
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "0 7 * * 1"
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: pages
|
|
19
|
+
cancel-in-progress: false
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
build:
|
|
23
|
+
name: build the site
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v7
|
|
27
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
28
|
+
with:
|
|
29
|
+
enable-cache: true
|
|
30
|
+
- run: uv sync --group docs --locked
|
|
31
|
+
# The providers, from their master and without their dependencies
|
|
32
|
+
# (which pin another core): the site documents them.
|
|
33
|
+
- run: >-
|
|
34
|
+
uv pip install --no-deps
|
|
35
|
+
"aiollm-openai @ git+https://github.com/aiollm-org/aiollm_openai@master"
|
|
36
|
+
"aiollm-anthropic @ git+https://github.com/aiollm-org/aiollm_anthropic@master"
|
|
37
|
+
- run: uv run --no-sync mkdocs build --strict
|
|
38
|
+
env:
|
|
39
|
+
NO_MKDOCS_2_WARNING: "1"
|
|
40
|
+
- uses: actions/upload-pages-artifact@v5
|
|
41
|
+
with:
|
|
42
|
+
path: site
|
|
43
|
+
|
|
44
|
+
deploy:
|
|
45
|
+
name: deploy to GitHub Pages
|
|
46
|
+
needs: build
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
environment:
|
|
49
|
+
name: github-pages
|
|
50
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
51
|
+
steps:
|
|
52
|
+
- id: deployment
|
|
53
|
+
uses: actions/deploy-pages@v5
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
# A tag v<version> publishes that version to PyPI through trusted
|
|
4
|
+
# publishing (no token): the pypi environment of this repository and the
|
|
5
|
+
# pending publisher on pypi.org name this workflow. Tags are set by the
|
|
6
|
+
# maintainer only.
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags: ["v*"]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
name: build
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
21
|
+
- name: The tag is the package's version
|
|
22
|
+
run: |
|
|
23
|
+
version=$(uv run --no-project python -c "import runpy; print(runpy.run_path('src/aiollm/__meta__.py')['__version__'])")
|
|
24
|
+
test "v$version" = "$GITHUB_REF_NAME"
|
|
25
|
+
- run: uv build
|
|
26
|
+
- uses: actions/upload-artifact@v7
|
|
27
|
+
with:
|
|
28
|
+
name: dist
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish:
|
|
32
|
+
name: publish
|
|
33
|
+
needs: [build]
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
environment: pypi
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/download-artifact@v7
|
|
40
|
+
with:
|
|
41
|
+
name: dist
|
|
42
|
+
path: dist/
|
|
43
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
# labeled/unlabeled too, so a "no changelog" label added after the
|
|
8
|
+
# pull request opened reaches the changelog check.
|
|
9
|
+
types: [opened, synchronize, reopened, labeled, unlabeled]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
checks:
|
|
20
|
+
name: lint and types
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
- run: uv sync --all-groups --locked
|
|
28
|
+
# The providers, from their master and without their dependencies
|
|
29
|
+
# (which pin another core): pyright reads tests/docs and the site
|
|
30
|
+
# documents them.
|
|
31
|
+
- run: >-
|
|
32
|
+
uv pip install --no-deps
|
|
33
|
+
"aiollm-openai @ git+https://github.com/aiollm-org/aiollm_openai@master"
|
|
34
|
+
"aiollm-anthropic @ git+https://github.com/aiollm-org/aiollm_anthropic@master"
|
|
35
|
+
- run: uv run --no-sync ruff check src tests
|
|
36
|
+
- run: uv run --no-sync ruff format --check src tests
|
|
37
|
+
- run: uv run --no-sync mypy src
|
|
38
|
+
- run: uv run --no-sync pyright
|
|
39
|
+
- run: uv run --no-sync pytest --mypy -m mypy tests/typing
|
|
40
|
+
- run: >-
|
|
41
|
+
uv run --no-sync rumdl check
|
|
42
|
+
README.md CHANGELOG.md CONTRIBUTING.md docs
|
|
43
|
+
- run: uv run --no-sync mkdocs build --strict
|
|
44
|
+
env:
|
|
45
|
+
NO_MKDOCS_2_WARNING: "1"
|
|
46
|
+
|
|
47
|
+
test-matrix:
|
|
48
|
+
name: tests (${{ matrix.os }}, ${{ matrix.python }})
|
|
49
|
+
runs-on: ${{ matrix.os }}
|
|
50
|
+
strategy:
|
|
51
|
+
fail-fast: false
|
|
52
|
+
matrix:
|
|
53
|
+
os: [ubuntu-latest, windows-latest]
|
|
54
|
+
# Every CPython the package supports (requires-python >= 3.13);
|
|
55
|
+
# 3.13, the oldest, is also what .python-version pins locally.
|
|
56
|
+
python: ["3.13", "3.14", "3.15"]
|
|
57
|
+
env:
|
|
58
|
+
# For every uv command of the job: with only `uv sync --python`,
|
|
59
|
+
# `uv run` would take .python-version's 3.13 and rebuild the
|
|
60
|
+
# environment without the test group.
|
|
61
|
+
UV_PYTHON: ${{ matrix.python }}
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v7
|
|
64
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
65
|
+
with:
|
|
66
|
+
enable-cache: true
|
|
67
|
+
- run: uv sync --all-groups --locked
|
|
68
|
+
- run: >-
|
|
69
|
+
uv run pytest --cov --cov-branch --cov-report=xml
|
|
70
|
+
--html=report.html --self-contained-html
|
|
71
|
+
- uses: actions/upload-artifact@v7
|
|
72
|
+
if: always()
|
|
73
|
+
with:
|
|
74
|
+
name: test-report-${{ matrix.os }}-${{ matrix.python }}
|
|
75
|
+
path: |
|
|
76
|
+
coverage.xml
|
|
77
|
+
report.html
|
|
78
|
+
|
|
79
|
+
tests:
|
|
80
|
+
# One stable name for the branch ruleset, whatever the matrix holds.
|
|
81
|
+
name: tests
|
|
82
|
+
if: always()
|
|
83
|
+
needs: [test-matrix]
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
steps:
|
|
86
|
+
- run: test "${{ needs.test-matrix.result }}" = "success"
|
|
87
|
+
|
|
88
|
+
package:
|
|
89
|
+
name: package
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@v7
|
|
93
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
94
|
+
- run: uv build
|
|
95
|
+
- name: Install the wheel into a clean environment and import it
|
|
96
|
+
run: |
|
|
97
|
+
uv venv --python 3.13 .wheel-env
|
|
98
|
+
uv pip install --python .wheel-env dist/*.whl
|
|
99
|
+
.wheel-env/bin/python - <<'EOF'
|
|
100
|
+
from importlib.metadata import version
|
|
101
|
+
|
|
102
|
+
import sys
|
|
103
|
+
|
|
104
|
+
import aiollm
|
|
105
|
+
|
|
106
|
+
assert aiollm.__version__ == version("aiollm-core"), (
|
|
107
|
+
aiollm.__version__,
|
|
108
|
+
version("aiollm-core"),
|
|
109
|
+
)
|
|
110
|
+
# The core loads no transport and no provider on import.
|
|
111
|
+
loaded = [
|
|
112
|
+
name
|
|
113
|
+
for name in sys.modules
|
|
114
|
+
if name == "aiohttp" or name.startswith("aiollm_")
|
|
115
|
+
]
|
|
116
|
+
assert loaded == [], loaded
|
|
117
|
+
print("aiollm-core", aiollm.__version__, "imports from its wheel")
|
|
118
|
+
EOF
|
|
119
|
+
|
|
120
|
+
downstream:
|
|
121
|
+
# The providers on this core: each provider's own suite, with the
|
|
122
|
+
# core of this branch in place of its pin, then the core's examples
|
|
123
|
+
# of the site and the extension API check, with both providers
|
|
124
|
+
# installed. Required unless the pull request is a breaking change
|
|
125
|
+
# (a "**Breaking:**" fragment), which the providers follow in their
|
|
126
|
+
# own pull requests (CONTRIBUTING.md).
|
|
127
|
+
name: downstream (${{ matrix.provider }})
|
|
128
|
+
runs-on: ubuntu-latest
|
|
129
|
+
strategy:
|
|
130
|
+
fail-fast: false
|
|
131
|
+
matrix:
|
|
132
|
+
provider: [openai, anthropic]
|
|
133
|
+
steps:
|
|
134
|
+
- uses: actions/checkout@v7
|
|
135
|
+
with:
|
|
136
|
+
path: core
|
|
137
|
+
- uses: actions/checkout@v7
|
|
138
|
+
with:
|
|
139
|
+
repository: aiollm-org/aiollm_${{ matrix.provider }}
|
|
140
|
+
path: provider
|
|
141
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
142
|
+
- name: The provider's tests on this core
|
|
143
|
+
working-directory: provider
|
|
144
|
+
run: |
|
|
145
|
+
uv sync --all-groups --no-group codegen --locked
|
|
146
|
+
# The pinned core goes, whatever its distribution name.
|
|
147
|
+
uv pip uninstall aiollm aiollm-core
|
|
148
|
+
uv pip install -e "../core[testing]"
|
|
149
|
+
uv run --no-sync pytest -q
|
|
150
|
+
- name: The core's examples and extension API with the providers
|
|
151
|
+
working-directory: core
|
|
152
|
+
run: |
|
|
153
|
+
uv sync --all-groups --locked
|
|
154
|
+
uv pip install --no-deps \
|
|
155
|
+
"aiollm-openai @ git+https://github.com/aiollm-org/aiollm_openai@master" \
|
|
156
|
+
"aiollm-anthropic @ git+https://github.com/aiollm-org/aiollm_anthropic@master"
|
|
157
|
+
uv run --no-sync pytest -q tests/docs tests/downstream
|
|
158
|
+
|
|
159
|
+
changelog:
|
|
160
|
+
# A pull request adds a fragment to CHANGES/ (or, for a release,
|
|
161
|
+
# changes CHANGELOG.md itself); the "no changelog" label skips the
|
|
162
|
+
# check for a change no user sees.
|
|
163
|
+
name: changelog
|
|
164
|
+
if: >-
|
|
165
|
+
github.event_name == 'pull_request'
|
|
166
|
+
&& !contains(github.event.pull_request.labels.*.name, 'no changelog')
|
|
167
|
+
runs-on: ubuntu-latest
|
|
168
|
+
steps:
|
|
169
|
+
- uses: actions/checkout@v7
|
|
170
|
+
with:
|
|
171
|
+
fetch-depth: 0
|
|
172
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
173
|
+
- run: >-
|
|
174
|
+
uv run --locked --only-group dev
|
|
175
|
+
towncrier check --compare-with origin/${{ github.base_ref }}
|
|
176
|
+
|
|
177
|
+
audit:
|
|
178
|
+
name: audit
|
|
179
|
+
runs-on: ubuntu-latest
|
|
180
|
+
steps:
|
|
181
|
+
- uses: actions/checkout@v7
|
|
182
|
+
- uses: astral-sh/setup-uv@v10.3.3
|
|
183
|
+
# Known vulnerabilities in every locked dependency, dev tools too.
|
|
184
|
+
# An exception is an --ignore <ID> with its reason in a comment
|
|
185
|
+
# (rule, reason, scope, owner, review condition: manifest §18).
|
|
186
|
+
- run: uv audit --locked --preview-features audit-command
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
|
|
12
|
+
# Local secrets (API keys for live runs)
|
|
13
|
+
.env
|
|
14
|
+
|
|
15
|
+
# The documentation site, built by mkdocs
|
|
16
|
+
site/
|
|
17
|
+
|
|
18
|
+
# Local agent and editor configuration
|
|
19
|
+
.mcp.json
|
|
20
|
+
.claude/settings.local.json
|
|
21
|
+
.claude/launch.json
|
|
22
|
+
.claude/worktrees/
|
|
23
|
+
.vscode/
|
|
24
|
+
|
|
25
|
+
.pytest_cache/
|
|
26
|
+
.mypy_cache/
|
|
27
|
+
.ruff_cache/
|
|
28
|
+
.import_linter_cache/
|
|
29
|
+
.coverage
|
|
30
|
+
.coverage.*
|
|
31
|
+
coverage.xml
|
|
32
|
+
coverage.json
|
|
33
|
+
htmlcov/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Install once: uv run pre-commit install
|
|
2
|
+
# mypy is manual (compiled mypy is blocked on some Windows machines):
|
|
3
|
+
# uv run pre-commit run mypy --hook-stage manual --all-files
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
+
rev: v6.0.0
|
|
7
|
+
hooks:
|
|
8
|
+
- id: trailing-whitespace
|
|
9
|
+
args: [--markdown-linebreak-ext=md]
|
|
10
|
+
- id: end-of-file-fixer
|
|
11
|
+
- id: check-yaml
|
|
12
|
+
- id: check-toml
|
|
13
|
+
- id: check-merge-conflict
|
|
14
|
+
- id: check-case-conflict
|
|
15
|
+
- id: check-added-large-files
|
|
16
|
+
|
|
17
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
18
|
+
rev: 0.13.6
|
|
19
|
+
hooks:
|
|
20
|
+
- id: uv-lock
|
|
21
|
+
|
|
22
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
23
|
+
rev: v0.17.3
|
|
24
|
+
hooks:
|
|
25
|
+
# Python only: ruff would also reformat code blocks in README.md.
|
|
26
|
+
- id: ruff-check
|
|
27
|
+
args: [--fix]
|
|
28
|
+
types_or: [python, pyi]
|
|
29
|
+
- id: ruff-format
|
|
30
|
+
types_or: [python, pyi]
|
|
31
|
+
|
|
32
|
+
- repo: local
|
|
33
|
+
hooks:
|
|
34
|
+
- id: pyright
|
|
35
|
+
name: pyright
|
|
36
|
+
entry: uv run --frozen pyright
|
|
37
|
+
language: system
|
|
38
|
+
types: [python]
|
|
39
|
+
pass_filenames: false
|
|
40
|
+
- id: mypy
|
|
41
|
+
name: mypy
|
|
42
|
+
entry: uv run --frozen mypy src
|
|
43
|
+
language: system
|
|
44
|
+
types: [python]
|
|
45
|
+
pass_filenames: false
|
|
46
|
+
stages: [manual]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|