Then sequential compilation will be used as a fallback. If the platform can’t use multiple workers and workers argument is given, The default is to not use multiple workers. The argument workers specifies how many workers are used toĬompile files in parallel. Levels which lead to multiple compilations of one. Optimize specifies the optimization level for the compiler. Names, which allows byte-code files from multiple versions of Python to The default is to write files to their PEP 3147 locations and If legacy is true, byte-code files are written to their legacy locationsĪnd names, which may overwrite byte-code files created by another version of If quiet is False or 0 (the default), the filenames and other This can be used to exclude files matching a regular expression, If rx is given, its search method is called on the complete path to eachįile considered for compilation, and if it returns a true value, the file If force is true, modules are re-compiled even if the timestamps are up to If ddir is given, it is prepended to the path to each file being compiledįor use in compilation time tracebacks, and is also compiled in to the The maxlevels parameter is used to limit the depth of the recursion it Return a true value if all the files compiled successfully, Recursively descend the directory tree named by dir, compiling all. compile_dir ( dir, maxlevels = sys.getrecursionlimit(), ddir = None, force = False, rx = None, quiet = 0, legacy = False, optimize = - 1, workers = 1, invalidation_mode = None, *, stripdir = None, prependdir = None, limit_sl_dest = None, hardlink_dupes = False ) ¶ Run with the same sys.pycache_prefix (if any) that will be used at The generated bytecode cache will only be useful if compile() is Similarly, the compile() function respects the sys.pycache_prefix Provides the option: python -O -m compileall. There is no command-line option to control the optimization level used by theĬompile() function, because the Python interpreter itself already Raised the default recursion limit from 10 toĪdded the possibility to specify the -o option multiple times. The same content, use hard links to consolidate duplicate files.Ĭhanged in version 3.9: Added the -s, -p, -e and -hardlink-dupes options. pyc files with different optimization level have Ignore symlinks pointing outside the given directory. To compile for multiple levels at a time (for example, Variable is not set, and checked-hash if the SOURCE_DATE_EPOCHĬompile with the given optimization level. The default is timestamp if the SOURCE_DATE_EPOCH environment SeeĬached bytecode invalidation for more information on how Python validates Pycs embed a hash of the source file contents rather than a timestamp. Unchecked-hash values cause hash-based pycs to be generated. pyc files with the source timestampĪnd size embedded will be generated. invalidation-mode ¶Ĭontrol how the generated byte-code files are invalidated at runtime. If 0 is used, then the result of os.cpu_count() Use N workers to compile the files within the given directory. Python -m compileall -r 0 is equivalent to If this is given, then -l option will not be taken into account. r ¶Ĭontrol the maximum recursion level for subdirectories. Is to write files to their PEP 3147 locations and names, which allowsīyte-code files from multiple versions of Python to coexist. Overwrite byte-code files created by another version of Python. Write the byte-code files to their legacy locations and names, which may Read the file list and add each line that it contains to the list ofįiles and directories to compile. Regex is used to search the full path to each file considered forĬompilation, and if the regex produces a match, the file is skipped. Remove ( -s) or append ( -p) the given prefix of paths This willĪppear in compilation time tracebacks, and is also compiled in to theīyte-code file, where it will be used in tracebacks and other messages inĬases where the source file does not exist at the time the byte-code file isĮxecuted. d destdir ¶ĭirectory prepended to the path to each file being compiled. If passed twice ( -qq), all output is suppressed. q ¶ĭo not print the list of files compiled. f ¶įorce rebuild even if timestamps are up-to-date. If no argument is given, behave as ifĭo not recurse into subdirectories, only compile source code files directlyĬontained in the named or implied directories. Positional arguments are files to compile or directories that contain This module can work as a script (using python -m compileall) toĬompile Python sources. WebAssembly platforms for more information. This module does not work or is not available on WebAssembly platforms
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |