.. program:: ast
-.. cmdoption:: -h, --help
+.. option:: -h, --help
Show the help message and exit.
-.. cmdoption:: -m <mode>
- --mode <mode>
+.. option:: -m <mode>
+ --mode <mode>
Specify what kind of code must be compiled, like the *mode* argument
in :func:`parse`.
-.. cmdoption:: --no-type-comments
+.. option:: --no-type-comments
Don't parse type comments.
-.. cmdoption:: -a, --include-attributes
+.. option:: -a, --include-attributes
Include attributes such as line numbers and column offsets.
-.. cmdoption:: -i <indent>
- --indent <indent>
+.. option:: -i <indent>
+ --indent <indent>
Indentation of nodes in AST (number of spaces).
.. program:: compileall
-.. cmdoption:: directory ...
- file ...
+.. option:: directory ...
+ file ...
Positional arguments are files to compile or directories that contain
source files, traversed recursively. If no argument is given, behave as if
the command line was :samp:`-l {<directories from sys.path>}`.
-.. cmdoption:: -l
+.. option:: -l
Do not recurse into subdirectories, only compile source code files directly
contained in the named or implied directories.
-.. cmdoption:: -f
+.. option:: -f
Force rebuild even if timestamps are up-to-date.
-.. cmdoption:: -q
+.. option:: -q
Do not print the list of files compiled. If passed once, error messages will
still be printed. If passed twice (``-qq``), all output is suppressed.
-.. cmdoption:: -d destdir
+.. option:: -d destdir
Directory prepended to the path to each file being compiled. This will
appear in compilation time tracebacks, and is also compiled in to the
cases where the source file does not exist at the time the byte-code file is
executed.
-.. cmdoption:: -s strip_prefix
-.. cmdoption:: -p prepend_prefix
+.. option:: -s strip_prefix
+.. option:: -p prepend_prefix
Remove (``-s``) or append (``-p``) the given prefix of paths
recorded in the ``.pyc`` files.
Cannot be combined with ``-d``.
-.. cmdoption:: -x regex
+.. option:: -x regex
regex is used to search the full path to each file considered for
compilation, and if the regex produces a match, the file is skipped.
-.. cmdoption:: -i list
+.. option:: -i list
Read the file ``list`` and add each line that it contains to the list of
files and directories to compile. If ``list`` is ``-``, read lines from
``stdin``.
-.. cmdoption:: -b
+.. option:: -b
Write the byte-code files to their legacy locations and names, which may
overwrite byte-code files created by another version of Python. The default
is to write files to their :pep:`3147` locations and names, which allows
byte-code files from multiple versions of Python to coexist.
-.. cmdoption:: -r
+.. option:: -r
Control the maximum recursion level for subdirectories.
If this is given, then ``-l`` option will not be taken into account.
:program:`python -m compileall <directory> -r 0` is equivalent to
:program:`python -m compileall <directory> -l`.
-.. cmdoption:: -j N
+.. option:: -j N
Use *N* workers to compile the files within the given directory.
If ``0`` is used, then the result of :func:`os.cpu_count()`
will be used.
-.. cmdoption:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
+.. option:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
Control how the generated byte-code files are invalidated at runtime.
The ``timestamp`` value, means that ``.pyc`` files with the source timestamp
variable is not set, and ``checked-hash`` if the ``SOURCE_DATE_EPOCH``
environment variable is set.
-.. cmdoption:: -o level
+.. option:: -o level
Compile with the given optimization level. May be used multiple times
to compile for multiple levels at a time (for example,
``compileall -o 1 -o 2``).
-.. cmdoption:: -e dir
+.. option:: -e dir
Ignore symlinks pointing outside the given directory.
-.. cmdoption:: --hardlink-dupes
+.. option:: --hardlink-dupes
If two ``.pyc`` files with different optimization level have
the same content, use hard links to consolidate duplicate files.
Command line options
^^^^^^^^^^^^^^^^^^^^
-.. cmdoption:: file
+.. option:: file
If *file* is not specified, read from :data:`sys.stdin`.
-.. cmdoption:: --fast
+.. option:: --fast
Indicates the fastest compression method (less compression).
-.. cmdoption:: --best
+.. option:: --best
Indicates the slowest compression method (best compression).
-.. cmdoption:: -d, --decompress
+.. option:: -d, --decompress
Decompress the given file.
-.. cmdoption:: -h, --help
+.. option:: -h, --help
Show the help message.
module. A class or function within the module can be printed instead by
appended a colon and the qualified name of the target object.
-.. cmdoption:: --details
+.. option:: --details
Print information about the specified object rather than the source code
Command line options
^^^^^^^^^^^^^^^^^^^^
-.. cmdoption:: infile
+.. option:: infile
The JSON file to be validated or pretty-printed:
If *infile* is not specified, read from :data:`sys.stdin`.
-.. cmdoption:: outfile
+.. option:: outfile
Write the output of the *infile* to the given *outfile*. Otherwise, write it
to :data:`sys.stdout`.
-.. cmdoption:: --sort-keys
+.. option:: --sort-keys
Sort the output of dictionaries alphabetically by key.
.. versionadded:: 3.5
-.. cmdoption:: --no-ensure-ascii
+.. option:: --no-ensure-ascii
Disable escaping of non-ascii characters, see :func:`json.dumps` for more information.
.. versionadded:: 3.9
-.. cmdoption:: --json-lines
+.. option:: --json-lines
Parse every input line as separate JSON object.
.. versionadded:: 3.8
-.. cmdoption:: --indent, --tab, --no-indent, --compact
+.. option:: --indent, --tab, --no-indent, --compact
Mutually exclusive options for whitespace control.
.. versionadded:: 3.9
-.. cmdoption:: -h, --help
+.. option:: -h, --help
Show the help message.
.. program:: pickletools
-.. cmdoption:: -a, --annotate
+.. option:: -a, --annotate
Annotate each line with a short opcode description.
-.. cmdoption:: -o, --output=<file>
+.. option:: -o, --output=<file>
Name of a file where the output should be written.
-.. cmdoption:: -l, --indentlevel=<num>
+.. option:: -l, --indentlevel=<num>
The number of blanks by which to indent a new MARK level.
-.. cmdoption:: -m, --memo
+.. option:: -m, --memo
When multiple objects are disassembled, preserve memo between
disassemblies.
-.. cmdoption:: -p, --preamble=<preamble>
+.. option:: -p, --preamble=<preamble>
When more than one pickle file are specified, print given preamble
before each disassembly.
.. program:: python -m py_compile
-.. cmdoption:: <file> ... <fileN>
- -
+.. option:: <file> ... <fileN>
+ -
Positional arguments are files to compile. If ``-`` is the only
parameter, the list of files is taken from standard input.
-.. cmdoption:: -q, --quiet
+.. option:: -q, --quiet
Suppress errors output.
:data:`USER_BASE` and whether the directory exists, then the same thing for
:data:`USER_SITE`, and finally the value of :data:`ENABLE_USER_SITE`.
-.. cmdoption:: --user-base
+.. option:: --user-base
Print the path to the user base directory.
-.. cmdoption:: --user-site
+.. option:: --user-site
Print the path to the user site-packages directory.
Command-line options
~~~~~~~~~~~~~~~~~~~~
-.. cmdoption:: -l <tarfile>
- --list <tarfile>
+.. option:: -l <tarfile>
+ --list <tarfile>
List files in a tarfile.
-.. cmdoption:: -c <tarfile> <source1> ... <sourceN>
- --create <tarfile> <source1> ... <sourceN>
+.. option:: -c <tarfile> <source1> ... <sourceN>
+ --create <tarfile> <source1> ... <sourceN>
Create tarfile from source files.
-.. cmdoption:: -e <tarfile> [<output_dir>]
- --extract <tarfile> [<output_dir>]
+.. option:: -e <tarfile> [<output_dir>]
+ --extract <tarfile> [<output_dir>]
Extract tarfile into the current directory if *output_dir* is not specified.
-.. cmdoption:: -t <tarfile>
- --test <tarfile>
+.. option:: -t <tarfile>
+ --test <tarfile>
Test whether the tarfile is valid or not.
-.. cmdoption:: -v, --verbose
+.. option:: -v, --verbose
Verbose output.
-.. cmdoption:: --filter <filtername>
+.. option:: --filter <filtername>
Specifies the *filter* for ``--extract``.
See :ref:`tarfile-extraction-filter` for details.
.. program:: timeit
-.. cmdoption:: -n N, --number=N
+.. option:: -n N, --number=N
how many times to execute 'statement'
-.. cmdoption:: -r N, --repeat=N
+.. option:: -r N, --repeat=N
how many times to repeat the timer (default 5)
-.. cmdoption:: -s S, --setup=S
+.. option:: -s S, --setup=S
statement to be executed once initially (default ``pass``)
-.. cmdoption:: -p, --process
+.. option:: -p, --process
measure process time, not wallclock time, using :func:`time.process_time`
instead of :func:`time.perf_counter`, which is the default
.. versionadded:: 3.3
-.. cmdoption:: -u, --unit=U
+.. option:: -u, --unit=U
specify a time unit for timer output; can select ``nsec``, ``usec``, ``msec``, or ``sec``
.. versionadded:: 3.5
-.. cmdoption:: -v, --verbose
+.. option:: -v, --verbose
print raw timing results; repeat for more digits precision
-.. cmdoption:: -h, --help
+.. option:: -h, --help
print a short usage message and exit
.. program:: tokenize
-.. cmdoption:: -h, --help
+.. option:: -h, --help
show this help message and exit
-.. cmdoption:: -e, --exact
+.. option:: -e, --exact
display token names using the exact type
.. program:: trace
-.. cmdoption:: --help
+.. option:: --help
Display usage and exit.
-.. cmdoption:: --version
+.. option:: --version
Display the version of the module and exit.
.. program:: trace
-.. cmdoption:: -c, --count
+.. option:: -c, --count
Produce a set of annotated listing files upon program completion that shows
how many times each statement was executed. See also
:option:`--coverdir <-C>`, :option:`--file <-f>` and
:option:`--no-report <-R>` below.
-.. cmdoption:: -t, --trace
+.. option:: -t, --trace
Display lines as they are executed.
-.. cmdoption:: -l, --listfuncs
+.. option:: -l, --listfuncs
Display the functions executed by running the program.
-.. cmdoption:: -r, --report
+.. option:: -r, --report
Produce an annotated list from an earlier program run that used the
:option:`--count <-c>` and :option:`--file <-f>` option. This does not
execute any code.
-.. cmdoption:: -T, --trackcalls
+.. option:: -T, --trackcalls
Display the calling relationships exposed by running the program.
.. program:: trace
-.. cmdoption:: -f, --file=<file>
+.. option:: -f, --file=<file>
Name of a file to accumulate counts over several tracing runs. Should be
used with the :option:`--count <-c>` option.
-.. cmdoption:: -C, --coverdir=<dir>
+.. option:: -C, --coverdir=<dir>
Directory where the report files go. The coverage report for
``package.module`` is written to file :file:`{dir}/{package}/{module}.cover`.
-.. cmdoption:: -m, --missing
+.. option:: -m, --missing
When generating annotated listings, mark lines which were not executed with
``>>>>>>``.
-.. cmdoption:: -s, --summary
+.. option:: -s, --summary
When using :option:`--count <-c>` or :option:`--report <-r>`, write a brief
summary to stdout for each file processed.
-.. cmdoption:: -R, --no-report
+.. option:: -R, --no-report
Do not generate annotated listings. This is useful if you intend to make
several runs with :option:`--count <-c>`, and then produce a single set of
annotated listings at the end.
-.. cmdoption:: -g, --timing
+.. option:: -g, --timing
Prefix each line with the time since the program started. Only used while
tracing.
.. program:: trace
-.. cmdoption:: --ignore-module=<mod>
+.. option:: --ignore-module=<mod>
Ignore each of the given module names and its submodules (if it is a
package). The argument can be a list of names separated by a comma.
-.. cmdoption:: --ignore-dir=<dir>
+.. option:: --ignore-dir=<dir>
Ignore all modules and packages in the named directory and subdirectories.
The argument can be a list of directories separated by :data:`os.pathsep`.
.. program:: unittest
-.. cmdoption:: -b, --buffer
+.. option:: -b, --buffer
The standard output and standard error streams are buffered during the test
run. Output during a passing test is discarded. Output is echoed normally
on test fail or error and is added to the failure messages.
-.. cmdoption:: -c, --catch
+.. option:: -c, --catch
:kbd:`Control-C` during the test run waits for the current test to end and then
reports all the results so far. A second :kbd:`Control-C` raises the normal
See `Signal Handling`_ for the functions that provide this functionality.
-.. cmdoption:: -f, --failfast
+.. option:: -f, --failfast
Stop the test run on the first error or failure.
-.. cmdoption:: -k
+.. option:: -k
Only run test methods and classes that match the pattern or substring.
This option may be used multiple times, in which case all test cases that
For example, ``-k foo`` matches ``foo_tests.SomeTest.test_something``,
``bar_tests.SomeTest.test_foo``, but not ``bar_tests.FooTest.test_something``.
-.. cmdoption:: --locals
+.. option:: --locals
Show local variables in tracebacks.
-.. cmdoption:: --durations N
+.. option:: --durations N
Show the N slowest test cases (N=0 for all).
.. program:: unittest discover
-.. cmdoption:: -v, --verbose
+.. option:: -v, --verbose
Verbose output
-.. cmdoption:: -s, --start-directory directory
+.. option:: -s, --start-directory directory
Directory to start discovery (``.`` default)
-.. cmdoption:: -p, --pattern pattern
+.. option:: -p, --pattern pattern
Pattern to match test files (``test*.py`` default)
-.. cmdoption:: -t, --top-level-directory directory
+.. option:: -t, --top-level-directory directory
Top level directory of project (defaults to start directory)
.. program:: uuid
-.. cmdoption:: -h, --help
+.. option:: -h, --help
Show the help message and exit.
-.. cmdoption:: -u <uuid>
- --uuid <uuid>
+.. option:: -u <uuid>
+ --uuid <uuid>
Specify the function name to use to generate the uuid. By default :func:`uuid4`
is used.
-.. cmdoption:: -n <namespace>
- --namespace <namespace>
+.. option:: -n <namespace>
+ --namespace <namespace>
The namespace is a ``UUID``, or ``@ns`` where ``ns`` is a well-known predefined UUID
addressed by namespace name. Such as ``@dns``, ``@url``, ``@oid``, and ``@x500``.
Only required for :func:`uuid3` / :func:`uuid5` functions.
-.. cmdoption:: -N <name>
- --name <name>
+.. option:: -N <name>
+ --name <name>
The name used as part of generating the uuid. Only required for
:func:`uuid3` / :func:`uuid5` functions.
.. program:: zipapp
-.. cmdoption:: -o <output>, --output=<output>
+.. option:: -o <output>, --output=<output>
Write the output to a file named *output*. If this option is not specified,
the output filename will be the same as the input *source*, with the
An output filename must be specified if the *source* is an archive (and in
that case, *output* must not be the same as *source*).
-.. cmdoption:: -p <interpreter>, --python=<interpreter>
+.. option:: -p <interpreter>, --python=<interpreter>
Add a ``#!`` line to the archive specifying *interpreter* as the command
to run. Also, on POSIX, make the archive executable. The default is to
write no ``#!`` line, and not make the file executable.
-.. cmdoption:: -m <mainfn>, --main=<mainfn>
+.. option:: -m <mainfn>, --main=<mainfn>
Write a ``__main__.py`` file to the archive that executes *mainfn*. The
*mainfn* argument should have the form "pkg.mod:fn", where "pkg.mod" is a
:option:`--main` cannot be specified when copying an archive.
-.. cmdoption:: -c, --compress
+.. option:: -c, --compress
Compress files with the deflate method, reducing the size of the output
file. By default, files are stored uncompressed in the archive.
.. versionadded:: 3.7
-.. cmdoption:: --info
+.. option:: --info
Display the interpreter embedded in the archive, for diagnostic purposes. In
this case, any other options are ignored and SOURCE must be an archive, not a
directory.
-.. cmdoption:: -h, --help
+.. option:: -h, --help
Print a short usage message and exit.
Command-line options
~~~~~~~~~~~~~~~~~~~~
-.. cmdoption:: -l <zipfile>
- --list <zipfile>
+.. option:: -l <zipfile>
+ --list <zipfile>
List files in a zipfile.
-.. cmdoption:: -c <zipfile> <source1> ... <sourceN>
- --create <zipfile> <source1> ... <sourceN>
+.. option:: -c <zipfile> <source1> ... <sourceN>
+ --create <zipfile> <source1> ... <sourceN>
Create zipfile from source files.
-.. cmdoption:: -e <zipfile> <output_dir>
- --extract <zipfile> <output_dir>
+.. option:: -e <zipfile> <output_dir>
+ --extract <zipfile> <output_dir>
Extract zipfile into target directory.
-.. cmdoption:: -t <zipfile>
- --test <zipfile>
+.. option:: -t <zipfile>
+ --test <zipfile>
Test whether the zipfile is valid or not.
-.. cmdoption:: --metadata-encoding <encoding>
+.. option:: --metadata-encoding <encoding>
Specify encoding of member names for :option:`-l`, :option:`-e` and
:option:`-t`.
element, subscript zero (``sys.argv[0]``), is a string reflecting the program's
source.
-.. cmdoption:: -c <command>
+.. option:: -c <command>
Execute the Python code in *command*. *command* can be one or more
statements separated by newlines, with significant leading whitespace as in
.. audit-event:: cpython.run_command command cmdoption-c
-.. cmdoption:: -m <module-name>
+.. option:: -m <module-name>
Search :data:`sys.path` for the named module and execute its contents as
the :mod:`__main__` module.
Generic options
~~~~~~~~~~~~~~~
-.. cmdoption:: -?
- -h
- --help
+.. option:: -?
+ -h
+ --help
Print a short description of all command line options and corresponding
environment variables and exit.
-.. cmdoption:: --help-env
+.. option:: --help-env
Print a short description of Python-specific environment variables
and exit.
.. versionadded:: 3.11
-.. cmdoption:: --help-xoptions
+.. option:: --help-xoptions
Print a description of implementation-specific :option:`-X` options
and exit.
.. versionadded:: 3.11
-.. cmdoption:: --help-all
+.. option:: --help-all
Print complete usage information and exit.
.. versionadded:: 3.11
-.. cmdoption:: -V
- --version
+.. option:: -V
+ --version
Print the Python version number and exit. Example output could be:
Miscellaneous options
~~~~~~~~~~~~~~~~~~~~~
-.. cmdoption:: -b
+.. option:: -b
Issue a warning when comparing :class:`bytes` or :class:`bytearray` with
:class:`str` or :class:`bytes` with :class:`int`. Issue an error when the
.. versionchanged:: 3.5
Affects comparisons of :class:`bytes` with :class:`int`.
-.. cmdoption:: -B
+.. option:: -B
If given, Python won't try to write ``.pyc`` files on the
import of source modules. See also :envvar:`PYTHONDONTWRITEBYTECODE`.
-.. cmdoption:: --check-hash-based-pycs default|always|never
+.. option:: --check-hash-based-pycs default|always|never
Control the validation behavior of hash-based ``.pyc`` files. See
:ref:`pyc-invalidation`. When set to ``default``, checked and unchecked
option.
-.. cmdoption:: -d
+.. option:: -d
Turn on parser debugging output (for expert only).
See also the :envvar:`PYTHONDEBUG` environment variable.
it's ignored.
-.. cmdoption:: -E
+.. option:: -E
Ignore all :envvar:`PYTHON*` environment variables, e.g.
:envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set.
See also the :option:`-P` and :option:`-I` (isolated) options.
-.. cmdoption:: -i
+.. option:: -i
When a script is passed as first argument or the :option:`-c` option is used,
enter interactive mode after executing the script or the command, even when
raises an exception. See also :envvar:`PYTHONINSPECT`.
-.. cmdoption:: -I
+.. option:: -I
Run Python in isolated mode. This also implies :option:`-E`, :option:`-P`
and :option:`-s` options.
.. versionadded:: 3.4
-.. cmdoption:: -O
+.. option:: -O
Remove assert statements and any code conditional on the value of
:const:`__debug__`. Augment the filename for compiled
Modify ``.pyc`` filenames according to :pep:`488`.
-.. cmdoption:: -OO
+.. option:: -OO
Do :option:`-O` and also discard docstrings. Augment the filename
for compiled (:term:`bytecode`) files by adding ``.opt-2`` before the
Modify ``.pyc`` filenames according to :pep:`488`.
-.. cmdoption:: -P
+.. option:: -P
Don't prepend a potentially unsafe path to :data:`sys.path`:
.. versionadded:: 3.11
-.. cmdoption:: -q
+.. option:: -q
Don't display the copyright and version messages even in interactive mode.
.. versionadded:: 3.2
-.. cmdoption:: -R
+.. option:: -R
Turn on hash randomization. This option only has an effect if the
:envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since hash
.. versionadded:: 3.2.3
-.. cmdoption:: -s
+.. option:: -s
Don't add the :data:`user site-packages directory <site.USER_SITE>` to
:data:`sys.path`.
:pep:`370` -- Per user site-packages directory
-.. cmdoption:: -S
+.. option:: -S
Disable the import of the module :mod:`site` and the site-dependent
manipulations of :data:`sys.path` that it entails. Also disable these
:func:`site.main` if you want them to be triggered).
-.. cmdoption:: -u
+.. option:: -u
Force the stdout and stderr streams to be unbuffered. This option has no
effect on the stdin stream.
The text layer of the stdout and stderr streams now is unbuffered.
-.. cmdoption:: -v
+.. option:: -v
Print a message each time a module is initialized, showing the place
(filename or built-in module) from which it is loaded. When given twice
.. _using-on-warnings:
-.. cmdoption:: -W arg
+.. option:: -W arg
Warning control. Python's warning machinery by default prints warning
messages to :data:`sys.stderr`.
details.
-.. cmdoption:: -x
+.. option:: -x
Skip the first line of the source, allowing use of non-Unix forms of
``#!cmd``. This is intended for a DOS specific hack only.
-.. cmdoption:: -X
+.. option:: -X
Reserved for various implementation-specific options. CPython currently
defines the following possible values:
Options you shouldn't use
~~~~~~~~~~~~~~~~~~~~~~~~~
-.. cmdoption:: -J
+.. option:: -J
Reserved for use by Jython_.
General Options
---------------
-.. cmdoption:: --enable-loadable-sqlite-extensions
+.. option:: --enable-loadable-sqlite-extensions
Support loadable extensions in the :mod:`!_sqlite` extension module (default
is no) of the :mod:`sqlite3` module.
.. versionadded:: 3.6
-.. cmdoption:: --disable-ipv6
+.. option:: --disable-ipv6
Disable IPv6 support (enabled by default if supported), see the
:mod:`socket` module.
-.. cmdoption:: --enable-big-digits=[15|30]
+.. option:: --enable-big-digits=[15|30]
Define the size in bits of Python :class:`int` digits: 15 or 30 bits.
See :data:`sys.int_info.bits_per_digit <sys.int_info>`.
-.. cmdoption:: --with-suffix=SUFFIX
+.. option:: --with-suffix=SUFFIX
Set the Python executable suffix to *SUFFIX*.
The default suffix on WASM platform is one of ``.js``, ``.html``
or ``.wasm``.
-.. cmdoption:: --with-tzpath=<list of absolute paths separated by pathsep>
+.. option:: --with-tzpath=<list of absolute paths separated by pathsep>
Select the default time zone search path for :const:`zoneinfo.TZPATH`.
See the :ref:`Compile-time configuration
.. versionadded:: 3.9
-.. cmdoption:: --without-decimal-contextvar
+.. option:: --without-decimal-contextvar
Build the ``_decimal`` extension module using a thread-local context rather
than a coroutine-local context (default), see the :mod:`decimal` module.
.. versionadded:: 3.9
-.. cmdoption:: --with-dbmliborder=<list of backend names>
+.. option:: --with-dbmliborder=<list of backend names>
Override order to check db backends for the :mod:`dbm` module
* ``gdbm``;
* ``bdb``.
-.. cmdoption:: --without-c-locale-coercion
+.. option:: --without-c-locale-coercion
Disable C locale coercion to a UTF-8 based locale (enabled by default).
See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`.
-.. cmdoption:: --without-freelists
+.. option:: --without-freelists
Disable all freelists except the empty tuple singleton.
.. versionadded:: 3.11
-.. cmdoption:: --with-platlibdir=DIRNAME
+.. option:: --with-platlibdir=DIRNAME
Python library directory name (default is ``lib``).
.. versionadded:: 3.9
-.. cmdoption:: --with-wheel-pkg-dir=PATH
+.. option:: --with-wheel-pkg-dir=PATH
Directory of wheel packages used by the :mod:`ensurepip` module
(none by default).
.. versionadded:: 3.10
-.. cmdoption:: --with-pkg-config=[check|yes|no]
+.. option:: --with-pkg-config=[check|yes|no]
Whether configure should use :program:`pkg-config` to detect build
dependencies.
.. versionadded:: 3.11
-.. cmdoption:: --enable-pystats
+.. option:: --enable-pystats
Turn on internal statistics gathering.
WebAssembly Options
-------------------
-.. cmdoption:: --with-emscripten-target=[browser|node]
+.. option:: --with-emscripten-target=[browser|node]
Set build flavor for ``wasm32-emscripten``.
.. versionadded:: 3.11
-.. cmdoption:: --enable-wasm-dynamic-linking
+.. option:: --enable-wasm-dynamic-linking
Turn on dynamic linking support for WASM.
.. versionadded:: 3.11
-.. cmdoption:: --enable-wasm-pthreads
+.. option:: --enable-wasm-pthreads
Turn on pthreads support for WASM.
Install Options
---------------
-.. cmdoption:: --prefix=PREFIX
+.. option:: --prefix=PREFIX
Install architecture-independent files in PREFIX. On Unix, it
defaults to :file:`/usr/local`.
As an example, one can use ``--prefix="$HOME/.local/"`` to install
a Python in its home directory.
-.. cmdoption:: --exec-prefix=EPREFIX
+.. option:: --exec-prefix=EPREFIX
Install architecture-dependent files in EPREFIX, defaults to :option:`--prefix`.
This value can be retrieved at runtime using :data:`sys.exec_prefix`.
-.. cmdoption:: --disable-test-modules
+.. option:: --disable-test-modules
Don't build nor install test modules, like the :mod:`test` package or the
:mod:`!_testcapi` extension module (built and installed by default).
.. versionadded:: 3.10
-.. cmdoption:: --with-ensurepip=[upgrade|install|no]
+.. option:: --with-ensurepip=[upgrade|install|no]
Select the :mod:`ensurepip` command run on Python installation:
recommended for best performance. The experimental ``--enable-bolt`` flag can
also be used to improve performance.
-.. cmdoption:: --enable-optimizations
+.. option:: --enable-optimizations
Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK`
(disabled by default).
.. versionadded:: 3.8
-.. cmdoption:: --with-lto=[full|thin|no|yes]
+.. option:: --with-lto=[full|thin|no|yes]
Enable Link Time Optimization (LTO) in any build (disabled by default).
.. versionchanged:: 3.12
Use ThinLTO as the default optimization policy on Clang if the compiler accepts the flag.
-.. cmdoption:: --enable-bolt
+.. option:: --enable-bolt
Enable usage of the `BOLT post-link binary optimizer
<https://github.com/llvm/llvm-project/tree/main/bolt>`_ (disabled by
.. versionadded:: 3.12
-.. cmdoption:: --with-computed-gotos
+.. option:: --with-computed-gotos
Enable computed gotos in evaluation loop (enabled by default on supported
compilers).
-.. cmdoption:: --without-pymalloc
+.. option:: --without-pymalloc
Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>`
(enabled by default).
See also :envvar:`PYTHONMALLOC` environment variable.
-.. cmdoption:: --without-doc-strings
+.. option:: --without-doc-strings
Disable static documentation strings to reduce the memory footprint (enabled
by default). Documentation strings defined in Python are not affected.
See the ``PyDoc_STRVAR()`` macro.
-.. cmdoption:: --enable-profiling
+.. option:: --enable-profiling
Enable C-level code profiling with ``gprof`` (disabled by default).
-.. cmdoption:: --with-strict-overflow
+.. option:: --with-strict-overflow
Add ``-fstrict-overflow`` to the C compiler flags (by default we add
``-fno-strict-overflow`` instead).
Debug options
-------------
-.. cmdoption:: --with-pydebug
+.. option:: --with-pydebug
:ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG``
macro (disabled by default).
-.. cmdoption:: --with-trace-refs
+.. option:: --with-trace-refs
Enable tracing references for debugging purpose (disabled by default).
.. versionadded:: 3.8
-.. cmdoption:: --with-assertions
+.. option:: --with-assertions
Build with C assertions enabled (default is no): ``assert(...);`` and
``_PyObject_ASSERT(...);``.
.. versionadded:: 3.6
-.. cmdoption:: --with-valgrind
+.. option:: --with-valgrind
Enable Valgrind support (default is no).
-.. cmdoption:: --with-dtrace
+.. option:: --with-dtrace
Enable DTrace support (default is no).
.. versionadded:: 3.6
-.. cmdoption:: --with-address-sanitizer
+.. option:: --with-address-sanitizer
Enable AddressSanitizer memory error detector, ``asan`` (default is no).
.. versionadded:: 3.6
-.. cmdoption:: --with-memory-sanitizer
+.. option:: --with-memory-sanitizer
Enable MemorySanitizer allocation error detector, ``msan`` (default is no).
.. versionadded:: 3.6
-.. cmdoption:: --with-undefined-behavior-sanitizer
+.. option:: --with-undefined-behavior-sanitizer
Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan``
(default is no).
Linker options
--------------
-.. cmdoption:: --enable-shared
+.. option:: --enable-shared
Enable building a shared Python library: ``libpython`` (default is no).
-.. cmdoption:: --without-static-libpython
+.. option:: --without-static-libpython
Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o``
(built and enabled by default).
Libraries options
-----------------
-.. cmdoption:: --with-libs='lib1 ...'
+.. option:: --with-libs='lib1 ...'
Link against additional libraries (default is no).
-.. cmdoption:: --with-system-expat
+.. option:: --with-system-expat
Build the :mod:`!pyexpat` module using an installed ``expat`` library
(default is no).
-.. cmdoption:: --with-system-libmpdec
+.. option:: --with-system-libmpdec
Build the ``_decimal`` extension module using an installed ``mpdec``
library, see the :mod:`decimal` module (default is no).
.. versionadded:: 3.3
-.. cmdoption:: --with-readline=editline
+.. option:: --with-readline=editline
Use ``editline`` library for backend of the :mod:`readline` module.
.. versionadded:: 3.10
-.. cmdoption:: --without-readline
+.. option:: --without-readline
Don't build the :mod:`readline` module (built by default).
.. versionadded:: 3.10
-.. cmdoption:: --with-libm=STRING
+.. option:: --with-libm=STRING
Override ``libm`` math library to *STRING* (default is system-dependent).
-.. cmdoption:: --with-libc=STRING
+.. option:: --with-libc=STRING
Override ``libc`` C library to *STRING* (default is system-dependent).
-.. cmdoption:: --with-openssl=DIR
+.. option:: --with-openssl=DIR
Root of the OpenSSL directory.
.. versionadded:: 3.7
-.. cmdoption:: --with-openssl-rpath=[no|auto|DIR]
+.. option:: --with-openssl-rpath=[no|auto|DIR]
Set runtime library directory (rpath) for OpenSSL libraries:
Security Options
----------------
-.. cmdoption:: --with-hash-algorithm=[fnv|siphash13|siphash24]
+.. option:: --with-hash-algorithm=[fnv|siphash13|siphash24]
Select hash algorithm for use in ``Python/pyhash.c``:
.. versionadded:: 3.11
``siphash13`` is added and it is the new default.
-.. cmdoption:: --with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2
+.. option:: --with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2
Built-in hash modules:
.. versionadded:: 3.9
-.. cmdoption:: --with-ssl-default-suites=[python|openssl|STRING]
+.. option:: --with-ssl-default-suites=[python|openssl|STRING]
Override the OpenSSL default cipher suites string:
See ``Mac/README.rst``.
-.. cmdoption:: --enable-universalsdk
-.. cmdoption:: --enable-universalsdk=SDKDIR
+.. option:: --enable-universalsdk
+.. option:: --enable-universalsdk=SDKDIR
Create a universal binary build. *SDKDIR* specifies which macOS SDK should
be used to perform the build (default is no).
-.. cmdoption:: --enable-framework
-.. cmdoption:: --enable-framework=INSTALLDIR
+.. option:: --enable-framework
+.. option:: --enable-framework=INSTALLDIR
Create a Python.framework rather than a traditional Unix install. Optional
*INSTALLDIR* specifies the installation path (default is no).
-.. cmdoption:: --with-universal-archs=ARCH
+.. option:: --with-universal-archs=ARCH
Specify the kind of universal binary that should be created. This option is
only valid when :option:`--enable-universalsdk` is set.
* ``intel-64``;
* ``all``.
-.. cmdoption:: --with-framework-name=FRAMEWORK
+.. option:: --with-framework-name=FRAMEWORK
Specify the name for the python framework on macOS only valid when
:option:`--enable-framework` is set (default: ``Python``).
interpreter for the build platform. The version of the build Python must match
the version of the cross compiled host Python.
-.. cmdoption:: --build=BUILD
+.. option:: --build=BUILD
configure for building on BUILD, usually guessed by :program:`config.guess`.
-.. cmdoption:: --host=HOST
+.. option:: --host=HOST
cross-compile to build programs to run on HOST (target platform)
-.. cmdoption:: --with-build-python=path/to/python
+.. option:: --with-build-python=path/to/python
path to build ``python`` binary for cross compiling
.. versionadded:: 3.11
-.. cmdoption:: CONFIG_SITE=file
+.. option:: CONFIG_SITE=file
An environment variable that points to a file with configure overrides.