Skip to content

Add type annotations - #133

Merged
mulkieran merged 1 commit into
stratis-storage:masterfrom
mulkieran:add-type-annotations
Nov 25, 2026
Merged

mulkieran merged 1 commit into
stratis-storage:masterfrom
mulkieran:add-type-annotations

Conversation

@mulkieran

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: the Mulhern <amulhern@amulhern.bos.csb>
Assisted-by: Claude:claude-sonnet-4-5
@mulkieran mulkieran self-assigned this Nov 25, 2026
@mulkieran mulkieran added this to the 0.8.5 milestone Nov 25, 2026
@mulkieran mulkieran moved this to In Review in 2026November Nov 25, 2026
@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/stratis-storage-dbus-python-client-gen-133-copr_pull
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@mulkieran

Copy link
Copy Markdown
Member Author

@coderabbitai Claude added type annotations. Do you have any concerns?

@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
set -o pipefail
echo '--- Pull request metadata ---'
gh api repos/stratis-storage/dbus-python-client-gen/pulls/133 --jq '{title,body,base:.base.ref,base_sha:.base.sha,head:.head.ref,head_sha:.head.sha,changed_files,additions,deletions}'
echo '--- Changed file patches ---'
gh api --paginate repos/stratis-storage/dbus-python-client-gen/pulls/133/files --jq '.[] | "FILE: \(.filename)\nSTATUS: \(.status)\nPATCH:\n\(.patch // "(no patch)")\n"'

Length of output: 7667


Script executed:

#!/bin/bash
set -o pipefail
echo '--- File outlines ---'
for f in src/dbus_python_client_gen/_errors.py src/dbus_python_client_gen/_invokers.py src/dbus_python_client_gen/_version.py tests/_introspect.py tests/test_generated.py; do
  echo "### $f"
  ast-grep outline "$f" --items all 2>&1 || true
done
echo '--- Package and CI configuration filenames ---'
fd -H -t f '(^|/)(pyproject\.toml|setup\.py|setup\.cfg|tox\.ini|mypy\.ini|README.*|\.python-version|.*\.ya?ml)$' | head -100
echo '--- Version, timeout, exception, and annotation references ---'
rg -n -C3 'python_requires|requires-python|Programming Language :: Python|python-version|default_timeout|DPClient(MethodCallContext|MarshallingError|KeywordError|InvocationError)|from __future__ import annotations|mypy|pyright|py\.typed' .
echo '--- Error definitions ---'
cat -n src/dbus_python_client_gen/_errors.py | sed -n '1,210p'
echo '--- Invokers ---'
cat -n src/dbus_python_client_gen/_invokers.py | sed -n '1,400p'
echo '--- Version and generated tests ---'
cat -n src/dbus_python_client_gen/_version.py
cat -n tests/test_generated.py | sed -n '1,180p'

Length of output: 51052


Script executed:

#!/bin/bash
set -o pipefail
echo '--- Configuration outline and content ---'
ast-grep outline pyproject.toml --items all 2>&1 || true
cat -n pyproject.toml | sed -n '1,220p'
echo '--- Workflow and Makefile ---'
cat -n .github/workflows/main.yml | sed -n '1,240p'
cat -n Makefile | sed -n '1,120p'
echo '--- Dependency references ---'
rg -n -C3 'into.dbus.python|xformer\(|xformed_args|DPClientKeywordError|\.expected|\.actual' --glob '!LICENSE' .
echo '--- Check runs for PR head ---'
gh api repos/stratis-storage/dbus-python-client-gen/commits/1f594f17fedbf302f64ad9b8bcd48d4470d06c37/check-runs --jq '.check_runs[] | {name,status,conclusion,html_url,output:.output.summary}' 2>&1 || true
echo '--- Combined commit status ---'
gh api repos/stratis-storage/dbus-python-client-gen/commits/1f594f17fedbf302f64ad9b8bcd48d4470d06c37/status --jq '{state,statuses:[.statuses[]|{context,state,description,target_url}]}' 2>&1 || true

Length of output: 22172


web_search executed:

Find the Python into-dbus-python xformer function documentation or source: what container type does the callable returned by xformer(signature) return? Prefer the stratis-storage project's source and identify versions.

Length of output: 11738


Script executed:

#!/bin/bash
set -o pipefail
echo '--- Tracked package and typing marker files ---'
git ls-files 'src/dbus_python_client_gen/*' '*py.typed' '*.pyi'
echo '--- Packaging configuration and existing keyword error in the base revision ---'
git show c78cfb2636234c9c8e157f0b32f626438cda04de:src/dbus_python_client_gen/_invokers.py | nl -ba | sed -n '310,340p'
echo '--- Error assertions in tests ---'
rg -n -C3 'assertRaises|\.expected\b|\.actual\b|DPClientKeywordError' tests

Length of output: 4402


web_search executed:

For installed Python packages, how does current mypy handle imports from packages without a py.typed marker when inline type annotations exist? Consult the official mypy documentation and PEP 561.

Length of output: 17375


@mulkieran I found two concerns:

  1. Downstream type checking: If these annotations are meant for library users, the package needs a py.typed marker included in the distribution. Without it, mypy normally treats the installed package as untyped. The repository has no marker, and pyproject.toml sets include-package-data = false. See the mypy packaging guidance.

  2. Existing error data bug: In src/dbus_python_client_gen/_invokers.py, Line 334, DPClientKeywordError receives arg_list as expected and param_list as actual. Those values are reversed. This predates the PR. The test checks that the exception is raised, but not its fields.

One runtime change is worth noting: removing the comma at Line 331 changes the exception message from a tuple to a string. That appears consistent with the new message: str annotation, but it changes exception.args[0].

The head commit’s lint, test, coverage, and lowest-supported-Python checks passed in CI. I did not run them locally.

You are interacting with an AI system.

@mulkieran

Copy link
Copy Markdown
Member Author

Thanks @coderabbitai . We aren't in the business of providing type files for these libraries yet, so we'll let that pass. Removing that comma was intentional. That reversal of actual vs. expected has not been noticed ever and has existed since the inception of this library.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@mulkieran Thanks for clarifying. I understand that downstream type support is not a goal yet and that removing the comma was intentional. The expected/actual reversal is a pre-existing issue, separate from the annotation changes.


Learnings added

Learnt from: mulkieran
URL: https://github.com/stratis-storage/dbus-python-client-gen/pull/133

Timestamp: 2026-11-25T23:35:16.879Z
Learning: Within repository "stratis-storage/dbus-python-client-gen": This repository is not currently aiming to provide type information for downstream library users. Do not assume that adding inline annotations requires distributing a `py.typed` marker.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

@mulkieran
mulkieran merged commit c7fe669 into stratis-storage:master Nov 25, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in 2026November Nov 25, 2026
@mulkieran
mulkieran deleted the add-type-annotations branch November 25, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant