Skip to content

Commit 7bbffde

Browse files
author
CometAPI
committed
chore: initialize CometAPI Python SDK
0 parents  commit 7bbffde

50 files changed

Lines changed: 7314 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Bug report
2+
description: Report a reproducible problem in the supported SDK surface
3+
title: "bug: "
4+
labels:
5+
- bug
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Thank you for reporting a problem. Never include API keys, authorization headers, customer data, or production prompts and responses. Security issues must follow SECURITY.md instead of this public form.
11+
- type: dropdown
12+
id: operation
13+
attributes:
14+
label: Supported operation
15+
options:
16+
- chat.completions.create
17+
- responses.create
18+
- models.list
19+
- Installation or packaging
20+
- Typing or documentation
21+
- Other or inherited OpenAI resource
22+
validations:
23+
required: true
24+
- type: dropdown
25+
id: mode
26+
attributes:
27+
label: Mode
28+
options:
29+
- Synchronous non-streaming
30+
- Synchronous streaming
31+
- Asynchronous non-streaming
32+
- Asynchronous streaming
33+
- Not applicable
34+
validations:
35+
required: true
36+
- type: input
37+
id: versions
38+
attributes:
39+
label: Versions
40+
description: Provide Python, cometapi, and openai versions.
41+
placeholder: "Python 3.13; cometapi 0.1.0a1; openai 2.45.0"
42+
validations:
43+
required: true
44+
- type: input
45+
id: platform
46+
attributes:
47+
label: Operating system
48+
placeholder: "macOS 15, Ubuntu 24.04, or Windows 11"
49+
validations:
50+
required: true
51+
- type: textarea
52+
id: reproduction
53+
attributes:
54+
label: Minimal reproduction
55+
description: Use placeholder credentials and remove sensitive request or response data.
56+
render: python
57+
validations:
58+
required: true
59+
- type: textarea
60+
id: expected
61+
attributes:
62+
label: Expected behavior
63+
validations:
64+
required: true
65+
- type: textarea
66+
id: actual
67+
attributes:
68+
label: Actual behavior
69+
description: Include only sanitized exception types and messages.
70+
validations:
71+
required: true
72+
- type: checkboxes
73+
id: checks
74+
attributes:
75+
label: Safety and scope checks
76+
options:
77+
- label: I removed all credentials, authorization headers, customer data, and private prompts or responses.
78+
required: true
79+
- label: I checked COMPATIBILITY.md and understand that inherited resources outside the tested surface are unsupported.
80+
required: true
81+
- label: This is not a vulnerability report.
82+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Report a vulnerability privately
4+
url: https://github.com/cometapi-dev/cometapi-python/security/advisories/new
5+
about: Use the private security advisory form instead of a public issue.
6+
- name: Private support and conduct contact
7+
url: mailto:support@cometapi.com
8+
about: Email CometAPI for matters that should not be discussed publicly.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Feature request
2+
description: Propose a focused SDK improvement
3+
title: "feat: "
4+
labels:
5+
- enhancement
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Describe the user problem before proposing an API. The 0.1 surface is intentionally narrow; later milestones are tracked in ROADMAP.md.
11+
- type: textarea
12+
id: problem
13+
attributes:
14+
label: User problem
15+
description: What cannot be done reliably with the current supported surface?
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: outcome
20+
attributes:
21+
label: Desired outcome
22+
description: Describe observable behavior rather than only an implementation.
23+
validations:
24+
required: true
25+
- type: dropdown
26+
id: milestone
27+
attributes:
28+
label: Likely scope
29+
options:
30+
- Existing 0.1 supported operation
31+
- Packaging, typing, documentation, or tooling
32+
- Future provider-native adapter
33+
- Future CometAPI-specific resource
34+
- Future media or task API
35+
- Unsure
36+
validations:
37+
required: true
38+
- type: textarea
39+
id: compatibility
40+
attributes:
41+
label: Compatibility considerations
42+
description: Note upstream OpenAI behavior, types, runtime support, or migration impact.
43+
- type: textarea
44+
id: alternatives
45+
attributes:
46+
label: Alternatives considered
47+
- type: checkboxes
48+
id: acknowledgements
49+
attributes:
50+
label: Acknowledgements
51+
options:
52+
- label: I understand that a request does not expand the current 0.1 release scope automatically.
53+
required: true
54+
- label: I did not include credentials, customer data, or private service information.
55+
required: true

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## Summary
2+
3+
Describe the user-visible problem and the smallest complete solution.
4+
5+
## Scope
6+
7+
- Supported operation or repository gate affected:
8+
- Explicit non-goals preserved:
9+
- Compatibility or migration impact:
10+
11+
## Verification
12+
13+
List exact commands and outcomes. Separate passing, failed, skipped, and
14+
unavailable checks.
15+
16+
```text
17+
command -> outcome
18+
```
19+
20+
## Checklist
21+
22+
- [ ] The change stays within the accepted roadmap scope.
23+
- [ ] Public behavior has precise type hints and mocked contract coverage.
24+
- [ ] Documentation, compatibility notes, and changelog are updated when needed.
25+
- [ ] Ruff, formatting, Pyright, pytest, packaging, and relevant repository checks pass.
26+
- [ ] Workflow changes pass the pinned local `actionlint` check.
27+
- [ ] No credential, authorization header, customer data, generated artifact, or local environment is included.
28+
- [ ] No live request, tag, release, publication, or remote setting change was performed without explicit authorization.
29+
- [ ] Missing identity or remote evidence is reported accurately rather than fabricated.
30+
31+
## Maintainer follow-up
32+
33+
List any identity, policy, remote configuration, live-test, or publication
34+
prerequisite that still requires maintainer approval.

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: "04:00"
9+
timezone: Etc/UTC
10+
open-pull-requests-limit: 10
11+
labels:
12+
- dependencies
13+
- python
14+
15+
- package-ecosystem: github-actions
16+
directory: /
17+
schedule:
18+
interval: weekly
19+
day: monday
20+
time: "04:30"
21+
timezone: Etc/UTC
22+
open-pull-requests-limit: 10
23+
labels:
24+
- dependencies
25+
- github-actions

