|
Peano
|
The page below enlists some recommendations on how to use particular IDEs, and it also provides coding and formatting guidelines.
The documentation guidlines however are hosted on a separate page.
Peano's core is a collection of static libraries. A Peano application consists of C++ glue code which combines all of these libraries. This glue code is generated through the Python API.
You can integrate Peano straightforwardly into Eclipse. Clone the repository locally and invoke
Open the Eclipse GUI and run the following steps:
New Project.Managed Build. Some wizard generations distinguish C from C/C++. I always pick the C/C++ version.GNU Autotools. The Empty Project is the right one to select.Some Eclipse wizards tend to overwrite Peano's configure.ac file. If this is the case, replace the files through
and clean the project in Eclipse. Once you've done so, I recommend that you give the .gitignore file some special treatment:
Eclipse tends to insert the documentation folder to the ignored files once you enable the autotools pipeline. Every new commit now will add this ignore entry to the global repo, which is something we don't want to have.
Most users will interact with Peano through the Python API, which acts as glue to stick together various C++ snippets in a way that can be modified for each experiment.
We aim for our Python to look something like the PEP-8 style guide for Python. In particular, methods should be named all in lowercase, with words separated by underscores, such as:
Moreover, class names should be in camel case:
Python routines are documented with Doxygen docstrings, i.e. docstrings whose opening triple quotes are followed by an exclamation mark (see the example below). Every parameter description starts with a @param statement, followed by the parameter's name, a colon and its type. The description itself follows on the subsequent, indented lines:
Please do not write graph: peano4.api.taskgraph.Graph without the @param: Doxygen then does not recognise the parameter description.
Cross-references to other parts of the code are written with @ref, never with @see, and use the fully qualified name of the target, so Doxygen can resolve them into links:
Short names such as _have_conflicting_data() or translate() typically can not be resolved and yield a Doxygen warning.
More info can be found in the FAQs below.
We mainly follow Oracle Java naming conventions in Peano, which we translate one-to-one into the C++ world. C++-specific principles are:
The documentation guidlines are hosted on a separate page.
If in doubt, you can use the automatic formatting tool described below, but it is crucial that you only format files which you had modified already, i.e. no formatting random files in the repo.
Please try and follow the PEP 8 Style guide.
Recently (2023) a code formatting script has been added to incrementally add consistent formatting throughout the project. Under the hood, it uses clang-format for C++ code, and black for Python code.
Since the idea is to incrementally add consistent formatting throughout, the code script is set up to only format files that have been modified on your local branch to the main branch, p4. Ideally, the formatting script should be run on your local branch before you submit a merge request.
The usage is straightforward. The script can be found in Peano/format.py. To format all files that differ from files on the main p4 branch, simply run
If you want to compare your local branch to a different branch than p4, you can specify that using the -b or --branch flag, e.g.
Note that the format script detects potential files which might need formatting using git, therefore only files tracked by the git versioning will be considered.
If you prefer to run the formatting script on individual files only, you can specify them using the --files flag:
The --files flag doesn't check whether the files you provide are traced by git, and will try to format any files you provide. This can be used for instance to run the formatter on generated files.
As with other parts of the code, the FAQs and Troubleshooting might contain further helpful instructions.