File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ % Documentation based on module docstrings, by Fred L. Drake, Jr.
2+ 3+
4+ \section {\module {py_compile} ---
5+ Compile Python source files. }
6+
7+ \declaremodule [pycompile]{standard}{py_compile}
8+
9+ \modulesynopsis {Compile Python source files to byte-code files.}
10+
11+
12+ \indexii {file}{byte-code}
13+ The \module {py_compile} module provides a single function to generate
14+ a byte-code file from a source file.
15+
16+ Though not often needed, this function can be useful when installing
17+ modules for shared use, especially if some of the users may not have
18+ permission to write the byte-code cache files in the directory
19+ containing the source code.
20+
21+
22+ \begin {funcdesc }{compile}{file\optional {, cfile\optional {, dfile}}}
23+ Compile a source file to byte-code and write out the byte-code cache
24+ file. The source code is loaded from the file name \var {file}. The
25+ byte-code is written to \var {cfile}, which defaults to \var {file}
26+ \code {+} \code {'c'} (\code {'o'} if optimization is enabled in the
27+ current interpreter). If \var {dfile} is specified, it is used as
28+ the name of the source file in error messages instead of \var {file}.
29+ \end {funcdesc }
30+
31+
32+ \begin {seealso }
33+ \seemodule {compileall}{Utilities to compile all Python source files
34+ in a directory tree.}
35+ \end {seealso }
You can’t perform that action at this time.
0 commit comments