import sys123def compiler_directives(profile: bool):4"""5Return a list of Cython directives used for compilation.6"""7return dict(8# Do not generate __reduce__ methods9auto_pickle=False,10# Do not create __test__ dictionary automatically from docstrings11autotestdict=False,12# When enabled, functions will be bound to an instance when looked up as a13# class attribute (hence the name) and will emulate the attributes of14# Python functions, including introspections like argument names and15# annotations16binding=True,17c_api_binop_methods=True,18# Do not check for division by 0 (this is about 35% quicker than with check)19cdivision=True,20cpow=True,21# Embed a textual copy of the call signature in the docstring (to support tools like IPython)22embedsignature=True,23fast_getattr=True,24# Use Python 3 (including source code semantics) for module compilation25language_level="3",26legacy_implicit_noexcept=True,27# Enable support for late includes (make declarations in Cython code available to C include files)28preliminary_late_includes_cy28=True,29# Add hooks for Python profilers into the compiled C code30profile=profile,31)323334def compile_time_env_variables():35"""36Return a list of environmental variables used for compilation.37"""38return dict(39PY_PLATFORM=sys.platform,40# The following two constants are here only for backwards compatibility of user packages41PY_VERSION_HEX=sys.hexversion,42PY_MAJOR_VERSION=sys.version_info[0]43)444546