This is liable to change in the future.A
python_binary()rule is used to build a PEX file—an executable Python package—that includes Python sources and resources from all transitive
The name of the rule. The output PEX file will have this name as its base filename with an additional
The python module that should be the entry point of the binary. This should be a module name within a python_library that this binary depends on. Note that module names take
base_moduleof the library into account. This property is mutually exclusive with
main, and should be preferred to
main, which is deprecated.
The Python file which serves as the entry point for the PEX. The interpreter initiates execution of the PEX with the code in this file.
The package in which the main module should reside in its final location in the binary. If unset, Buck uses the project-relative directory that contains the BUCK file.
The name of the Python platform flavor to build against by default as defined in the
A list of
python_libraryrules that specify Python modules to include in the PEX file—including all transitive dependencies of these rules.
A list of C/C++ library dependencies that need to be loaded before any other libraries when the PEX starts up. This requires dynamic loader support, such as
LD_PRELOAD, found on most systems.
Used to override the global packaging style that is set in
List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their
exported_depsattributes. For more information, see visibility.
Build a PEX from the Python files in the BUCK directory.
# BUCK python_binary( name = 'tailer', main_module = 'tailer', deps = [ ':tailerutils', ], ) python_library( name = 'tailerutils', # The main module, tailer.py, is specified here. # (Separated out from the glob pattern for clarity.) srcs = glob(['tailer.py', '*.py']), )
platform argument to select the
[python#py2] platform as defined in
; .buckconfig [python#py2] interpreter = /usr/bin/python2.7
# BUCK python_binary( name = 'bin', platform = 'py2', main_module = 'main', deps = [ ':bar', ], )