summaryrefslogtreecommitdiff
path: root/CONTRIBUTING.rst
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-10-08 17:59:18 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-10-08 17:59:18 +0900
commitabb9fb987e760ff8c2a7b931f179d23498197b1a (patch)
treefb6c342689dfa01464ea7289812c57096703bc0a /CONTRIBUTING.rst
parent6f5f795e47fa1033c793ba521a852f8323fa3bd0 (diff)
downloadbuildstream-abb9fb987e760ff8c2a7b931f179d23498197b1a.tar.gz
CONTRIBUTING.rst: Added section on file naming convention
Diffstat (limited to 'CONTRIBUTING.rst')
-rw-r--r--CONTRIBUTING.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 20647197c..c0d80749f 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -547,6 +547,25 @@ prefixed with a single underscore, and are not imported in BuildStream's the mas
In this case, the *"API Private"* functions are prefixed with a single underscore.
+File naming convention
+~~~~~~~~~~~~~~~~~~~~~~
+With the exception of a few helper objects and data structures, we structure
+the code in BuildStream such that every filename is named after the object it
+implements. E.g. The ``Project`` object is implemented in ``_project.py``, the
+``Context`` object in ``_context.py``, the base ``Element`` class in ``element.py``,
+etc.
+
+As mentioned in the previous section, objects which are not a part of the
+:ref:`public, plugin facing API surface <contributing_public_api_surface>` have their
+filenames prefixed with a leading underscore (like ``_context.py`` and ``_project.py``
+in the examples above).
+
+When an object name has multiple words in it, e.g. ``ArtifactCache``, then the
+resulting file is named all in lower case without any underscore to separate
+words. In the case of ``ArtifactCache``, the filename implementing this object
+is found at ``_artifactcache/artifactcache.py``.
+
+
Imports
~~~~~~~
Module imports inside BuildStream are done with relative ``.`` notation