Lines Matching refs:Python
4 Pigweed's Python build
6 Pigweed uses a custom GN-based build system to manage its Python code. The
7 Pigweed Python build supports packaging, installation, and distribution of
8 interdependent local Python packages. It also provides for fast, incremental
12 Pigweed's Python code is exclusively managed by GN, but the GN-based build may
14 setup uses GN to set up the initial Python environment, regardless of the final
15 build system. As needed, non-GN projects can declare just their Python packages
26 Python is an interpreted language, but it shares most build automation concerns
27 with other languages. Pigweed uses Python extensively and must to address these
32 The Python programming langauge does not have an official build automation
33 system. However, there are numerous Python-focused build automation tools with
34 varying degrees of adoption. See the `Python Wiki
37 A few Python tools have become defacto standards, including `setuptools
40 These essential tools address key aspects of Python packaging and distribution,
43 provide more general build automation for Python.
46 Python and other languages used by Pigweed, including protocol buffers.
50 Pigweed's use of Python is different from many other projects. Pigweed is a
54 This section describes Python build automation challenges encountered by
59 Pigweed is organized into distinct modules. In Python, each module is a separate
63 The basic Python packaging tools lack dependency tracking for local packages.
82 There are lots of great Python libraries for testing, such as
85 write and execute individual Python tests, but are not well suited for managing
92 Various static analysis tools exist for Python. Two widely used, powerful tools
117 The protobuf compiler ``protoc`` generates Python modules from ``.proto`` files.
128 Python build.
133 - Correctly manage interdependent local Python packages.
145 Existing Python tools may be effective for Python codebases, but their utility
151 natively support Python, adding support is straightforward with GN templates.
155 example, C++, Go, and Python targets can depend on the same protobuf
161 clean syntax. This makes it feasible to use GN only for Python while building
164 Given these considerations, GN is an ideal choice for Pigweed's Python build.
170 Pigweed Python code is structured into standard Python packages. This makes it
171 simple to package and distribute Pigweed Python packages with common Python
174 Like all Pigweed source code, Python packages are organized into Pigweed
175 modules. A module's Python package is nested under a ``py/`` directory (see
196 check in ensures that all Python files are listed in a ``BUILD.gn``.
202 The key abstraction in the Python build is the ``pw_python_package``.
203 A ``pw_python_package`` represents a Python package as a GN target. It is
215 subtarget represents different functionality in the Python build.
217 - ``<name>`` - Represents the Python files in the build, but does not take any
223 - ``<name>.lint`` - Runs static analysis tools on the Python code. This is a
226 - ``<name>.lint.mypy`` - Runs Mypy on all Python files, if enabled.
227 - ``<name>.lint.pylint`` - Runs Pylint on all Python files, if enabled.
229 - ``<name>.install`` - Installs the package in a Python virtual environment.
230 - ``<name>.wheel`` - Builds a Python wheel for this package.
232 To avoid unnecessary duplication, all Python actions are executed in the default
237 Tests for a Python package are listed in its ``pw_python_package`` target.
239 Python package. The build will run the it when the test, the package, or one
255 Python packages declared in the Python build may be installed in a specified
258 overridden for individual targets. The Python build tracks installation status
261 The Python build examines the ``VIRTUAL_ENV`` environment variable to determine
268 Pigweed Python targets are not yet aware of the virtual environment.
272 Python packages defined entirely in tree are installed with the ``--editable``
275 Building Python wheels
277 Wheels are the standard format for distributing Python packages. The Pigweed
278 Python build supports creating wheels for individual packages and groups of
286 Wheels for a Python package and its transitive dependencies can be collected
293 target (see :ref:`module-pw_protobuf_compiler`). Python protobuf modules are
294 generated as standalone Python packages by default. Protocol buffers may also be
295 nested within existing Python packages. In this case, the Python package in the
296 source tree is incomplete; the final Python package, including protobufs, is