From Fedora Project Wiki
(Pass "-b rawhide" to fedrq commands. This makes it clearer what's going on, and fedrq allows changing the default branch in the config, so we shouldn't assume that all devs running that command use the defaults.)
(finalize for wrangler)
Line 1: Line 1:
{{admon/important | Comments and Explanations | The page source contains comments providing guidance to fill out each section. They are invisible when viewing this page. To read it, choose the "view source" link.<br/> '''Copy the source to a ''new page'' before making changes!  DO NOT EDIT THIS TEMPLATE FOR YOUR CHANGE PROPOSAL.'''}}
= Remove Python Mock Usage
 
{{admon/tip | Guidance | For details on how to fill out this form, see the [https://docs.fedoraproject.org/en-US/program_management/changes_guide/ documentation].}}
 
{{admon/tip | Report issues | To report an issue with this template, file an issue in the [https://pagure.io/fedora-pgm/pgm_docs pgm_docs repo].}}
 
<!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name.  This keeps all change proposals in the same namespace -->
 
= Remove Python Mock Usage <!-- The name of your change proposal --> =


{{Change_Proposal_Banner}}
{{Change_Proposal_Banner}}
Line 22: Line 14:


<!--- UNCOMMENT only for Changes with assigned Shepherd (by FESCo)
<!--- UNCOMMENT only for Changes with assigned Shepherd (by FESCo)
* FESCo shepherd: [[User:FASAccountName| Shehperd name]] <email address>
* FESCo shepherd: [[User:FASAccountName| Shepherd name]] <email address>
-->
-->


== Current status ==
== Current status ==
[[Category:ChangePageIncomplete]]
[[Category:ChangeReadyForWrangler]]
<!-- 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 32: Line 24:
<!-- After review, the Wrangler will move your page to Category:ChangeReadyForFesco... if it still needs more work it will move back to Category:ChangePageIncomplete-->
<!-- After review, the Wrangler will move your page to Category:ChangeReadyForFesco... if it still needs more work it will move back to Category:ChangePageIncomplete-->


<!-- Select proper category, default is Self Contained Change -->
<!-- [[Category:SelfContainedChange]] -->
[[Category:SystemWideChange]]
[[Category:SystemWideChange]]


Line 50: Line 40:


== 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. -->
`python-mock` has been marked as deprecated since Fedora 34, but many packages are still using it
`python-mock` has been marked as deprecated since Fedora 34, but many packages are still using it


Line 87: Line 76:


== Benefit to Fedora ==
== Benefit to Fedora ==
<!-- What is the benefit to the distribution?  Will the software we generate be improved? How will the process of creating Fedora releases be improved?
 
      Be sure to include the following areas if relevant:
      If this is a major capability update, what has changed?
          For example: This change introduces Python 5 that runs without the Global Interpreter Lock and is fully multithreaded.
      If this is a new functionality, what capabilities does it bring?
          For example: This change allows package upgrades to be performed automatically and rolled-back at will.
      Does this improve some specific package or set of packages?
          For example: This change modifies a package to use a different language stack that reduces install size by removing dependencies.
      Does this improve specific Spins or Editions?
          For example: This change modifies the default install of Fedora Workstation to be more in line with the base install of Fedora Server.
      Does this make the distribution more efficient?
          For example: This change replaces thousands of individual %post scriptlets in packages with one script that runs at the end.
      Is this an improvement to maintainer processes?
          For example: Gating Fedora packages on automatic QA tests will make rawhide more stable and allow changes to be implemented more smoothly.
      Is this an improvement targeted as specific contributors?
          For example: Ensuring that a minimal set of tools required for contribution to Fedora are installed by default eases the onboarding of new contributors.
    When a Change has multiple benefits, it's better to list them all.
    Consider these Change pages from previous editions as inspiration:
    https://fedoraproject.org/wiki/Changes/Annobin (low-level and technical, invisible to users)
    https://fedoraproject.org/wiki/Changes/ParallelInstallableDebuginfo (low-level, but visible to advanced users)
    https://fedoraproject.org/wiki/Changes/VirtualBox_Guest_Integration (primarily a UX change)
    https://fedoraproject.org/wiki/Changes/NoMoreAlpha (an improvement to distro processes)
    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.  
Eventually, we might be able to no longer maintain a standard library backport in a separate package.  


Line 120: Line 82:
== Scope ==
== Scope ==
* Proposal owners:
* Proposal owners:
<!-- 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?-->
** Set up a COPR with a stub package providing `python3-mock` and rebuild all packages that list python3-mock as a BR. The ones that successfully build don't actually need it
** Set up a COPR with a stub package providing `python3-mock` and rebuild all packages that list python3-mock as a BR. The ones that successfully build don't actually need it
** Put up PRs for the affected packages. In case the changes are minimal and no response is heard from the package maintainers the PRs will be merged after a sufficient time.
** Put up PRs for the affected packages. In case the changes are minimal and no response is heard from the package maintainers the PRs will be merged after a sufficient time.
Line 126: Line 87:


* Other developers:
* Other developers:
<!-- 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?-->
Package maintainers should review and merge any PRs filed against their packages, and if necessary forward the patches upstream (e.g. by filing upstream PRs).
Package maintainers should review and merge any PRs filed against their packages, and if necessary forward the patches upstream (e.g. by filing upstream PRs).


* Release engineering: N/A (not needed for this Change)
* Release engineering: N/A (not needed for this Change)


* Policies and guidelines: N/A (not needed for this Change) <!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* Policies and guidelines: N/A (not needed for this Change)
<!-- Do the packaging guidelines or other documents need to be updated for this feature?  If so, does it need to happen before or after the implementation is done?  If a FPC ticket exists, add a link here. Please submit a pull request with the proposed changes before submitting your Change proposal. -->


* Trademark approval: N/A (not needed for this Change)
* Trademark approval: N/A (not needed for this Change)
<!-- 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 Community Initiatives:  
* Alignment with Community Initiatives:  
<!-- Does your proposal align with the current Fedora Community Initiatives: https://docs.fedoraproject.org/en-US/project/initiatives/ ? It's okay if it doesn't, but it's something to consider -->
Not specifically, but this is in line with Fedora's "First" Foundation


== Upgrade/compatibility impact ==
== Upgrade/compatibility impact ==
<!-- What happens to systems that have had a previous versions of Fedora installed and are updated to the version containing this change? Will anything require manual configuration or data migration? Will any existing functionality be no longer supported? -->
N/A
N/A
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
 




Line 150: Line 107:


== User Experience ==
== User Experience ==
<!-- If this change proposal is noticeable by users, how will their experiences change as a result?
This section partially overlaps with the Benefit to Fedora section above. This section should be primarily about the User Experience, written in a way that does not assume deep technical knowledge. More detailed technical description should be left for the Benefit to Fedora section.
Describe what Users will see or notice, for example:
  - Packages are compressed more efficiently, making downloads and upgrades faster by 10%.
  - Kerberos tickets can be renewed automatically. Users will now have to authenticate less and become more productive. Credential management improvements mean a user can start their work day with a single sign on and not have to pause for reauthentication during their entire day.
- Libreoffice is one of the most commonly installed applications on Fedora and it is now available by default to help users "hit the ground running".
- 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
No changes


== Dependencies ==
== Dependencies ==
<!-- What other packages (RPMs) depend on this package?  Are there changes outside the developers' control on which completion of this change depends?  In other words, completion of another change owned by someone else and might cause you to not be able to finish on time or that you would need to coordinate?  Other upstream projects like the kernel (if this is not a kernel change)? -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
N/A
N/A


Line 176: Line 120:


== Documentation ==
== Documentation ==
<!-- Is there upstream documentation on this change, or notes you have written yourself?  Link to that material here so other interested developers can get involved. -->
The previous [[Changes/DeprecatePythonMock#How_to_migrate_to_unittest.mock|howto]] on migrating to unittest.mock still applies.


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
Upstream [https://docs.python.org/3/library/unittest.mock.html unittest.mock documentation]
N/A (not a System Wide Change)


== Release Notes ==
== Release Notes ==

Revision as of 16:28, 21 December 2023

= Remove Python Mock Usage

Important.png
This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.

Summary

python-mock has been deprecated since Fedora 34 - 6 releases ago, but is still in use in many packages. We plan to go through the remaining usages and clean them up, with the goal of retiring python-mock from Fedora.

Owner


Current status

  • Targeted release: Fedora Linux 40
  • Last updated: 2023-12-21
  • [<will be assigned by the Wrangler> devel thread]
  • FESCo issue: <will be assigned by the Wrangler>
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

python-mock has been marked as deprecated since Fedora 34, but many packages are still using it

Binary packages from 16 source packages require python3-mock

 $ fedrq whatrequires python3-mock -b rawhide -F source --notsrc | wc -l
 16
 $ repoquery -q --repo=rawhide{,-source} --whatrequires python3-mock | grep -v src$ | wc -l
 16
 $ repoquery -q --repo=rawhide --whatrequires python3-mock --source | wc -l
 16
 

124 source packages require python3-mock

 $ fedrq whatrequires python3-mock -b rawhide -F source --src | wc -l
 124
 $ repoquery -q --repo=rawhide{,-source} --whatrequires python3-mock | grep src$ | wc -l
 124
 

For a combined 134 packages

 $ fedrq whatrequires python3-mock -b rawhide -F source | wc -l
 134
 $ (repoquery -q --repo=rawhide{,-source} --whatrequires python3-mock | grep src$; repoquery -q --repo=rawhide --whatrequires python3-mock --source) | pkgname | sort | uniq | wc -l
 134
 

Some of these are false positives - packages not using dynamic build requirements might still be marked as requiring python-mock after upstream no longer does so. The rest should be easily portable as described in the previous proposal.

Some packages could be dead upstream and not used by anything else in Fedora, in which case we can consider removing them.

Feedback

Benefit to Fedora

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

This will also make branching packages for EPEL easier - there have been several instances where the Fedora package needs to be modified to not use python-mock because of a policy decision to not bring python-mock into newer EPEL releases (where the default Python already contains unittest.mock).

Scope

  • Proposal owners:
    • Set up a COPR with a stub package providing python3-mock and rebuild all packages that list python3-mock as a BR. The ones that successfully build don't actually need it
    • Put up PRs for the affected packages. In case the changes are minimal and no response is heard from the package maintainers the PRs will be merged after a sufficient time.
    • Set up a second COPR to rebuild packages with the PRs applied to remove python3-mock. This will allow us to track progress in one place
  • Other developers:

Package maintainers should review and merge any PRs filed against their packages, and if necessary forward the patches upstream (e.g. by filing upstream PRs).

  • Release engineering: N/A (not needed for this Change)
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Community Initiatives:

Not specifically, but this is in line with Fedora's "First" Foundation

Upgrade/compatibility impact

N/A


How To Test

Package owners who receive a PR should be able to verify that the CI passes on the PR, and alternatively they can check the provided COPRs

User Experience

No changes

Dependencies

N/A

Contingency Plan

  • Contingency mechanism: defer retiring python-mock for another cycle
  • Contingency deadline: Final Freeze
  • Blocks release? No


Documentation

The previous howto on migrating to unittest.mock still applies.

Upstream unittest.mock documentation

Release Notes