From Fedora Project Wiki

dnf-plugin-pip proposal

This as a very raw draft for dnf-plugin-pip. The main purpose for this plugin is to allow the user to do stuff like sudo dnf pip install -r requirements.txt to install as much Python requirements from RPM as possible. The plugin will use Changes/Automatic_Provides_for_Python_RPM_Packages to find the appropriate packages to install.

install command

The main purpose of dnf pip plugin. The command will take any number positional arguments and try to install them via RPM. If -r is used, the plugin will read the requirements file specified as argument and consider each line a package. For each argument (or line in the requirements file), dnf-plugin-pip will have to consider/do:

  • Is this another -r? If so, do this recursively.
  • Is this a package name or something else (VCS project url, local archive, local directory)?
  • If it is a package:
    • convert the package name to it's canonical form (check the above Chnage Proposal link for details)
    • convert the specified version to RPM compatible one, if needed (how?)
    • try to install pythonX.Ydist(CANONICAL_NAME) via dnf

Several questions should be considered:

What if it's not possible to install via RPM

What if it is a VCS project url or the package simply is not packaged in Fedora? There are multiple possible options:

  • At the end, report what could not be installed.
  • Install those via regular pip.
  • Build a wheel, invoke pyp2rpm and make it an RPM, install that one (error prone, time consuming).

This is a matter of discussion, possibly there'll be command line switches to change the default behavior.

Need to take security into account – DNF probably shouldn't build arbitrary software, especially not as root.

What Python version to use?

We could make it mimic Fedora and have both dnf pip install and dnf pip3 install. Command line switches to specify the version might also be useful.

uninstall command

Will provide a safe way to uninstall a system-wide installed (without --user) package without the need to know if it was installed via RPM or regular pip. More info will follow.

other commands

  • freeze: Output installed packages in requirements format.
  • list: List installed packages
  • show: Show information about installed packages.
  • search: Search PyPI for packages.
  • wheel: Build wheels from your requirements.

Should we have those? Should we just output what pip does?