Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 38 additions & 65 deletions man-page/py.1
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
.\" Automatically generated by Pandoc 2.2.1
.\" Automatically generated by Pandoc 3.2.1
.\"
.TH "PY" "1" "2022-11-04" "Python Launcher 1.0.0" "Python Launcher"
.hy
.TH "PY" "1" "2024-06-30" "Python Launcher 1.0.1" "Python Launcher"
.SH NAME
.PP
py \- launch a Python interpreter
.SH SYNOPSIS
.PP
\f[B]py\f[] [\f[B]\-[X]/[X.Y]\f[]] \&...
\f[B]py\f[R] [\f[B]\-[X]/[X.Y]\f[R]] \&...
.SH DESCRIPTION
.PP
\f[B]py\f[] launches the most appropriate Python interpreter it can
\f[B]py\f[R] launches the most appropriate Python interpreter it can
find.
It is meant to act as a shorthand for launching \f[B]python\f[] without
having to think about \f[I]which\f[] Python interpreter is the most
It is meant to act as a shorthand for launching \f[B]python\f[R] without
having to think about \f[I]which\f[R] Python interpreter is the most
desired.
The Python Launcher is not meant to substitute all ways of launching
Python, e.g.\ if a specific Python interpreter is desired then it is
assumed it will be directly executed.
.SH SPECIFYING A PYTHON VERSION
.PP
If a command\-line option is provided in the form of \f[B]\-X\f[] or
\f[B]\-X.Y\f[] where \f[I]X\f[] and \f[I]Y\f[] are integers, then that
version of Python will be launched (if available).
For instance, providing \f[B]\-3\f[] will launch the newest version of
Python 3 while \f[B]\-3.6\f[] will try to launch Python 3.6.
If a command\-line option is provided in the form of \f[B]\-X\f[R] or
\f[B]\-X.Y\f[R] where \f[I]X\f[R] and \f[I]Y\f[R] are integers, then
that version of Python will be launched (if available).
For instance, providing \f[B]\-3\f[R] will launch the newest version of
Python 3 while \f[B]\-3.6\f[R] will try to launch Python 3.6.
.SH SEARCHING FOR PYTHON INTERPRETERS
.PP
When no command\-line arguments are provided to the launcher, what is
deemed the most \[lq]appropriate\[rq] interpreter is searched for as
follows:
.IP "1." 3
An activated virtual environment (launched immediately if available)
.IP "2." 3
A \f[B].venv\f[] directory in the current working directory or any
A \f[B].venv\f[R] directory in the current working directory or any
parent directory containing a virtual environment (launched immediately
if available)
.IP "3." 3
If a file path is provided as the first argument, look for a shebang
line containing \f[B]/usr/bin/python\f[],
\f[B]/usr/local/bin/python\f[], \f[B]/usr/bin/env python\f[] or
\f[B]python\f[] and any version specification in the executable name is
treated as a version specifier (like with \f[B]\-X\f[]/\f[B]\-X.Y\f[]
line containing \f[B]/usr/bin/python\f[R],
\f[B]/usr/local/bin/python\f[R], \f[B]/usr/bin/env python\f[R] or
\f[B]python\f[R] and any version specification in the executable name is
treated as a version specifier (like with \f[B]\-X\f[R]/\f[B]\-X.Y\f[R]
command\-line options)
.IP "4." 3
Check for any appropriate environment variable (see
\f[B]ENVIRONMENT\f[])
\f[B]ENVIRONMENT\f[R])
.IP "5." 3
Search \f[B]PATH\f[] for all \f[B]pythonX.Y\f[] executables
Search \f[B]PATH\f[R] for all \f[B]pythonX.Y\f[R] executables
.IP "6." 3
Launch the newest version of Python (while matching any version
restrictions previously specified)
Expand All @@ -56,70 +50,49 @@ All unrecognized command\-line arguments are passed on to the launched
Python interpreter.
.SH OPTIONS
.TP
.B \f[B]\-h\f[]/\f[B]\[en]help\f[]
\f[B]\-h\f[R], \f[B]\-\-help\f[R]
Print a help message and exit; must be specified on its own.
.RS
.RE
.TP
.B \f[B]\[en]list\f[]
List all known interpreters (except activated virtual environment); must
be specified on its own.
.RS
.RE
\f[B]\-\-list\f[R]
List all known interpreters (except virtual environments); must be
specified on its own.
.TP
.B \f[B]\-[X]\f[]
Launch the latest Python \f[I]X\f[] version (e.g.
\f[B]\-3\f[] for the latest Python 3).
See \f[B]ENVIRONMENT\f[] for details on the \f[B]PY_VERSION[X]\f[]
\f[B]\-[X]\f[R]
Launch the latest Python \f[I]X\f[R] version (e.g.\ \f[B]\-3\f[R] for
the latest Python 3).
See \f[B]ENVIRONMENT\f[R] for details on the \f[B]PY_VERSION[X]\f[R]
environment variable.
.RS
.RE
.TP
.B \f[B]\-[X.Y]\f[]
Launch the specified Python version (e.g.
\f[B]\-3.6\f[] for Python 3.6).
.RS
.RE
\f[B]\-[X.Y]\f[R]
Launch the specified Python version (e.g.\ \f[B]\-3.6\f[R] for Python
3.6).
.SH ENVIRONMENT
.TP
.B \f[B]PY_PYTHON\f[]
\f[B]PY_PYTHON\f[R]
Specify the version of Python to search for when no Python version is
explicitly requested (must be formatted as `X.Y'; e.g.
\f[B]3.6\f[] to use Python 3.6 by default).
.RS
.RE
explicitly requested (must be formatted as `X.Y'; e.g.\ \f[B]3.6\f[R] to
use Python 3.6 by default).
.TP
.B \f[B]PY_PYTHON[X]\f[]
\f[B]PY_PYTHON[X]\f[R]
Specify the version of Python to search for when only a major version is
specified (must be formatted as `X.Y'; e.g.\ set \f[B]PY_PYTHON3\f[] to
\f[B]3.6\f[] to cause \f[B]\-3\f[] to use Python 3.6).
.RS
.RE
specified (must be formatted as `X.Y'; e.g.\ set \f[B]PY_PYTHON3\f[R] to
\f[B]3.6\f[R] to cause \f[B]\-3\f[R] to use Python 3.6).
.TP
.B \f[B]PYLAUNCH_DEBUG\f[]
\f[B]PYLAUNCH_DEBUG\f[R]
Log details to stderr about how the Launcher is operating.
.RS
.RE
.TP
.B \f[B]VIRTUAL_ENV\f[]
\f[B]VIRTUAL_ENV\f[R]
Path to a directory containing virtual environment to use when no Python
version is explicitly requested; typically set by activating a virtual
environment.
.RS
.RE
.TP
.B \f[B]PATH\f[]
\f[B]PATH\f[R]
Used to search for Python interpreters.
.RS
.RE
.SH AUTHORS
.PP
Copyright © 2018 Brett Cannon.
.PP
Licensed under MIT.
.SH HOMEPAGE
.PP
https://github.com/brettcannon/python\-launcher/
.SH SEE ALSO
.PP
python(1), python3(1).
6 changes: 3 additions & 3 deletions man-page/py.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ interpreter.

# OPTIONS

**-h**/**--help**
**-h**, **\--help**
: Print a help message and exit; must be specified on its own.

**--list**
: List all known interpreters (except activated virtual environment);
**\--list**
: List all known interpreters (except virtual environments);
must be specified on its own.

**-[X]**
Expand Down