Skip to content

chore: modernize Union and Optional type hints#1774

Open
jorwoods wants to merge 8 commits into
tableau:developmentfrom
jorwoods:jorwoods/typing_updates
Open

chore: modernize Union and Optional type hints#1774
jorwoods wants to merge 8 commits into
tableau:developmentfrom
jorwoods:jorwoods/typing_updates

Conversation

@jorwoods

Copy link
Copy Markdown
Contributor
  • chore: replace Union with modern syntax
  • chore: modernize Optional type hints

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

This PR modernizes type hints across the codebase by replacing typing.Optional / typing.Union usage with newer annotation syntax (PEP 604 X | Y) and more modern built-in generics (e.g., list[str], dict[str, Any]) in both library code and tests.

Changes:

  • Replace many Optional[T] / Union[A, B] annotations with T | None / A | B.
  • Remove now-unneeded Optional/Union imports where possible and update related docstrings accordingly.
  • Apply these typing updates broadly across endpoints, models, and tests.

Reviewed changes

Copilot reviewed 69 out of 70 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/test_tagging.py Update protocol type hints to `T
test/test_datasource.py Update local variable annotation to `T
test/_utils.py Remove unused Optional import after typing modernization.
tableauserverclient/server/request_options.py Modernize optional annotations in request/export options.
tableauserverclient/server/request_factory.py Modernize request-factory method annotations (params/collections).
tableauserverclient/server/query.py Modernize QuerySet/Slice annotations and remove Optional import.
tableauserverclient/server/pager.py Modernize pager protocol/constructor annotations and remove Union import.
tableauserverclient/server/endpoint/workbooks_endpoint.py Modernize endpoint annotations and file/path type aliases.
tableauserverclient/server/endpoint/webhooks_endpoint.py Modernize endpoint method signature annotations/docstrings.
tableauserverclient/server/endpoint/virtual_connections_endpoint.py Modernize endpoint annotations and Union usage.
tableauserverclient/server/endpoint/views_endpoint.py Modernize endpoint annotations and docstring types.
tableauserverclient/server/endpoint/users_endpoint.py Modernize endpoint annotations and docstring types.
tableauserverclient/server/endpoint/tasks_endpoint.py Modernize endpoint annotations and remove Optional import.
tableauserverclient/server/endpoint/tables_endpoint.py Modernize endpoint annotations and Union usage.
tableauserverclient/server/endpoint/subscriptions_endpoint.py Modernize endpoint annotations and remove Optional import.
tableauserverclient/server/endpoint/sites_endpoint.py Modernize endpoint annotations and remove Optional import.
tableauserverclient/server/endpoint/server_info_endpoint.py Replace Union[T, None] return type with `T
tableauserverclient/server/endpoint/schedules_endpoint.py Modernize endpoint annotations and complex generic unions.
tableauserverclient/server/endpoint/resource_tagger.py Modernize tagger protocol and method signature annotations.
tableauserverclient/server/endpoint/projects_endpoint.py Modernize endpoint annotations and remove Optional import.
tableauserverclient/server/endpoint/permissions_endpoint.py Modernize method signature union types.
tableauserverclient/server/endpoint/oidc_endpoint.py Modernize endpoint/type-alias annotations (OIDC configuration).
tableauserverclient/server/endpoint/metrics_endpoint.py Modernize endpoint annotations and remove Optional import.
tableauserverclient/server/endpoint/linked_tasks_endpoint.py Modernize endpoint annotations and remove old typing imports.
tableauserverclient/server/endpoint/jobs_endpoint.py Modernize overload signatures and union params/timeout type.
tableauserverclient/server/endpoint/groupsets_endpoint.py Modernize endpoint annotations and literal/union types.
tableauserverclient/server/endpoint/groups_endpoint.py Modernize iterable union annotations and docstring return types.
tableauserverclient/server/endpoint/flows_endpoint.py Modernize endpoint annotations and file/path type aliases.
tableauserverclient/server/endpoint/flow_runs_endpoint.py Modernize endpoint annotations (unions/timeout).
tableauserverclient/server/endpoint/favorites_endpoint.py Modernize endpoint method signature annotations.
tableauserverclient/server/endpoint/exceptions.py Modernize exception constructor annotations.
tableauserverclient/server/endpoint/endpoint.py Modernize core endpoint method annotations (requests/options).
tableauserverclient/server/endpoint/dqw_endpoint.py Modernize DQW protocol/endpoint annotations.
tableauserverclient/server/endpoint/default_permissions_endpoint.py Modernize endpoint type aliases and request option types.
tableauserverclient/server/endpoint/datasources_endpoint.py Modernize endpoint annotations and file/path type aliases.
tableauserverclient/server/endpoint/databases_endpoint.py Modernize endpoint annotations and union types.
tableauserverclient/server/endpoint/data_alert_endpoint.py Modernize endpoint annotations and item-or-id unions.
tableauserverclient/server/endpoint/custom_views_endpoint.py Modernize endpoint annotations and file/path type aliases.
tableauserverclient/models/workbook_item.py Modernize model attribute/property annotations and docstrings.
tableauserverclient/models/webhook_item.py Modernize model attribute/property annotations and docstrings.
tableauserverclient/models/virtual_connection_item.py Modernize model attribute/property annotations.
tableauserverclient/models/view_item.py Modernize model attribute/property annotations and docstrings.
tableauserverclient/models/user_item.py Modernize nested Auth class annotations and XML parsing signatures.
tableauserverclient/models/task_item.py Modernize constructor optional params to `T
tableauserverclient/models/tableau_types.py Modernize plural_type signature from Union to `
tableauserverclient/models/tableau_auth.py Modernize credential constructor optional params.
tableauserverclient/models/table_item.py Modernize id property annotation.
tableauserverclient/models/site_item.py Modernize many site model option/attribute annotations.
tableauserverclient/models/schedule_item.py Modernize interval and schedule attribute/property annotations.
tableauserverclient/models/revision_item.py Modernize revision model attribute/property annotations.
tableauserverclient/models/project_item.py Modernize project model annotations and XML parsing signatures.
tableauserverclient/models/permissions_item.py Modernize XML parsing helper signature typing.
tableauserverclient/models/oidc_item.py Modernize OIDC configuration model attribute annotations.
tableauserverclient/models/metric_item.py Modernize metric model attribute/property annotations.
tableauserverclient/models/location_item.py Modernize location model attribute annotations and XML parsing signature.
tableauserverclient/models/linked_tasks_item.py Modernize linked task model attribute annotations.
tableauserverclient/models/job_item.py Modernize job model attribute/property annotations and docstrings.
tableauserverclient/models/groupset_item.py Modernize groupset model annotations.
tableauserverclient/models/group_item.py Modernize group model annotations.
tableauserverclient/models/flow_run_item.py Modernize flow run model annotations and parsing signature.
tableauserverclient/models/flow_item.py Modernize flow model annotations and imports.
tableauserverclient/models/favorites_item.py Modernize favorites XML input type to `str
tableauserverclient/models/extract_item.py Modernize extract model annotations and List -> list.
tableauserverclient/models/datasource_item.py Modernize datasource model attribute/property annotations and docstrings.
tableauserverclient/models/data_freshness_policy_item.py Modernize freshness policy nested types and optional list fields.
tableauserverclient/models/data_alert_item.py Modernize data alert model attribute/property annotations.
tableauserverclient/models/custom_view_item.py Modernize custom view model annotations and helper signature.
tableauserverclient/models/connection_item.py Modernize connection model attribute/property annotations.
tableauserverclient/models/collection_item.py Modernize collection model attribute annotations.
tableauserverclient/bin/_version.py Modernize internal versioneer typing (Dict/List -> dict/list, Optional -> `

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tableauserverclient/server/endpoint/endpoint.py
Comment thread tableauserverclient/server/request_options.py
Comment thread tableauserverclient/server/endpoint/oidc_endpoint.py
Comment thread tableauserverclient/server/endpoint/oidc_endpoint.py
Comment thread tableauserverclient/server/endpoint/groups_endpoint.py
@jorwoods jorwoods force-pushed the jorwoods/typing_updates branch from a5cfd13 to 58de53e Compare June 9, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants