Skip to content
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

Stop calling set_context, planned for 3.13 drop #8589

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

DavidCain
Copy link
Contributor

Per the deprecation warnings (which have been raised since DRF 3.11),
set_context() was planned not to be supported in DRF 3.13. I think we
can safely delete it, in favor of requires_context.

Since this represents an API change, maybe it's best slated for 3.14?
(We could alternatively start raising RemovedInDRF314Warning)

From the 3.11 announcement:

Previous our approach to this was that implementations could include a
set_context method, which would be called prior to validation. However
this approach had issues with potential race conditions. We have now
move this approach into a pending deprecation state. It will continue to
function, but will be escalated to a deprecated state in 3.12, and
removed entirely in 3.13.

Why keep RemovedInDRF313Warning around?

It's a bit odd that version 3.13 includes an exception class describing
things which are to be deleted in 3.13, but I've opted to keep the (now
unreferenced) class around, for fear of breaking others' setup.

(For example, if projects have a filterwarnings setup meant to
intercept rest_framework.RemovedInDRF313Warning, an error will be
thrown due to an unresolvable reference).

Per the deprecation warnings (which have been raised since DRF 3.11),
`set_context()` was planned not to be supported in DRF 3.13. I think we
can safely delete it, in favor of `requires_context`.

From the 3.11 announcement:

> Previous our approach to this was that implementations could include a
> `set_context` method, which would be called prior to validation. However
> this approach had issues with potential race conditions. We have now
> move this approach into a pending deprecation state. It will continue to
> function, but will be escalated to a deprecated state in 3.12, and
> removed entirely in 3.13.

Why keep `RemovedInDRF313Warning` around?
=========================================
It's a bit odd that version 3.13 includes an exception class describing
things which are to be deleted in 3.13, but I've opted to keep the (now
unreferenced) class around, for fear of breaking others' setup.

(For example, if projects have a `filterwarnings` setup meant to
intercept `rest_framework.RemovedInDRF313Warning`, an error will be
thrown due to an unresolvable reference).
@tomchristie
Copy link
Member

Since this represents an API change, maybe it's best slated for 3.14?

Great, yup. Well let's start working towards a 3.14 release then.

Thanks!

@tomchristie tomchristie merged commit 8b2cccc into encode:master Aug 8, 2022
@DavidCain DavidCain deleted the dcain-delete-set_context branch September 21, 2022 17:41
DavidCain added a commit to DavidCain/django-rest-framework that referenced this pull request Sep 21, 2022
When DRF 3.14 is released, these exception classes will be meaningless,
so we can delete them (this has always been done).

A previous PR removed the last incidence of `RemovedInDRF313Warning`,
but didn't outright delete the class for fear of shipping a breaking
change: encode#8589
tomchristie pushed a commit that referenced this pull request Sep 22, 2022
When DRF 3.14 is released, these exception classes will be meaningless,
so we can delete them (this has always been done).

A previous PR removed the last incidence of `RemovedInDRF313Warning`,
but didn't outright delete the class for fear of shipping a breaking
change: #8589
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
Per the deprecation warnings (which have been raised since DRF 3.11),
`set_context()` was planned not to be supported in DRF 3.13. I think we
can safely delete it, in favor of `requires_context`.

From the 3.11 announcement:

> Previous our approach to this was that implementations could include a
> `set_context` method, which would be called prior to validation. However
> this approach had issues with potential race conditions. We have now
> move this approach into a pending deprecation state. It will continue to
> function, but will be escalated to a deprecated state in 3.12, and
> removed entirely in 3.13.

Why keep `RemovedInDRF313Warning` around?
=========================================
It's a bit odd that version 3.13 includes an exception class describing
things which are to be deleted in 3.13, but I've opted to keep the (now
unreferenced) class around, for fear of breaking others' setup.

(For example, if projects have a `filterwarnings` setup meant to
intercept `rest_framework.RemovedInDRF313Warning`, an error will be
thrown due to an unresolvable reference).
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
When DRF 3.14 is released, these exception classes will be meaningless,
so we can delete them (this has always been done).

A previous PR removed the last incidence of `RemovedInDRF313Warning`,
but didn't outright delete the class for fear of shipping a breaking
change: encode#8589
# 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.

2 participants