From Fedora Project Wiki
(WIP proposal)
 
(Add trackers)
 
(17 intermediate revisions by 3 users not shown)
Line 26: Line 26:


== Current status ==
== Current status ==
[[Category:ChangePageIncomplete]]
[[Category:ChangeAcceptedF34]]
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
Line 45: Line 45:
CLOSED as NEXTRELEASE -> change is completed and verified and will be delivered in next release under development
CLOSED as NEXTRELEASE -> change is completed and verified and will be delivered in next release under development
-->
-->
* FESCo issue: <will be assigned by the Wrangler>
* FESCo issue: [https://pagure.io/fesco/issue/2566 #2566]
* Tracker bug: <will be assigned by the Wrangler>
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=1924123 #1924123]
* Release notes tracker: <will be assigned by the Wrangler>
* Release notes tracker: [https://pagure.io/fedora-docs/release-notes/issue/652 #652]


== Detailed Description ==
== Detailed Description ==


<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
The {{package|python-mock}} package is the [https://pypi.org/project/mock/ 3rd party backport of the standard library `unittest.mock` module]:
: mock is now part of the Python standard library, available as [https://docs.python.org/dev/library/unittest.mock.html unittest.mock] in Python 3.3 onwards. This package contains a rolling backport of the standard library mock code compatible with Python 3.6 and up.
Fedora has recent enough versions of Python, hence using a library backport is redundant. Many packages only use it out of habit. We'd like to encourage both downstream packages and upstreams to switch to [https://docs.python.org/dev/library/unittest.mock.html unittest.mock] instead. Eventually, we'd like to drop {{package|python-mock}} from Fedora entirely, if possible. Before we attempt to remove the package, we need to stop new packages to (Build)Require {{package|python3-mock}}, hence we want to have it [https://docs.fedoraproject.org/en-US/packaging-guidelines/deprecating-packages/ deprecated].
Note that the change owner does not currently officially maintain {{package|python-mock}} but the Python Maintenance team maintains the package in RHEL and contributes to the Fedora package when needed. The Fedora package maintainer has been contacted without response (the nonresponsive process is currently in progress).
=== How to migrate to unittest.mock ===
In most cases, performing the following replacement should be enough:
s/^(\s*)import mock/\1from unittest import mock/
s/^(\s*)from mock import /\1from unittest.mock import /
If upstream really needs to support Python versions without `unittest.mock`, we recommend using a `try-import` mechanism, such as:
try:
    from unittest import mock
except ImportError:
    import mock
If dual support for `unittest.mock` and `mock` is required, and the `mock` package is required in the metadata (such as in the testing ''extras''), conditionalize it, with:
mock;python_version<"3.3"


== Feedback ==
== Feedback ==


<!-- Summarize the feedback from the community and address why you chose not to accept proposed alternatives. This section is optional for all change proposals but is strongly suggested. Incorporating feedback here as it is raised gives FESCo a clearer view of your proposal and leaves a good record for the future. If you get no feedback, that is useful to note in this section as well. For innovative or possibly controversial ideas, consider collecting feedback before you file the change proposal. -->
<!-- Summarize the feedback from the community and address why you chose not to accept proposed alternatives. This section is optional for all change proposals but is strongly suggested. Incorporating feedback here as it is raised gives FESCo a clearer view of your proposal and leaves a good record for the future. If you get no feedback, that is useful to note in this section as well. For innovative or possibly controversial ideas, consider collecting feedback before you file the change proposal. -->
In the past, we've managed to migrate some packages away from python-mock, without a push back:
* https://src.fedoraproject.org/rpms/python-urllib3/pull-request/13
* https://src.fedoraproject.org/rpms/python-freezegun/pull-request/10
* https://src.fedoraproject.org/rpms/python-hypothesis/c/65a4191709


== Benefit to Fedora ==
== Benefit to Fedora ==
Line 86: Line 118:
     https://fedoraproject.org/wiki/Changes/perl5.26 (major upgrade to a popular software stack, visible to users of that stack)
     https://fedoraproject.org/wiki/Changes/perl5.26 (major upgrade to a popular software stack, visible to users of that stack)
-->
-->
Eventually, we might be able to no longer maintain a standard library backport in a separate package.


== Scope ==
== Scope ==
* Proposal owners:
* Proposal owners: Deprecate {{package|python3-mock}} and update the package description. Provide help migrating to `unittest.mock` to other packagers who ask for it.
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->


* Other developers: N/A (not a System Wide Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Other developers: No action needed. Don't add new dependencies on {{package|python3-mock}}. If interested, migrate existing packages to `unittest.mock` (feel free to ask for help). <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- What work do other developers have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
<!-- What work do other developers have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->


* Release engineering: [https://pagure.io/releng/issues #Releng issue number] (a check of an impact with Release Engineering is needed) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Release engineering: no impact on Release Engineering is anticipated <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuild required?  include a link to the releng issue.  
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuild required?  include a link to the releng issue.  
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->
The issue is required to be filed prior to feature submission, to ensure that someone is on board to do any process development work and testing and that all changes make it into the pipeline; a bullet point in a change is not sufficient communication -->
Line 104: Line 138:
<!-- If your Change may require trademark approval (for example, if it is a new Spin), file a ticket ( https://pagure.io/Fedora-Council/tickets/issues ) requesting trademark approval from the Fedora Council. This approval will be done via the Council's consensus-based process. -->
<!-- If your Change may require trademark approval (for example, if it is a new Spin), file a ticket ( https://pagure.io/Fedora-Council/tickets/issues ) requesting trademark approval from the Fedora Council. This approval will be done via the Council's consensus-based process. -->


* Alignment with Objectives:  
* Alignment with Objectives: N/A (not needed for this Change)
<!-- Does your proposal align with the current Fedora Objectives: https://docs.fedoraproject.org/en-US/project/objectives/ ? It's okay if it doesn't, but it's something to consider -->
<!-- Does your proposal align with the current Fedora Objectives: https://docs.fedoraproject.org/en-US/project/objectives/ ? It's okay if it doesn't, but it's something to consider -->


Line 111: Line 145:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)  
The package will remain available. Only new packages cannot depend on it.
Once retired (in distant future), we don't plan to obsolete/provide <code>python3-mock</code> from {{package|python3-libs}}, because it cannot work as drop-in replacement (the import name is different). The package will eventually be obsoleted by {{package|fedora-obsolete-packages}} once Python is updated to 3.N+1 after the removal to avoid broken upgrades.


== How To Test ==
== How To Test ==
Line 129: Line 164:


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A (not a System Wide Change)  
$ repoquery --repo=rawhide --provides python3-mock
...
deprecated()
...


== User Experience ==
== User Experience ==
Line 142: Line 180:
  - Green has been scientifically proven to be the most relaxing color. The move to a default background color of green with green text will result in Fedora users being the most relaxed users of any operating system.
  - Green has been scientifically proven to be the most relaxing color. The move to a default background color of green with green text will result in Fedora users being the most relaxed users of any operating system.
-->
-->
No changes.


== Dependencies ==
== Dependencies ==

Latest revision as of 16:27, 2 February 2021


Deprecate python-mock

Summary

The Package-x-generic-16.pngpython-mock (Package-x-generic-16.pngpython3-mock) package will be deprecated in Fedora 34. The package is a standard library backport for older Pythons, Fedora packages should use unittest.mock instead. Many still depend on mock, so we cannot remove it yet. Packagers are encouraged to work with upstream to switch to unittest.mock when available. A simple sed can be applied in %prep as a temporary (or even permanent) downstream solution.

Owner

Current status

Detailed Description

The Package-x-generic-16.pngpython-mock package is the 3rd party backport of the standard library unittest.mock module:

mock is now part of the Python standard library, available as unittest.mock in Python 3.3 onwards. This package contains a rolling backport of the standard library mock code compatible with Python 3.6 and up.

Fedora has recent enough versions of Python, hence using a library backport is redundant. Many packages only use it out of habit. We'd like to encourage both downstream packages and upstreams to switch to unittest.mock instead. Eventually, we'd like to drop Package-x-generic-16.pngpython-mock from Fedora entirely, if possible. Before we attempt to remove the package, we need to stop new packages to (Build)Require Package-x-generic-16.pngpython3-mock, hence we want to have it deprecated.

Note that the change owner does not currently officially maintain Package-x-generic-16.pngpython-mock but the Python Maintenance team maintains the package in RHEL and contributes to the Fedora package when needed. The Fedora package maintainer has been contacted without response (the nonresponsive process is currently in progress).

How to migrate to unittest.mock

In most cases, performing the following replacement should be enough:

s/^(\s*)import mock/\1from unittest import mock/
s/^(\s*)from mock import /\1from unittest.mock import /

If upstream really needs to support Python versions without unittest.mock, we recommend using a try-import mechanism, such as:

try:
    from unittest import mock
except ImportError:
    import mock

If dual support for unittest.mock and mock is required, and the mock package is required in the metadata (such as in the testing extras), conditionalize it, with:

mock;python_version<"3.3"

Feedback

In the past, we've managed to migrate some packages away from python-mock, without a push back:

Benefit to Fedora

Eventually, we might be able to no longer maintain a standard library backport in a separate package.

Scope

  • Proposal owners: Deprecate Package-x-generic-16.pngpython3-mock and update the package description. Provide help migrating to unittest.mock to other packagers who ask for it.
  • Other developers: No action needed. Don't add new dependencies on Package-x-generic-16.pngpython3-mock. If interested, migrate existing packages to unittest.mock (feel free to ask for help).
  • Release engineering: no impact on Release Engineering is anticipated
  • Policies and guidelines: N/A (not a System Wide Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives: N/A (not needed for this Change)

Upgrade/compatibility impact

The package will remain available. Only new packages cannot depend on it. Once retired (in distant future), we don't plan to obsolete/provide python3-mock from Package-x-generic-16.pngpython3-libs, because it cannot work as drop-in replacement (the import name is different). The package will eventually be obsoleted by Package-x-generic-16.pngfedora-obsolete-packages once Python is updated to 3.N+1 after the removal to avoid broken upgrades.

How To Test

$ repoquery --repo=rawhide --provides python3-mock
...
deprecated()
...

User Experience

No changes.

Dependencies

N/A (not a System Wide Change)

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No
  • Blocks product? product

Documentation

N/A (not a System Wide Change)

Release Notes