.github/workflows/ci.yml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
schedule:
9+
- cron: "23 4 * * 1"
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: ci-${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
env:
19+
UV_VERSION: 0.11.8
20+
21+
jobs:
22+
quality:
23+
name: Offline quality and workflow checks
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 20
26+
steps:
27+
- name: Check out the candidate
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
- name: Set up Python
30+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
31+
with:
32+
python-version: "3.14"
33+
- name: Install the pinned uv frontend
34+
run: python -m pip install --disable-pip-version-check "uv==$UV_VERSION"
35+
- name: Check lock consistency
36+
run: uv lock --check
37+
- name: Reproduce the locked environment
38+
run: uv sync --locked
39+
- name: Lint
40+
run: uv run ruff check src tests scripts
41+
- name: Check formatting
42+
run: uv run ruff format --check src tests scripts
43+
- name: Type check
44+
run: uv run pyright
45+
- name: Run offline unit and contract tests
46+
run: uv run pytest -m "not live"
47+
- name: Check release version agreement
48+
run: uv run python scripts/check_version.py --expected 0.1.0a1 --require-changelog
49+
- name: Check canonical public content and identity
50+
run: uv run python scripts/check_version.py --require-public-preview-docs
51+
- name: Scan for credentials and scope mistakes
52+
run: uv run python scripts/check_secrets.py
53+
- name: Validate workflow syntax with checksum-pinned actionlint
54+
run: uv run python scripts/run_actionlint.py
55+
- name: Verify release-workflow trust semantics
56+
run: uv run python scripts/check_workflows.py
57+
58+
locked-runtime:
59+
name: Locked dependencies / Python ${{ matrix.python-version }}
60+
runs-on: ubuntu-latest
61+
timeout-minutes: 20
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
66+
steps:
67+
- name: Check out the candidate
68+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
69+
- name: Set up Python
70+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
71+
with:
72+
python-version: ${{ matrix.python-version }}
73+
- name: Install the pinned uv frontend
74+
run: python -m pip install --disable-pip-version-check "uv==$UV_VERSION"
75+
- name: Reproduce the locked environment
76+
run: uv sync --locked
77+
- name: Run offline tests
78+
run: uv run pytest -m "not live"
79+
80+
minimum-openai:
81+
name: Minimum OpenAI / Python 3.10
82+
runs-on: ubuntu-latest
83+
timeout-minutes: 20
84+
steps:
85+
- name: Check out the candidate
86+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
87+
- name: Set up Python
88+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
89+
with:
90+
python-version: "3.10"
91+
- name: Install the pinned uv frontend
92+
run: python -m pip install --disable-pip-version-check "uv==$UV_VERSION"
93+
- name: Create the development environment
94+
run: uv sync --locked
95+
- name: Select the minimum supported OpenAI dependency
96+
run: uv pip install --python .venv/bin/python "openai==2.45.0"
97+
- name: Run offline tests without resyncing the lock
98+
run: uv run --no-sync pytest -m "not live"
99+
100+
latest-openai:
101+
name: Latest OpenAI within major canary
102+
if: github.event_name == 'schedule' || github.actor == 'dependabot[bot]'
103+
runs-on: ubuntu-latest
104+
timeout-minutes: 20
105+
steps:
106+
- name: Check out the candidate
107+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
108+
- name: Set up Python
109+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
110+
with:
111+
python-version: "3.14"
112+
- name: Install the pinned uv frontend
113+
run: python -m pip install --disable-pip-version-check "uv==$UV_VERSION"
114+
- name: Create the development environment
115+
run: uv sync --locked
116+
- name: Select latest OpenAI within the supported major
117+
run: uv pip install --python .venv/bin/python --upgrade "openai>=2.45.0,<3.0.0"
118+
- name: Run canary tests without resyncing the lock
119+
run: uv run --no-sync pytest -m "not live"
120+
121+
package:
122+
name: Build, inspect, and clean-install exact artifacts
123+
needs: [quality, locked-runtime, minimum-openai]
124+
runs-on: ubuntu-latest
125+
timeout-minutes: 25
126+
steps:
127+
- name: Check out the candidate
128+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
129+
- name: Set up Python
130+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
131+
with:
132+
python-version: "3.14"
133+
- name: Install the pinned uv frontend
134+
run: python -m pip install --disable-pip-version-check "uv==$UV_VERSION"
135+
- name: Reproduce the locked environment
136+
run: uv sync --locked
137+
- name: Build wheel and source distribution
138+
run: uv build
139+
- name: Check package metadata rendering
140+
run: uv run twine check dist/*
141+
- name: Inspect artifact identity and shape
142+
run: uv run python scripts/check_artifacts.py dist/*
143+
- name: Install and smoke-test each exact artifact
144+
run: uv run python scripts/check_clean_install.py dist/*
145+
- name: Record immutable artifact digests
146+
run: sha256sum dist/* > artifact-sha256.txt
147+
- name: Retain verified artifacts
148+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
149+
with:
150+
name: python-distributions
151+
path: |
152+
dist/*
153+
artifact-sha256.txt
154+
if-no-files-found: error
155+
retention-days: 7
156+
157+
standalone:
158+
name: Standalone copied-checkout verification
159+
needs: package
160+
runs-on: ubuntu-latest
161+
timeout-minutes: 35
162+
steps:
163+
- name: Check out the candidate
164+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
165+
- name: Set up Python
166+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
167+
with:
168+
python-version: "3.14"
169+
- name: Install the pinned uv frontend
170+
run: python -m pip install --disable-pip-version-check "uv==$UV_VERSION"
171+
- name: Verify from a copied standalone repository
172+
run: python scripts/check_repository_independence.py

0 commit comments

Comments
 (0)