Platform: Add type annotations for primary key types by model [FC-0117]#38308
Platform: Add type annotations for primary key types by model [FC-0117]#38308bradenmacdonald wants to merge 6 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @bradenmacdonald! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
|
||
|
|
||
| # Typed primary key for the StagedContent model / StagedContentData | ||
| StagedContentID = NewType("StagedContentID", int) |
There was a problem hiding this comment.
Note (possibly relevant to OEP-68 recommendations): due to how this module is structured and imported (with the StagedContent model not being part of the API in any way), it was necessary to put the StagedContentID type in data.py. Which makes sense anyways.
There was a problem hiding this comment.
It does make sense. I think it'd be a good convention.
4fc2aad to
b8235af
Compare
9e81ced to
d89a7c0
Compare
d89a7c0 to
dbe8482
Compare
Description
This is the openedx-platform PR related to openedx/openedx-core#534 .
Basically, this new feature in openedx-core lets us use fully-typed primary keys instead of plain
inttypes:This provides a higher level of clarity, documentation, and automated validation.
e.g.
Supporting information
This PR includes some minor drive-by typing fixes, to enable mypy to check a couple more files that it wasn't previously checking.
Testing instructions
This should not have any runtime effects. (Although technically, changing
.pkto.idis a runtime change.)Deadline
Verawood