From 8b12aea6c5f929ed05f9cb34ab9d086a4e6e4602 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 3 Oct 2026 04:24:31 +0000 Subject: [PATCH] ci: restore CI with lint, test, and build checks CI was moved to .github/workflows_disabled. Restoring it as-is would fail: - The package could not be installed. pyproject.toml declared the invalid classifier "Operating System :: OS Infrastructure Independent", which hatchling rejects; it is now "OS Independent". - The lint step ran `ruff check .` without ruff being installed, and with no ruff config a current ruff enables rules the code was never written against. ruff is now a dev dependency, and [tool.ruff] selects E and F with a 120-character line length. The one line over that limit in omnibioai/_base.py is wrapped. The new .github/workflows/ci.yml runs ruff and pytest on Python 3.10-3.13 for pushes and pull requests to main, then builds the sdist and wheel and runs twine check. It does not publish: the tag-triggered PyPI and GHCR jobs stay in workflows_disabled. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016nxi4bp7DP1ancERNUUfzj --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ omnibioai/_base.py | 4 ++- pyproject.toml | 15 +++++++++-- 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f3d2c62 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + test: + name: Lint & test (Python ${{ matrix.python-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + + - name: Install + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[dev]" + + - name: Lint + run: ruff check . + + - name: Test + run: pytest -q + + build: + name: Build distributions + runs-on: ubuntu-latest + needs: test + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + + - name: Build and check + run: | + python -m pip install --upgrade pip build twine + python -m build + python -m twine check dist/* diff --git a/omnibioai/_base.py b/omnibioai/_base.py index 797c413..917cf0c 100644 --- a/omnibioai/_base.py +++ b/omnibioai/_base.py @@ -67,7 +67,9 @@ def _parse(self, response: requests.Response) -> Any: if response.status_code == 404: raise ResourceNotFoundError(message, status_code=404, response_body=body, trace_id=trace_id) if response.status_code >= 500: - raise ServiceUnavailableError(message, status_code=response.status_code, response_body=body, trace_id=trace_id) + raise ServiceUnavailableError( + message, status_code=response.status_code, response_body=body, trace_id=trace_id + ) if response.status_code >= 400: raise ValidationError(message, status_code=response.status_code, response_body=body, trace_id=trace_id) diff --git a/pyproject.toml b/pyproject.toml index fb278c9..8ae88e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Infrastructure Independent" + "Operating System :: OS Independent" ] [project.optional-dependencies] @@ -30,7 +30,8 @@ dev = [ "pytest-cov>=5.0", "responses>=0.25", "build>=1.2", - "twine>=5.1" + "twine>=5.1", + "ruff>=0.6" ] [project.urls] @@ -46,6 +47,16 @@ Issues = "https://github.com/man4ish/omnibioai_sdk/issues" # import OmniBioAI`. packages = ["omnibioai", "omnibioai_sdk"] +[tool.ruff] +line-length = 120 +target-version = "py310" + +[tool.ruff.lint] +# pyflakes + pycodestyle errors. Formatting itself is black/isort's job +# (see CONTRIBUTING.md); the explicit selection keeps CI stable when a new +# ruff release changes its default rule set. +select = ["E", "F"] + [tool.pytest.ini_options] testpaths = ["tests"] addopts = [