Merge ~cjwatson/launchpad:dev-guides-formatting into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 9650badee3fccd35114706841936628146f5c681
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:dev-guides-formatting
Merge into: launchpad:master
Diff against target: 215 lines (+66/-66)
2 files modified
doc/guides/architecture.rst (+22/-22)
doc/guides/python.rst (+44/-44)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+411735@code.launchpad.net

Commit message

Improve some Sphinx formatting

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/doc/guides/architecture.rst b/doc/guides/architecture.rst
2index 239b7c8..cc5c143 100644
3--- a/doc/guides/architecture.rst
4+++ b/doc/guides/architecture.rst
5@@ -20,11 +20,11 @@ Goals
6 The goal of the recommendations and suggestions in this guide are to help us
7 reach a number of big picture goals. We want Launchpad to be:
8
9- * Blazingly fast
10- * Always available
11- * Change safely
12- * Simple to make, manage and use
13- * Flexible
14+* Blazingly fast
15+* Always available
16+* Change safely
17+* Simple to make, manage and use
18+* Flexible
19
20 However it's hard when making any particular design choice to be confident
21 that it drives us towards these goals: they are quite specific, and not
22@@ -48,12 +48,12 @@ easier it will be to meet our goals.
23
24 The values are:
25
26- * Transparency
27- * Loose coupling
28- * Highly cohesive
29- * Testable
30- * Predictable
31- * Simple
32+* Transparency
33+* Loose coupling
34+* Highly cohesive
35+* Testable
36+* Predictable
37+* Simple
38
39 Transparency
40 ------------
41@@ -63,19 +63,19 @@ into ``pdb`` or taking guesses.
42
43 Some specific things that aid transparency:
44
45- * For blocking calls (SQL, bzr, email, librarian, backend web services,
46- memcache) use ``lp.services.timeline.requesttimeline`` to record the
47- call. This includes it in OOPS reports.
48- * fine grained just-in-time logging (e.g. bzr's ``-Dhpssdetail`` option)
49+* For blocking calls (SQL, bzr, email, librarian, backend web services,
50+ memcache) use ``lp.services.timeline.requesttimeline`` to record the call.
51+ This includes it in OOPS reports.
52+* fine grained just-in-time logging (e.g. bzr's ``-Dhpssdetail`` option)
53
54- * live status information
55- * (+opstats, but more so)
56- * cron script status
57- * migration script status
58+* live status information
59+ * (+opstats, but more so)
60+ * cron script status
61+ * migration script status
62
63- * regular log files
64- * OOPS reports - lovely
65- * Which revisions/versions of the software & its dependencies are running
66+* regular log files
67+* OOPS reports - lovely
68+* Which revisions/versions of the software & its dependencies are running
69
70 We already have a lot of transparency. We can use more.
71
72diff --git a/doc/guides/python.rst b/doc/guides/python.rst
73index 3ceb3ad..c426bd6 100644
74--- a/doc/guides/python.rst
75+++ b/doc/guides/python.rst
76@@ -13,28 +13,28 @@ There are well-established conventions in the Python community, and in
77 general we should follow these. General Python conventions, and required
78 reading:
79
80- * `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_: Style Guide for
81- Python Code
82- * `PEP 257 <https://www.python.org/dev/peps/pep-0257/>`_: Docstring
83- Conventions
84- * The Zen of Python: ``python3 -c "import this"``
85+* `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_: Style Guide for
86+ Python Code
87+* `PEP 257 <https://www.python.org/dev/peps/pep-0257/>`_: Docstring
88+ Conventions
89+* The Zen of Python: ``python3 -c "import this"``
90
91 Note that our standards differ slightly from PEP-8 in some cases.
92
93 Coding standards other projects use:
94
95- * `Twisted Coding Standard
96- <https://twistedmatrix.com/documents/current/core/development/policy/coding-standard.html>`_
97- * `Zope developer guidelines
98- <https://www.zope.org/developer/guidelines.html>`_
99+* `Twisted Coding Standard
100+ <https://twistedmatrix.com/documents/current/core/development/policy/coding-standard.html>`_
101+* `Zope developer guidelines
102+ <https://www.zope.org/developer/guidelines.html>`_
103
104 Related Documents
105 =================
106
107- * `Exception guidelines <https://dev.launchpad.net/ExceptionGuidelines>`_
108- * `Assertions <https://dev.launchpad.net/AssertionsInLaunchpad>`_
109- * `Launchpad hacking FAQ <https://dev.launchpad.net/LaunchpadHackingFAQ>`_
110- * `Tests style guide <https://dev.launchpad.net/TestsStyleGuide>`_
111+* `Exception guidelines <https://dev.launchpad.net/ExceptionGuidelines>`_
112+* `Assertions <https://dev.launchpad.net/AssertionsInLaunchpad>`_
113+* `Launchpad hacking FAQ <https://dev.launchpad.net/LaunchpadHackingFAQ>`_
114+* `Tests style guide <https://dev.launchpad.net/TestsStyleGuide>`_
115
116 Whitespace and Wrapping
117 =======================
118@@ -42,10 +42,10 @@ Whitespace and Wrapping
119 (Most of this is likely to be delegated to `black
120 <https://github.com/psf/black>`_ in the near future.)
121
122- * Code should fit within 78 columns, so as to fit nicely in an 80 column
123- terminal, even when quoted in an email.
124- * Indents should be 4 spaces.
125- * **No tabs**. This is not negotiable.
126+* Code should fit within 78 columns, so as to fit nicely in an 80 column
127+ terminal, even when quoted in an email.
128+* Indents should be 4 spaces.
129+* **No tabs**. This is not negotiable.
130
131 .. _multiline:
132
133@@ -77,11 +77,11 @@ Naming
134 Consistency with existing code is the top priority. We follow PEP-8 with
135 the following exceptions:
136
137- * ``CamelCase``: classes, interfaces (beginning with ``I``)
138- * ``initialCamelCase``: methods
139- * ``lowercase_underscores``: functions, non-method attributes, properties,
140- local variables
141- * ``ALL_CAPS``: constants
142+* ``CamelCase``: classes, interfaces (beginning with ``I``)
143+* ``initialCamelCase``: methods
144+* ``lowercase_underscores``: functions, non-method attributes, properties,
145+ local variables
146+* ``ALL_CAPS``: constants
147
148 Private names are private
149 -------------------------
150@@ -93,14 +93,14 @@ anywhere outside class A.
151 Docstrings
152 ==========
153
154- * If you haven't already, read `PEP 257
155- <https://www.python.org/dev/peps/pep-0257/>`_.
156- * In general, everything that can have a docstring should: modules,
157- classes, methods, functions.
158- * Docstrings should always be enclosed in triple double quotes: ``"""Like
159- this."""``
160- * When a class or a method implements an interface, the docstring should
161- say ``"""See `IFoo`."""``
162+* If you haven't already, read `PEP 257
163+ <https://www.python.org/dev/peps/pep-0257/>`_.
164+* In general, everything that can have a docstring should: modules, classes,
165+ methods, functions.
166+* Docstrings should always be enclosed in triple double quotes: ``"""Like
167+ this."""``
168+* When a class or a method implements an interface, the docstring should say
169+ ``"""See `IFoo`."""``
170
171 Docstrings should be valid `reStructuredText
172 <https://docutils.sourceforge.io/rst.html>`_ (with all the painful
173@@ -171,11 +171,11 @@ Restrictions
174
175 There are restrictions on which imports can happen in Launchpad. Namely:
176
177- * View code cannot import code from ``lp.*.model``.
178- * ``import *`` cannot be used if the module being imported from does not
179- have an ``__all__``.
180- * Database code may not import ``zope.exceptions.NotFoundError`` -- it must
181- instead use ``lp.app.errors.NotFoundError``.
182+* View code cannot import code from ``lp.*.model``.
183+* ``import *`` cannot be used if the module being imported from does not
184+ have an ``__all__``.
185+* Database code may not import ``zope.exceptions.NotFoundError`` -- it must
186+ instead use ``lp.app.errors.NotFoundError``.
187
188 These restrictions are enforced by the Import Pedant, which will cause your
189 tests not to pass if you don't abide by the rules.
190@@ -242,16 +242,16 @@ Short of adopting something like Zope's lazy imports (which has issues of
191 its own), you can't avoid this, so here are some tips to make it less
192 painful.
193
194- * Do the nested import in the least common case. For example, if 5 methods
195- in ``model/mailinglist.py`` need access to ``EmailAddress`` but only one
196- method in ``model/emailaddress.py`` needs access to ``MailingList``, put
197- the import inside the ``emailaddress.py`` method, so you have fewer
198- overall nested imports.
199- * Clearly comment that the nested import is for avoiding a circular import,
200- using the example below.
201- * Put the nested import at the top of the method.
202+* Do the nested import in the least common case. For example, if 5 methods
203+ in ``model/mailinglist.py`` need access to ``EmailAddress`` but only one
204+ method in ``model/emailaddress.py`` needs access to ``MailingList``, put
205+ the import inside the ``emailaddress.py`` method, so you have fewer
206+ overall nested imports.
207+* Clearly comment that the nested import is for avoiding a circular import,
208+ using the example below.
209+* Put the nested import at the top of the method.
210
211-... code-block:: python
212+.. code-block:: python
213
214 def doFooWithBar(self, ...):
215 # Import this here to avoid circular imports.

Subscribers

People subscribed via source and target branches

to status/vote changes: