Skip to content

Fixed Python SDK keys to camelCase.#84

Merged
Divkix merged 2 commits into
mainfrom
opencode/issue55-20260511062607
May 11, 2026
Merged

Fixed Python SDK keys to camelCase.#84
Divkix merged 2 commits into
mainfrom
opencode/issue55-20260511062607

Conversation

@opencode-agent
Copy link
Copy Markdown
Contributor

Done. The root cause was that the Python SDK sent source_file / line_number (snake_case) in the JSON payload, while the server reads sourceFile / lineNumber (camelCase).

Changes made:

  1. sdks/python/src/logwell/client.py (lines 114–116)
    Changed dict keys from source_file / line_numbersourceFile / lineNumber when building the log entry that goes to the queue.

  2. sdks/python/src/logwell/types.py (lines 27–28, 36–37)
    Updated the LogEntry TypedDict to use camelCase keys so the public API matches the JSON schema the server expects.

  3. Tests updated to assert on the new camelCase keys:

    • tests/conftest.py
    • tests/unit/test_client.py
    • tests/integration/test_e2e.py

The internal SourceLocation dataclass still uses snake_case (source_file, line_number) since those are Python attributes and only the wire-format keys needed to change.

Verification: All 286 Python SDK unit tests pass.

Closes #55

New%20session%20-%202026-05-11T06%3A26%3A07.162Z
opencode session  |  github run

Co-authored-by: Divkix <Divkix@users.noreply.github.com>
@Divkix
Copy link
Copy Markdown
Owner

Divkix commented May 11, 2026

/oc fix the ci

Co-authored-by: Divkix <Divkix@users.noreply.github.com>
@opencode-agent
Copy link
Copy Markdown
Contributor Author

I found and fixed three CI issues in the Python SDK workflow (sdk-python.yml) that would fail on this PR:

1. ruff format --check failing on queue.py

File: sdks/python/src/logwell/queue.py
queue.py had single quotes (') in four getattr calls, but the project requires double quotes ("). I reformatted the file so the formatter check passes.

2. mypy warning about unsupported Python 3.9

File: sdks/python/pyproject.toml
[tool.mypy] python_version = "3.9" emits a warning because mypy no longer supports 3.9. Bumped it to "3.10".

3. twine check failing on built wheel

File: sdks/python/pyproject.toml
Latest hatchling (≥1.27) generates Metadata-Version 2.4 (PEP 639) which twine check does not yet recognize, causing it to error on license-file fields even with the latest twine. I pinned hatchling<1.27.0 in [build-system] requires and changed license = "MIT" to license = {text = "MIT"} so the wheel builds with Metadata 2.3 and passes validation.

Verification

All Python SDK checks now pass locally:

  • ruff check src tests
  • ruff format --check src tests
  • mypy --strict src
  • python -m pytest tests/unit tests/integration308 passed
  • python -m build && twine check dist/*

New%20session%20-%202026-05-11T08%3A31%3A02.255Z
opencode session  |  github run

@Divkix Divkix merged commit 5c66d41 into main May 11, 2026
19 checks passed
@Divkix Divkix deleted the opencode/issue55-20260511062607 branch May 11, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CRITICAL] Python SDK: source_file/line_number (snake_case) silently dropped by server

1 participant