File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/li
24
24
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/ddup/_ddup.*.so
25
25
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/stack_v2/_stack_v2.*.so
26
26
27
+ # Precompile all .pyc files and remove .py files. This speeds up load time.
28
+ # Compile with optimization level 2 (-o 2) and PYTHONNODEBUGRANGES=1 to redtce
29
+ # size of .pyc files.
30
+ # See https://docs.python.org/3/tutorial/modules.html#compiled-python-files
31
+ # https://docs.python.org/3.11/using/cmdline.html#cmdoption-O
32
+ # https://docs.python.org/3/using/cmdline.html#envvar-PYTHONNODEBUGRANGES
27
33
RUN PYTHONNODEBUGRANGES=1 python -m compileall -o 2 -b ./python/lib/$runtime/site-packages
28
34
RUN find ./python/lib/$runtime/site-packages -name \* .py -delete
29
35
RUN find ./python/lib/$runtime/site-packages -name __pycache__ -type d -exec rm -r {} \+
You can’t perform that action at this time.
0 commit comments