-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add deprecation policy #1857
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
Closed
Closed
Add deprecation policy #1857
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
89ffbec
Add deprecation policy
Kludex df83764
Merge branch 'master' into deprecation-policy
Kludex 9254910
Apply policy on code source
Kludex 9313a89
Merge branch 'master' into deprecation-policy
Kludex 57649e7
Merge branch 'master' into deprecation-policy
tomchristie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Deprecation Policy | ||
|
||
The goal of this policy is to reduce the impact of changes on users and developers of the project by providing | ||
clear guidelines and a well-defined process for deprecating functionalities. This policy applies to both features | ||
and API interfaces. | ||
|
||
This policy describes what Starlette should follow pre-1.0, and what Starlette will follow post-1.0. | ||
|
||
## Starlette Versions | ||
|
||
Starlette follows [Semantic Versioning](https://semver.org/), with some additional constraints. | ||
While we are pre-1.0, we treat any SemVer changes requiring a: | ||
|
||
- **major** bump as a change requiring a **minor** bump. | ||
- **minor** bump as a change requiring a **patch** bump. | ||
|
||
## Deprecation Types | ||
|
||
We'll consider two kinds of deprecations: **Python version** and **feature** deprecations. | ||
|
||
### Python Version Deprecation | ||
|
||
Starlette will aim to support a Python version until the [EOL date of that version](https://endoflife.date/python). | ||
When a Python version reaches EOL, Starlette will drop support for that version in the next minor release. | ||
|
||
!!! warning | ||
Pre-1.0 Starlette will also drop support in the next minor release. | ||
|
||
The drop of Python version support will be documented in the release notes, but the user will **not** be warned it. | ||
|
||
### Feature Deprecation | ||
|
||
Starlette will deprecate a feature in the next minor release after the feature is marked as deprecated. | ||
|
||
The deprecation of a feature needs to be followed by a warning message using `warnings.warn` in the code that | ||
uses the deprecated feature. The warning message should include the version in which the feature will be removed. | ||
|
||
The format of the message should follow: | ||
|
||
> *`code` is deprecated and will be removed in version `version`.* | ||
Comment on lines
+38
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From meeting: let's add info about when we add warnings. |
||
|
||
The `code` can be a *function*, *module* or *feature* name, and the `version` should be the next major release. | ||
|
||
The deprecation warning may include an advice on how to replace the deprecated feature. | ||
|
||
> *Use `alternative` instead.* | ||
|
||
As a full example, imagine we are in version 1.0.0, and we want to deprecate the `potato` function. | ||
We would add the follow warning: | ||
|
||
```python | ||
def potato(): | ||
warnings.warn( | ||
"potato is deprecated and will be removed in version 2.0.0. " | ||
"Use banana instead.", | ||
DeprecationWarning, | ||
) | ||
|
||
def banana(): | ||
... | ||
``` | ||
|
||
!!! warning | ||
Pre-1.0 Starlette will remove deprecated code in the stable release (1.0). | ||
|
||
The drop of a feature will be documented in the release notes, and the user will be warned about it. |
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
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
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
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
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
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the "when". Should the wording be changed? @adriangb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is saying when we will deprecate the feature, the question was when do we put in deprecation warnings. Can users expect deprecation warnings to show up at any time, only in minor releases or only in major releases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The act of deprecating a feature is adding a deprecation warning. At least, this is how I understand.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll apply something on that line.