Skip to content

Make inflection package truly optional #9303

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

browniebroke
Copy link
Member

@browniebroke browniebroke commented Mar 18, 2024

Description

Fix #9291

The 3.15 release started to use the inflection package (#8017), but this was neither added as a dependency from DRF nor properly documented.

Since this is only needed for generating the OpenAPI schema (which is deprecated), I don't think it's worth introducing this package as a hard dependency, we can document it like pyyaml and uritemplate.

Since the former solution was 1 3 lines, perhaps we can use it as fallback when inflection isn't installed?

@browniebroke browniebroke changed the title Make inflection package truly optional Make inflection package truly optional Mar 18, 2024
@auvipy auvipy requested a review from tfranzel March 18, 2024 20:24
Copy link
Member

@tfranzel tfranzel left a comment

Choose a reason for hiding this comment

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

Actually I would handle it analog to uritemplate, which does a graceful import and then asserts on it missing during a call.

I don't like this because it is inconsistent with the other optional libs and also silently uses a slightly degraded implementation without anyone noticing.

I think it should be like this:

assert uritemplate, '`uritemplate` must be installed for OpenAPI schema support.'

@browniebroke
Copy link
Member Author

Fair enough

Co-authored-by: T. Franzel <13507857+tfranzel@users.noreply.github.com>
Copy link
Member

@tfranzel tfranzel left a comment

Choose a reason for hiding this comment

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

awesome. thanks @browniebroke

@tfranzel tfranzel merged commit 2f66c29 into encode:master Mar 18, 2024
@browniebroke browniebroke deleted the fix-inflection-optional-package branch March 18, 2024 22:43
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.15 missing package inflection
2 participants