Under what conditions can a python script be considered portable given the following assumptions:
- The script will be developed on one host (e.g., a CentOS or Ubuntu linux distro)
- The script will be brought to another destination host (e.g., CentOS/Ubuntu)
- It is not permissible on the destination host to use pip or any other mechanism to cause updates to occur (e.g., the server is in a clean room with no internet access and IT policy forbids updating)
- It is not permissible to bring the dependencies to the destination host (e.g., via programs such as PyInstaller, cx_freeze, py2exe, or py2app: see relevant post)
Perhaps the solution is that a portable Python program is a program with no module dependencies and if the destination Python program version is also compatible. But, (1) I don't know if having no module dependencies is something that a Python script developer can live with; and, (2) I don't know what Python program version compatibility would actually mean (e.g., is any Python 2 script of any minor/patch version compatible with any other Python 2 script version)? Also, I assume that actually some modules are "core" modules that are always present across Python installations. Is this true? And, can incompatibilities arise if core modules or other modules that are deemed to always be present across Python installations have different version numbers. Can module version differences render a script non-portable?
The question is: is there any way via scripting to analyze a Python script to determine that it is portable, given the above constraints? Lacking that, is there any way via human inspection to make the same determination?