Skip to content

Mark package as typed - #899

Merged
vgvoleg merged 4 commits into
ydb-platform:mainfrom
0x4e3:typing-fixes
Sep 15, 2026
Merged

vgvoleg merged 4 commits into
ydb-platform:mainfrom
0x4e3:typing-fixes

Conversation

@0x4e3

@0x4e3 0x4e3 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Pull request type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The package does not include a PEP 561 py.typed marker, so type checkers do not use the SDK's inline type annotations when it is installed as a dependency.

Issue Number: #896

What is the new behavior?

The package is marked as typed according to PEP 561. The py.typed marker is included in both wheel and source distributions, allowing type checkers to use the SDK's inline annotations.

The PR also enables stricter mypy checks for implicit optional types and untyped decorators, and fixes the affected annotations.

Other information

There are no runtime behavior changes.

Verified with:

  • tox -e mypy
  • tox -e black
  • tox -e style
  • tox -e py -- ydb -v
  • Wheel and source distribution builds
  • Strict mypy checking from a separate project using the built wheel

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.62%. Comparing base (aa3e16b) to head (f45484d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #899      +/-   ##
==========================================
+ Coverage   82.61%   82.62%   +0.01%     
==========================================
  Files          99       99              
  Lines       12939    12945       +6     
  Branches     1268     1268              
==========================================
+ Hits        10689    10696       +7     
  Misses       1798     1798              
+ Partials      452      451       -1     
Flag Coverage Δ
integration 80.45% <100.00%> (+0.01%) ⬆️
unit 48.88% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ydb/_utilities.py 79.68% <100.00%> (+0.08%) ⬆️
ydb/aio/query/session.py 93.10% <ø> (ø)
ydb/aio/table.py 80.42% <100.00%> (ø)
ydb/observability/metrics.py 96.40% <100.00%> (+<0.01%) ⬆️
ydb/query/base.py 95.26% <100.00%> (+0.02%) ⬆️
ydb/query/session.py 92.95% <ø> (ø)
ydb/query/transaction.py 90.29% <100.00%> (+0.04%) ⬆️
ydb/retries.py 90.83% <100.00%> (+0.07%) ⬆️
ydb/table.py 66.87% <100.00%> (+0.02%) ⬆️
ydb/topic.py 86.01% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Automated coverage is missing for the wheel and source-distribution packaging contract.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Marks the SDK as PEP 561 typed and strengthens static type checking.

Changes:

  • Packages py.typed in wheels and source distributions.
  • Enables stricter mypy checks and corrects affected annotations.
  • Preserves decorated function signatures and updates the changelog.
File summaries
File Description
CHANGELOG.md Records typed-package support.
MANIFEST.in Includes the marker in source distributions.
pyproject.toml Strengthens mypy configuration.
setup.py Packages the marker and adds the typing classifier.
ydb/py.typed Declares PEP 561 support.
ydb/_utilities.py Preserves decorator signatures.
ydb/retries.py Types retry decorators generically.
ydb/table.py Corrects table client annotations.
ydb/topic.py Makes optional metadata explicit.
ydb/observability/metrics.py Preserves metrics decorator signatures.
ydb/query/base.py Types the session decorator and nullable RPC state.
ydb/query/session.py Corrects optional query arguments.
ydb/query/transaction.py Types the transaction decorator.
ydb/aio/table.py Corrects optional async table arguments.
ydb/aio/query/session.py Mirrors query annotation fixes asynchronously.
Review details
  • Files reviewed: 14/15 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread setup.py
@vgvoleg
vgvoleg enabled auto-merge (squash) September 15, 2026 13:46
@vgvoleg
vgvoleg merged commit da1c84b into ydb-platform:main Sep 15, 2026
31 checks passed
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.

3 participants