warnings.formatwarning()

warnings.formatwarning(message, category, filename, lineno, line=None) Format a warning the standard way. This returns a string which may contain embedded newlines and ends in a newline. line is a line of source code to be included in the warning message; if line is not supplied, formatwarning() will try to read the line specified by filename and lineno.

warnings.filterwarnings()

warnings.filterwarnings(action, message='', category=Warning, module='', lineno=0, append=False) Insert an entry into the list of warnings filter specifications. The entry is inserted at the front by default; if append is true, it is inserted at the end. This checks the types of the arguments, compiles the message and module regular expressions, and inserts them as a tuple in the list of warnings filters. Entries closer to the front of the list override entries later in the list, if both mat

warnings.catch_warnings

class warnings.catch_warnings(*, record=False, module=None) A context manager that copies and, upon exit, restores the warnings filter and the showwarning() function. If the record argument is False (the default) the context manager returns None on entry. If record is True, a list is returned that is progressively populated with objects as seen by a custom showwarning() function (which also suppresses output to sys.stdout). Each object in the list has attributes with the same names as the ar

Warning

exception Warning Base class for warning categories.

venv.EnvBuilder.setup_scripts()

setup_scripts(context) Installs activation scripts appropriate to the platform into the virtual environment.

venv.EnvBuilder.setup_python()

setup_python(context) Creates a copy of the Python executable (and, under Windows, DLLs) in the environment. On a POSIX system, if a specific executable python3.x was used, symlinks to python and python3 will be created pointing to that executable, unless files with those names already exist.

venv.EnvBuilder.post_setup()

post_setup(context) A placeholder method which can be overridden in third party implementations to pre-install packages in the virtual environment or perform other post-creation steps.

venv.EnvBuilder.install_scripts()

install_scripts(context, path) path is the path to a directory that should contain subdirectories “common”, “posix”, “nt”, each containing scripts destined for the bin directory in the environment. The contents of “common” and the directory corresponding to os.name are copied after some text replacement of placeholders: __VENV_DIR__ is replaced with the absolute path of the environment directory. __VENV_NAME__ is replaced with the environment name (final path segment of environment directo

venv.EnvBuilder.ensure_directories()

ensure_directories(env_dir) Creates the environment directory and all necessary directories, and returns a context object. This is just a holder for attributes (such as paths), for use by the other methods. The directories are allowed to exist already, as long as either clear or upgrade were specified to allow operating on an existing environment directory.

venv.EnvBuilder.create_configuration()

create_configuration(context) Creates the pyvenv.cfg configuration file in the environment.