Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/python imports refactor #2379

Merged
merged 44 commits into from
Mar 22, 2023
Merged

Task/python imports refactor #2379

merged 44 commits into from
Mar 22, 2023

Conversation

samwelkanda
Copy link
Contributor

@samwelkanda samwelkanda commented Mar 9, 2023

What does this PR do?

  1. This PR refactors import mechanism for generated Python code from lazy imports to global and local imports. Using the TYPE_CHECKING variable, we'll have global imports that are only available to IDE's and static type checkers and local imports that will be available during runtime. This approach solves for the dual problem of slow startup time and IDE intellisense.
  2. Updates discriminator methods to include all possible types.
  3. Fixes linter errors in integration tests by re-ordering element hierarchy to follow idiomatic Python.

Generation diff:
microsoft/kiota-samples#1762

fixes #2381
fixes #2380
fixes #2293
fixes #2239
fixes microsoftgraph/msgraph-sdk-python#119
fixes microsoftgraph/msgraph-sdk-python#92
fixes microsoftgraph/msgraph-sdk-python#80
fixes microsoftgraph/msgraph-sdk-python#46

@baywet
Copy link
Member

baywet commented Mar 9, 2023

When you're getting close to completion, can you rebase and remove the suppressions for integration tests that match the issues this PR is closing please?

@samwelkanda samwelkanda requested a review from baywet March 22, 2023 11:55
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/Writers/Python/CodeUsingWriter.cs Outdated Show resolved Hide resolved
baywet
baywet previously approved these changes Mar 22, 2023
@baywet baywet enabled auto-merge (squash) March 22, 2023 13:28
baywet
baywet previously approved these changes Mar 22, 2023
Signed-off-by: Vincent Biret <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

88.3% 88.3% Coverage
0.0% 0.0% Duplication

@baywet baywet merged commit a9a0dd1 into main Mar 22, 2023
@baywet baywet deleted the task/python-imports-refactor branch March 22, 2023 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants