Skip to content

remove object base class, replace typing aliases - #885

Open
Khabib73 wants to merge 8 commits into
ydb-platform:mainfrom
Khabib73:issue/#884
Open

remove object base class, replace typing aliases#885
Khabib73 wants to merge 8 commits into
ydb-platform:mainfrom
Khabib73:issue/#884

Conversation

@Khabib73

@Khabib73 Khabib73 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

These are not all the changes. I've kept it to the typing cleanup for now and will follow up with the rest separately. (to avoid making the diff too large)

Pull request type

Please check the type of change your PR introduces:

  • 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?

Issue Number: #884

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.35%. Comparing base (0b97adb) to head (1e0e057).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #885      +/-   ##
==========================================
+ Coverage   82.33%   82.35%   +0.01%     
==========================================
  Files          99       99              
  Lines       12750    12746       -4     
  Branches     1242     1250       +8     
==========================================
- Hits        10498    10497       -1     
+ Misses       1798     1795       -3     
  Partials      454      454              
Flag Coverage Δ
integration 80.18% <100.00%> (-0.03%) ⬇️
unit 48.54% <85.09%> (+0.15%) ⬆️

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

Files with missing lines Coverage Δ
ydb/_apis.py 100.00% <100.00%> (ø)
ydb/_errors.py 90.62% <100.00%> (-0.29%) ⬇️
ydb/_session_impl.py 61.11% <100.00%> (ø)
ydb/_sp_impl.py 54.54% <100.00%> (ø)
ydb/_tx_ctx_impl.py 91.12% <100.00%> (ø)
ydb/_typing.py 100.00% <100.00%> (ø)
ydb/_utilities.py 78.80% <100.00%> (ø)
ydb/aio/_utilities.py 85.45% <100.00%> (-0.14%) ⬇️
ydb/aio/connection.py 89.65% <100.00%> (ø)
ydb/aio/coordination/client.py 100.00% <100.00%> (ø)
... and 42 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Khabib73
Khabib73 marked this pull request as draft August 27, 2026 10:50
@Khabib73
Khabib73 marked this pull request as ready for review August 27, 2026 11:37
@vgvoleg
vgvoleg requested a balanced review from Copilot August 27, 2026 11:48

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.

Pull request overview

Modernizes legacy Python syntax for issue #884 without intended runtime changes.

Changes:

  • Replaces typing collection aliases with built-in generics.
  • Removes redundant Python 2-era object inheritance.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ydb/tracing.py Modernizes tracing annotations.
ydb/topic.py Modernizes topic API annotations.
ydb/table.py Modernizes table classes and annotations.
ydb/settings.py Modernizes header annotation.
ydb/scripting.py Removes redundant object bases.
ydb/scheme.py Removes redundant object bases.
ydb/resolver.py Modernizes resolver classes.
ydb/query/session.py Modernizes explain return type.
ydb/query/pool.py Modernizes query pool return types.
ydb/query/base.py Modernizes callback storage annotation.
ydb/pool.py Modernizes pool annotations.
ydb/observability/metrics.py Modernizes metrics annotations.
ydb/import_client.py Removes redundant object base.
ydb/export.py Removes redundant object base.
ydb/driver.py Modernizes driver class and annotations.
ydb/credentials.py Removes redundant object base.
ydb/connection.py Modernizes connection classes and annotations.
ydb/_utilities.py Modernizes utility classes and annotations.
ydb/_typing.py Modernizes the RPC argument tuple alias.
ydb/_tx_ctx_impl.py Removes redundant object base.
ydb/_sp_impl.py Removes redundant object base.
ydb/_session_impl.py Removes redundant object bases.
ydb/_apis.py Modernizes service descriptor classes.
Suppressed comments (2)

ydb/table.py:1501

  • The matching public async method still declares rename_items as List[Tuple[str, str]] at ydb/aio/table.py:387-390. Please mirror this annotation cleanup in the async API so sync and async signatures remain aligned.
        rename_items: list[tuple[str, str]],

ydb/query/pool.py:302

  • The async explain_with_retries counterpart still returns Union[str, Dict[str, Any]] at ydb/aio/query/pool.py:246-253. Please mirror this conversion in the async method so runtime annotations and the sync/async public APIs remain consistent.
    ) -> Union[str, dict[str, Any]]:

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

Comment thread ydb/table.py Outdated
Comment on lines +1361 to +1365
add_columns: Optional[list["ydb.Column"]] = None,
drop_columns: Optional[list[str]] = None,
settings: Optional["settings_impl.BaseRequestSettings"] = None,
alter_attributes: Optional[Optional[Dict[str, str]]] = None,
add_indexes: Optional[List["ydb.TableIndex"]] = None,
drop_indexes: Optional[List[str]] = None,
alter_attributes: Optional[Optional[dict[str, str]]] = None,
add_indexes: Optional[list["ydb.TableIndex"]] = None,
Comment thread ydb/table.py
def copy_tables(
self,
source_destination_pairs: List[Tuple[str, str]],
source_destination_pairs: list[tuple[str, str]],
Comment thread ydb/query/session.py Outdated
*,
result_format: QueryExplainResultFormat = QueryExplainResultFormat.STR,
) -> Union[str, Dict[str, Any]]:
) -> Union[str, dict[str, Any]]:
Comment thread ydb/query/pool.py
pool_id: Optional[str] = None,
**kwargs,
) -> List[convert.ResultSet]:
) -> list[convert.ResultSet]:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@Khabib73

Khabib73 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Can you run copilot review again?

@vgvoleg

vgvoleg commented Aug 27, 2026

Copy link
Copy Markdown
Member

I'm ok with huge diff, let's do all refactoring in one PR

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.

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.

@Khabib73

Khabib73 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

@vgvoleg How about replacing Union[T1, T2] with T1 | T2?

@Khabib73

Khabib73 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Also, I think we should replace Optional[T] with T | None since it's the same as Union[T, None]. But it's a big job, so I'm waiting for your confirmation before I start. Does that sound good to you?

@Khabib73

Copy link
Copy Markdown
Contributor Author

@vgvoleg friendly ping :)

@Khabib73 Khabib73 mentioned this pull request Sep 2, 2026
@Khabib73

Khabib73 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@vgvoleg Ready for review

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