On Mon, Mar 16, 2020 at 9:11 AM Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote: > > --- > eng/management.rst | 1 + > eng/python-devel.rst | 136 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 137 insertions(+) > create mode 100644 eng/python-devel.rst > > diff --git a/eng/management.rst b/eng/management.rst > index 064559c..6eb4217 100644 > --- a/eng/management.rst > +++ b/eng/management.rst > @@ -16,5 +16,6 @@ Software Development Management > vc-users > vc-authors > coding > + python-devel > change-management > issue-tracking > diff --git a/eng/python-devel.rst b/eng/python-devel.rst > new file mode 100644 > index 0000000..0347892 > --- /dev/null > +++ b/eng/python-devel.rst > @@ -0,0 +1,136 @@ > +.. SPDX-License-Identifier: CC-BY-SA-4.0 > + > +.. Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) > + > +.. _PythonDevelGuide: > + > +Python Development Guidelines > +***************************** > + > +Python is the main programming language for the RTEMS Tools. The RTEMS Tools > +run on the host computer of an RTEMS user or maintainer. These guidelines > +cover the Python language version, the source code formatting, use of static > +analysis tools, type annotations, testing, code coverage, and documentation. > +There are exceptions for existing code and third-party code. It is > recommended > +to read the > +`PEP 8 - Style Guide for Python Code > <https://www.python.org/dev/peps/pep-0008/>`_ > +and the > +`Google Python Style Guide > <http://google.github.io/styleguide/pyguide.html>`_. > + > +Python Language Versions > +======================== > + > +Although the official end-of-life of Python 2.7 was on January 1, 2020, the > +RTEMS Project still cares about Python 2.7 compatibility for some tools. > Every > +tool provided by the RTEMS Project which an RTEMS user may use to develop > +applications with RTEMS should be Python 2.7 compatible. Examples are the > +build system, the RTEMS Source Builder, and the RTEMS Tester. The rationale > is > +that there are still some maintained Linux distributions in the wild which > ship > +only Python 2.7 by default. An example is CentOS 7 which gets maintenance > +updates until June 2024. Everything an RTEMS maintainer uses should be > written > +in Python 3.6. > + > +Python Code Formatting > +====================== > + > +Good looking code is important. Unfortunately, what looks good is a bit > +subjective and varies from developer to developer. Arguing about the code > +format is not productive. Code reviews should focus on more important > topics, > +e.g. functionality, testability, and performance. Fortunately, for Python > +there are some good automatic code formatters available. All new code > +specifically developed for the RTEMS Tools should be piped through the > +`yapf <https://github.com/google/yapf>`_ Python code formatter before it is > +committed or sent for review. Use the default settings of the tool > +(`PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_ coding style). > + > +You can disable the automatic formatting by the tool in a region starting > with > +the ``#yapf: disable`` comment until the next ``# yapf: enable`` comment, > e.g. > + > +.. code-block:: python > + > + # yapf: disable > + FOO = { > + # ... some very large, complex data literal. > + } > + > + BAR = [ > + # ... another large data literal. > + ] > + # yapf: enable > + > +For a single literal, you can disable the formatting like this: > + > +.. code-block:: python > + > + BAZ = { > + (1, 2, 3, 4), > + (5, 6, 7, 8), > + (9, 10, 11, 12), > + } # yapf: disable > + > +Static Analysis Tools > +===================== > + > +Use the ``flake8`` and ``pylint`` static analysis tools for Python. Do not > +commit your code or sent it for review if the tools find some rule
This is the "sent" that should be "send" :) _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel