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

PLATFORM-366 Fix mypy structural errors for library #97

Merged
merged 6 commits into from
Jan 11, 2024

Conversation

simonwgill
Copy link
Contributor

Describe your changes

  • Adds minimum required structural files to allow this to be a typed library
  • Adds mypy to venv
  • Performs minimal fixes to resolve type errors.
  • Adds informational type checking action

Testing using a git reference to this branch and importing into eks-platform-cdk. This removes the errors from the library being structured badly.

The change will all the null coalescing could have been done another way. The problem was that the argument was being passed directly from a function with optional arguments and a default to a function which required a non-null argument. This change doesn't affect the interface at all, so it's the one I've gone with, but one of the other alternatives of changing the function definitions might be the way forward in the long run..

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have updated the Readme / docs
  • If this is a breaking change, I have discussed the roll-out and roll-back plan with the team(s) and I have provided detailed instructions
  • If it is a core feature, I have added thorough tests

@simonwgill simonwgill requested a review from a team as a code owner January 5, 2024 16:48
@simonwgill simonwgill force-pushed the PLATFORM-366_fix_mypy_structural_errors_for_library branch from 1a9c59a to 15a926f Compare January 8, 2024 09:33
@@ -30,3 +31,9 @@ select = ['E', 'W', 'F', 'C', 'N']
ignore = ['E501']
line-length = 95
exclude = ["ca_cdk_constructs/eks/imports"]

[[tool.mypy.overrides]]
Copy link
Contributor

Choose a reason for hiding this comment

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

why the double square brackets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, that was the example from mypy. Not sure what it's doing in pyproject syntax, but I'll have to have a look

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the TOML table array syntax. It means you can have multiple [[tool.mypy.overrides]] elements, each one setting a different config for different packages.

@simonwgill simonwgill force-pushed the PLATFORM-366_fix_mypy_structural_errors_for_library branch from 15a926f to 0c23cb3 Compare January 9, 2024 14:44
@simonwgill simonwgill requested a review from a team January 9, 2024 14:44
Copy link
Contributor

@michelesr michelesr left a comment

Choose a reason for hiding this comment

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

LGTM

@simonwgill simonwgill force-pushed the PLATFORM-366_fix_mypy_structural_errors_for_library branch from 0c23cb3 to 3b01d88 Compare January 10, 2024 15:50
@simonwgill simonwgill requested review from michelesr and a team January 10, 2024 15:50
Copy link
Contributor

@zhelyan zhelyan left a comment

Choose a reason for hiding this comment

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

Lgtm, sorry it took so long, I just saw it

@simonwgill simonwgill merged commit 162752c into main Jan 11, 2024
9 checks passed
@michelesr michelesr deleted the PLATFORM-366_fix_mypy_structural_errors_for_library branch April 22, 2024 10:23
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