-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Remove support for py <3.6, mypy, lots of cleanup #19
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Formally require Python 3.6 or later. This never worked under Python 2.7. - Drop now-unnecessary `__future__` and `six` references. - Use `py.typed` to declare that we support type hints. - Fix a variety of mypy errors. - Don't use star imports, so that other packages can tell if they're making an invalid reference. - Drop support for non-`requests` HTTP clients. - Drop `EngineAPIResource.update`; it could never have worked. Tested against primaryapi and engineapi in staging, and it doesn't break them. After this, `mypy ./openai` runs clean.
- Delete `ListObject`. It has some typing errors that suggest it never worked, and it is unused as far as I can tell. - Delete `VerifyMixin`. It is unused. - Delete `CardError`. It is unused and smells of rotten pasta. - Delete `OpenAIErrorWithParamCode`, which only has one subclass, `InvalidRequestError`, and make `InvalidRequestError` a direct subclass of `OpenAIError`. Currrently, `OpenAIErrorWithParamCode` depends on the internal structure of `InvalidRequestError` so they're not independent.
These are another step towards being able to enforce black, flake8, and mypy on CI.
- Simplify `platform.XXX` calls. As far as I know these can't raise an exception in Python 3. - Simplify `EngineAPIResource` constructor and remove its unused `retrieve` method.
madeleineth
approved these changes
Jun 11, 2021
cgayapr
pushed a commit
to cgayapr/openai-python
that referenced
this pull request
Dec 14, 2024
* python 3.6 + typing (openai#25) - Formally require Python 3.6 or later. This never worked under Python 2.7. - Drop now-unnecessary `__future__` and `six` references. - Use `py.typed` to declare that we support type hints. - Fix a variety of mypy errors. - Don't use star imports, so that other packages can tell if they're making an invalid reference. - Drop support for non-`requests` HTTP clients. - Drop `EngineAPIResource.update`; it could never have worked. Tested against primaryapi and engineapi in staging, and it doesn't break them. After this, `mypy ./openai` runs clean. * delete unused code (openai#27) - Delete `ListObject`. It has some typing errors that suggest it never worked, and it is unused as far as I can tell. - Delete `VerifyMixin`. It is unused. - Delete `CardError`. It is unused and smells of rotten pasta. - Delete `OpenAIErrorWithParamCode`, which only has one subclass, `InvalidRequestError`, and make `InvalidRequestError` a direct subclass of `OpenAIError`. Currrently, `OpenAIErrorWithParamCode` depends on the internal structure of `InvalidRequestError` so they're not independent. * boring formatting and typing fixes (openai#26) These are another step towards being able to enforce black, flake8, and mypy on CI. * fix more typing issues in prep for CI (openai#28) - Simplify `platform.XXX` calls. As far as I know these can't raise an exception in Python 3. - Simplify `EngineAPIResource` constructor and remove its unused `retrieve` method. * Update readme, bump version * typo fix Co-authored-by: Madeleine Thompson <[email protected]> Co-authored-by: Madeleine Thompson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[This is a cherry-pick of all of madeleine's internal changes]