Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@ jobs:
- { python-version: "3.7", os: "ubuntu-22.04", os-label: "Ubuntu" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

uv Python 3.7 support compatibility

💡 Result:

Short answer: uv does NOT support Python 3.7 — it requires Python 3.8 or newer. [1][2]

Sources:

  • uv PyPI / project docs. [1]
  • uv platform/python support (lists supported Python versions: 3.8–3.14). [2]

Remove Python 3.7 from the CI matrix — uv does not support it.

uv requires Python 3.8 or newer. The matrix entry for Python 3.7 on ubuntu-22.04 is incompatible with uv and will cause CI failures.

🤖 Prompt for AI Agents
In @.github/workflows/ci.yml at line 24, Remove the Python 3.7 entry from the CI
job matrix: locate the matrix item that sets python-version: "3.7" (the line
with '- { python-version: "3.7", os: "ubuntu-22.04", os-label: "Ubuntu" }') and
delete or replace it with a supported version (>= "3.8"), ensuring the workflow
matrix only includes Python versions compatible with uv.

steps:
- uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Install Dependencies
run: |
pip install poetry
poetry install
uv sync --all-extras
- name: Build
run: |
poetry build
uv build
- name: Check
run: |
poetry run ruff check cozepy
poetry run ruff format --check
poetry run mypy .
uv run ruff check cozepy
uv run ruff format --check
uv run mypy .
- name: Run tests
run: poetry run pytest --cov --cov-report=xml
run: uv run pytest --cov --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v2.0
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v4
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
python-version: "3.11"
- name: Build package
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ response.wav
temp_response.pcm
runs
integrations
.devbox/
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ active the virtual environment:
source ./.venv/bin/activate
```

We use [Poetry](https://python-poetry.org/) to manage dependencies, you can install it by:
We use [uv](https://docs.astral.sh/uv/) to manage dependencies, you can install it by:

```shell
python -m pip install poetry
curl -LsSf https://astral.sh/uv/install.sh | sh
```

And then install dependencies:

```shell
poetry install
uv sync --all-extras
```

## Pre Commit

```shell
pre-commit install
```
```
2,691 changes: 0 additions & 2,691 deletions poetry.lock

This file was deleted.

73 changes: 42 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
[tool.poetry]
[project]
name = "cozepy"
version = "0.20.0"
description = "OpenAPI SDK for Coze(coze.com/coze.cn)"
authors = ["chyroc <chyroc@bytedance.com>"]
readme = "README.md"
license = "MIT"

[tool.poetry.dependencies]
python = "^3.7"
pydantic = "^2.5.0"
authlib = "^1.2.0"
httpx = [
{ version = "^0.24.0", python = "<3.8" },
{ version = "^0.28.0", python = "^3.8" },
authors = [
{name = "chyroc", email = "chyroc@bytedance.com"}
]
typing-extensions = "^4.3.0"
distro = "^1.9.0"
websockets = [
{ version = "^16.0.0", python = ">=3.10" },
{ version = "^15.0.1", python = ">=3.9,<3.10" },
{ version = "^13.1.0", python = ">=3.8,<3.9" },
{ version = "^11.0.3", python = ">=3.7,<3.8" },
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.7"
dependencies = [
"pydantic>=2.5.0",
"authlib>=1.2.0",
"httpx>=0.24.0,<0.28.0; python_version < '3.8'",
"httpx>=0.28.0; python_version >= '3.8'",
"typing-extensions>=4.3.0",
"distro>=1.9.0",
"websockets>=11.0.3,<13.0.0; python_version >= '3.7' and python_version < '3.8'",
"websockets>=13.1.0,<15.0.0; python_version >= '3.8' and python_version < '3.9'",
"websockets>=15.0.1,<16.0.0; python_version >= '3.9' and python_version < '3.10'",
"websockets>=16.0.0; python_version >= '3.10'",
]

[tool.poetry.group.dev.dependencies]
pytest = "^7.0.0"
pytest-cov = "^4.0.0"
pytest-asyncio = "^0.21.0"
ruff = "^0.6.0"
pre-commit = "^2.9.0"
respx = [
{ version = "^0.21.1", python = "<3.8" },
{ version = "^0.22.0", python = "^3.8" },
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-asyncio>=0.21.0",
"ruff>=0.6.0",
"pre-commit>=2.9.0",
"respx>=0.21.1,<0.22.0; python_version < '3.8'",
"respx>=0.22.0; python_version >= '3.8'",
"mypy>=1.0.0",
]
mypy = "^1.0.0"

[tool.ruff]
line-length = 120
Expand Down Expand Up @@ -65,6 +63,19 @@ exclude_lines = [
"raise NotImplementedError",
]

[tool.hatch.build.targets.sdist]
exclude = [
".devbox/",
".venv*/",
".idea/",
"scripts/",
"debug/",
"integrations/",
]

[tool.hatch.build.targets.wheel]
packages = ["cozepy"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
4 changes: 2 additions & 2 deletions tests/test_api_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_sync_api_apps_list(self, respx_mock):
ids = []
for app in resp:
ids.append(app.id)
assert ids == [f"id_{i+1}" for i in range(total)]
assert ids == [f"id_{i + 1}" for i in range(total)]
total_result = 0
for page in resp.iter_pages():
total_result += 1
Expand Down Expand Up @@ -198,7 +198,7 @@ async def test_async_api_apps_list(self, respx_mock):
ids = []
async for app in resp:
ids.append(app.id)
assert ids == [f"id_{i+1}" for i in range(total)]
assert ids == [f"id_{i + 1}" for i in range(total)]
total_result = 0
async for page in resp.iter_pages():
total_result += 1
Expand Down
4 changes: 2 additions & 2 deletions tests/test_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_sync_workspaces_list_with_user_id_and_coze_account_id(self, respx_mock)
"total_count": total,
"workspaces": [
Workspace(
id=f"id_{idx+1}",
id=f"id_{idx + 1}",
name="name",
icon_url="icon_url",
role_type=WorkspaceRoleType.ADMIN,
Expand Down Expand Up @@ -173,7 +173,7 @@ async def test_async_workspaces_list_with_user_id_and_coze_account_id(self, resp
"total_count": total,
"workspaces": [
Workspace(
id=f"id_{idx+1}",
id=f"id_{idx + 1}",
name="name",
icon_url="icon_url",
role_type=WorkspaceRoleType.ADMIN,
Expand Down
Loading
Loading