Table of Contents
Executables written for interpretation by Python must use an
appropraite interpreter directive, or “shebang”, as the first line
of the program. This line should be of the
form #!
.
See Section 2.4.1, “Interpreter Name” for the interpreter name to use.
interpreter_location
As noted in Section 2.4.2, “Interpreter Location”, the
form #!/usr/bin/env
is
deprecated.
interpreter_name
A package that installs a program that can be run by any version
of Python 3 must declare a dependency
on python3
, with a versioned dependency if
necessary.
A package that installs a program that can be run by any version
of Python 2 must declare a dependency
on python2
, with a versioned dependency if
necessary.
If the program needs the public Python module foo
, the
package must depend on the binary package that installs
the foo
module. See Section 3.3, “Module Package Names” for the
naming of packages that install public Python modules.
A program that specifies python3
or python
as its interpreter may require its own
private Python modules. These modules should be installed
in /usr/share/
, or
module
/usr/lib/
if the modules are
architecture-dependent (e.g. extensions).
module
The rules explained in Section 3.7, “Modules Byte-Compilation” apply to those private modules: the byte-compiled modules must not be shipped with the binary package, they should be generated in the package's post-install script using the current default Python version, and removed in the pre-remove script. Modules should be byte-compiled using the current default Python version.
Programs that have private compiled extensions must either
handle multiple version support themselves, or declare a tight
dependency on the current Python version (e.g. Depends:
python3 (>= 3.5),
python3 (<< 3.6)
.
A program which requires a specific minor version of Python must
specify the versioned
interpreter python
. The
package that installs the programs must also specify a dependency
on
X
.Y
python
and on any
packages that install necessary modules.
X
.Y
The notes on installation directories and byte-compilation for programs that support any version of Python also apply to programs supporting only a single Python version. Modules to be byte-compiled should use the same Python version as the package itself.