liblzma supports multi-threaded compression since 5.2.0 (2014-12-21). Making something as CPU-intensive as compression parallel is quite useful, so Python should have it too.
The MT mode compresses the data in individual chunks, such that the only additional barrier for reproducible output is the chunk size (defaulting to be derived from the preset’s dict size), and that any thread count would compress the same. (xz itself can still compress differently from version to version.)
The entry point to this feature seems to be
src/xz/coder.c, as in the reference
xz program, provides an example for using this interface – complete with sensible values in
mt_options. CPU count detection with
lzma_cputhreads() is found in