Pre and post install messages

In Void Linux (xbps package manager) we have the concept of INSTALL.msg and REMOVE.msg which can be used to print messages to the user at post-install or pre-remove time. Something like this could avoid needing arbitrary code execution, but I guess the applications could be considered too “niche”. Personally I enjoy having this additional channel for communication between package maintainers → users. It’s mostly used for when a particular package (version) may require manual intervention to set up properly/completely.

However, for this feature to be most useful it would greatly benefit from at least the ability to introspect metadata of the package in question, and potentially also some basic information about the system/python version, and use that to conditionally display warnings/notices to the user. I agree that modifying the system (e.g. creating .desktop files or installing icons etc.) doesn’t seem like a great fit for pip, which is not an OS-level package manager. But perhaps, for a more restricted scope, this kind of thing could be reconsidered.

There are a few use cases I am thinking of right away:

  • warning users that support for the detected python version is impending removal
  • telling users that installation of one of a set of mutually exclusive dependencies should be installed for (an optional feature) to work; there are currently no mechanisms to specify mutually exclusive dependencies where a default choice is not desired (e.g. due to licensing complications, large download, etc.)
  • warning users of “massive” breaking changes
  • telling users where the package may be leaving some (bulky) junk behind (pre-remove)
  • notifying about potential manual workarounds for any other installation issue, e.g. the fact that Cython extensions need some manual intervention
  • notifying users about some commonly-used optional dependencies (pip install ray[default] vs pip install ray); an additional “in-situ” reminder that can duplicate documentation efforts

I have no idea if it would make sense to still run those hooks if the package is being installed as a transient dependency, but my hunch is that it would be much less useful: this feature is probably targeted at the kind of package that users/developers interact with “directly” for the most part.

All of these seem to be the responsibility of the packager to determine.
What are expecting as a response from the python community specifically?

I assume the proposal is to define some sort of standard metadata that tools are expected to display before installing or removing a package?

I can see the point of wanting something like this, but it seems like a fairly niche requirement, that wouldn’t work well with automated or unattended installs, and would probably trigger a lot of requests for “more flexibility”, which would translate to either extra complexity or some sort of code execution to generate the text.

If someone wanted to write a PEP, it could be considered, but I’m not enthusiastic, personally.


Thanks for the discussion. Yes, the idea would be to propose a standard for these kind of messages. The post was initially appended to an older discussion, hence the lack of specific actionable requests. However, I didn’t consider the fact that this looks a bit like a can of worms from your perspective, leading to requests for increasing scope. I don’t think I have the bandwidth for setting up a PEP right now, but if this gets more attention or further similar requests are made, I’ll consider helping with that.