Welcome to Junction Box’s documentation!#
A place to document connections between technologies for our software development framework.
Document Framework#
This project is using the Diátaxis document framework.
The pages below are a summary of the original work created by Daniele Procida and links to the original work are included in the further reading section on each page.
Diátaxis Quickstart#
A summary of each document type and purpose.

1. Tutorial:#
Allow the learner to understand what goals they will achieve before they start.
A tutorial helps a beginner achieve basic competence.
Allow the user to learn by doing.
Get the learner productive and succeeding from the very start.
2. How-to:#
How-to guides are goal-oriented directions, much like a recipe.
The goal of a how-to is to solve a problem or complete an unfamiliar task.
Explanations aren’t necessary when following a how-to guide.
How-to guides should be flexible and adaptable to many use cases.
3. Reference:#
References are technical descriptions of the machinery and how to operate it.
A reference guides focus is the product and must describe it as succinctly as possible.
Users consult reference material, so it should not contain any ambiguity.
4. Discussions:#
Discussions clarify and illuminate a particular topic.
Discussions are understanding-oriented.
Discussions deepen and broaden the reader’s understanding of a subject.
Connections, even to things outside the immediate topic, can add clarity and context.
Further Reading#
Diátaxis Introduction#
The Diátaxis Framework was developed by Daniele Procida.
Core values for using Diátaxis:
A systematic framework for authoring technical documentation.
Solves the challenge of structuring technical documentation.
A systematic approach to understanding documentation users needs.
The framework identifies four types of documentation:
Tutorials:Learning Oriented
How-to guides:Problem-Oriented
Reference: Information Oriented
Discussions: Understanding Oriented
Each documentation type requires a different approach to its creation.
Technical documentation should be structured explicitly around these four types and should keep them all separate and distinct from each other.
Diataxis Framework#
Tutorials#
A tutorial helps a beginner achieve basic competence. It needs to show that the learner can succeed by having them do something both meaningful and attainable.
A tutorial is a lesson concerned with learning how rather than understanding why because it’s practical, not theoretical.
The work required to create and maintain tutorials is far more than is needed for the other types of documentation.
For further interesting reading on this topic, see Diátaxis Tutorials
How-to guides#
How-to guides are goal-oriented directions, much like a recipe. They take the reader through the steps required to solve a real-world problem.
Examples could be calibrating a temperature sensor, using fixtures in pytest, and configuring a software package.
Building a web application is not addressing a specific goal or problem. It’s a vastly open-ended sphere of skill that is not a how-to.
For further interesting reading on this topic, see Diátaxis How-to
References#
References are technical descriptions of the machinery and how to operate it. References are information-oriented.
References are like a map and should be to the point and authoritative.
References are consulted rather than read.
Like a map tells you what you need to know about a region without going out and checking yourself, a reference serves the same purpose for the product and its internal machinery.
For further interesting reading on this topic, see Diátaxis References
Discussions#
Discussions clarify and illuminate a particular topic. Discussions are understanding-oriented.
Discussions deepen and broaden the reader’s understanding of a subject.
Discussions aren’t concerned with what the user might be doing, like tutorials and how-to guides.
Discussions approach a topic from a higher perspective and from different angles that allow a more relaxed, more unrestrained way to consider something.
Discussions join things together, and it makes sense to read while being away from the product itself.
For further interesting reading on this topic, see Diátaxis Explanation
Tutorials#
Summary#
A tutorial helps a beginner achieve basic competence. It needs to show that the learner can succeed by having them do something both meaningful and attainable.
A tutorial is a lesson concerned with learning how rather than understanding why because it’s practical, not theoretical.
The work required to create and maintain tutorials is far more than is needed for the other types of documentation.
Dont be a teacher#
Allow the user to learn by doing; it’s how we know to walk and talk.
Give your learners things to do through which they can succeed and then begin to understand the subject.
As you lead the pupil through the steps of your tutorial, allow them to use the tools and perform the operations required to become familiar with the subject.
Build their knowledge up from the simplest tasks and ideas at the start to more complex ones as they progress.
Get Started#
Get the learner productive and succeeding from the very start.
Becoming an expert is not achievable here, and attempting this may lead our new contributors to self-doubt and drop out.
Please start at the very beginning: a user can pick up on the tutorial from new information, to them, begins.
If they need something and it’s not covered, the tutorial will seem incomplete to them, and you risk losing them.
It is ok if the tutorial would not be considered best practice by an experienced practitioner.
A beginners tutorial is a set of tasks that helps them set out safely on a journey of discovery, and it’s about the journey, not the destination.
It must work#
Ensure the beginner’s confidence by maintaining a friendly tone with consistent use of language.
The best way to maintain confidence is by providing a tutorial that works consistently.
Pinning all the requirements and using virtual environments can help in this endeavour for software development tutorials.
Documenting package requirements in the tutorial may be helpful for the long term maintenance of the tutorial, and preparing the beginner for further learning.
It’s challenging creating and maintaining a reliable tutorial experience.
Please aspire to create a reliable and interesting tutorial to guarantee your beginners success and enjoyment.
Instant Results#
Your learner is here to experience new and unfamiliar things.
Completing too many tasks before seeing a result from their actions may lead to a poor experience and retention rate.
Show the relationship between the cause and effect of each step very soon after, if possible.
Each step should be meaningful to the user.
Same Results#
The users of your tutorial will have different backgrounds and probably using various operating systems.
Repeatability and reliability can be challenging to achieve with these constraints.
Yet, your tutorial should work for all users, every time.
Testing your tutorials across the many possible environments ensures they will work as expected.
Concrete is your friend#
Tutorials should be composed of concrete steps, not abstract discussions.
Explicit is better than implicit regarding tutorial actions and outcomes.
Learning starts by meandering along concrete paths towards more general and abstract concepts.
After a beginner has walked many concrete paths, they are ready to see the patterns in them.
Expecting a learner to absorb abstract concepts in a beginner tutorial can be confusing and places an unnecessary burden on them.
Minimalism is the key#
Don’t provide explanations in the tutorial unless it is critical to the understanding of that step.
It’s enough to say - We are using HTTPS because it’s very secure. Discussion of HTTPS is essential in the proper learning phase but not in a tutorial.
When asking a user to do things without much explanation can appear problematic.
For the learner, it rarely is. The learner will focus on following directions and getting a result.
Cautious use of links to additional explanatory material may help.
Don’t interrupt the flow of a tutorial; adding links to a “Further Reading” section at the end of the tutorial keeps the clutter out.
Stay focussed#
Walking a concrete tutorial path may present exciting diversions along the way.
Remain focused on what’s required to reach the tutorial goals, and everything else can wait for another time.
Doing this keeps the tutorial more concise, saving you and the reader from the extra cognitive load.
Further Reading#
For further interesting reading on this topic, see Diátaxis Tutorials.
How-to#
Summary#
How-to guides are goal-oriented directions, much like a recipe. They take the reader through the steps required to solve a real-world problem.
Examples could be calibrating a temperature sensor, using fixtures in pytest, and configuring a software package.
Building a web application is not addressing a specific goal or problem. It’s a vastly open-ended sphere of skill that is not a how-to.
Tutorials -> How-to Guides#
How-to guides and Tutorials can easily overlap. However, How-to guides serve a different purpose to tutorials.
See the table below indicating the difference in the user’s needs as they move right along the learning path.
Tutorials: for a Learner |
How-to: for a User |
---|---|
May not know the right question. |
Responsible for the right question. |
Knowlege required is determined by the author. |
Knowlege required is determined by the user. |
Learner needs to be lead along the path. |
User can choose their own path. |
Learner aquires knowlege. |
User applys knowlege. |
Learner needs to be taught. |
User needs to be shown. |
Often How-to’s are better written than tutorials because they share the same focus as the developer.
The developer has moved past the learning stage, and a How-to is usually the focus of developers documentation.
Its a Recipe#
Recipes are an excellent model for writing a how-to guide.
Recipes clearly define the goal by following it, and they address a specific question: How do I make it?
Following a recipe requires basic competence; a recipe is not a substitute for a cooking lesson.
Reading about the history of a recipe may be exciting, but it doesn’t help achieve the goal of the recipe.
The history of a recipe will provide the user with better value as they move right in the learning path towards the “discussion” phase.
Recipes follow a well-established format; similarly, How-to guides should also follow a format suitable for the technology.
For consistent formatting, The How-to guide could be in the form of a customisable template.
How-to write a How-to#
How-to guides contain a sequence of actions much like a tutorial.
They differ in a sense; a tutorial mentions that “We are using HTTPS” because it is very secure, whereas a How-to guide digs deeper into HTTPS, that is, it shows you how to do a specific action or configuration with HTTPS.
How-to guides don’t need the repeatability of a tutorial, but they should be reliable.
Solving a Problem
The goal of a how-to is to solve a problem or complete an unfamiliar task.
Maintaining that focus throughout the how-to removes the mistake of bringing in “discussion” topics, which unnecessarily increase cognitive load.
No explanation needed
Explanations aren’t necessary when following a how-to guide. Adding descriptions is adding noise on the way to the goal.
Nice and flexible
How-to guides should be flexible and adaptable to many use cases, unlike a particular tutorial to a narrow topic.
Nothing unnecessary
Completeness is not a requirement of a how-to, whereas being practical and useable is.
How-to guides should start and end in a meaningful place and require the reader to apply it to their work.
What is in a name
Explicit is better than ambiguous when naming a how-to guide.
An explicit How-to name:
How to integrate application performance monitoring using XYZ.
It is clear what this how-to describes.
An ambiguous How-to name:
Integrating application performance monitoring.
Perhaps this document is about the question of deciding whether you should Integrate application performance or not, or something entirely different.
A terrible How-to name:
Application performance monitoring.
This name is very general and does not suggest a how-to guide. Perhaps it’s a book title.
Note
Search engines make use of good document names.
Further Reading#
For further interesting reading on this topic, see Diátaxis How-to
Reference#
Summary#
References are technical descriptions of the machinery and how to operate it. References are information-oriented.
References are like a map and should be to the point and authoritative.
References are consulted rather than read.
Like a map tells you what you need to know about a region without going out and checking yourself, a reference serves the same purpose for the product and its internal machinery.
About#
A reference guides focus is the product and must describe it as succinctly as possible.
Reference guides differ from tutorials and how-to’s, where the user needs are the focus.
Software reference guides describe how to use the APIs, classes, functions and so on.
Users see reference material as the source of truth.
An excellent technical reference provides users with confidence to perform their work when using that product.
Description#
Users consult reference material, so it should not contain any ambiguity.
Reference material is akin to a map and shares the same purpose as a map for the product it references.
Reference material should not show how to perform tasks but should describe how something works or the correct way to use it.
Tools exist, such as Sphinx, that can auto document software API’s using docstrings. Sphinx is a convenient way to keep API documentation relevant.
Its not a recipe#
Reference guides, like an encyclopedia, will be consulted for information on the given topic.
For example, if you consider a recipe, there is a list of ingredients but no explanation of what that ingredient is.
An encyclopedia shines here, providing up to date concise information about the ingredient.
The focus of information delivery for a reference guide is much the same as an encyclopedia.
How-to write a Reference#
Mirror Structure
A map conveys the structure of the area it maps. Likewise, a reference guide should represent the structure of the product it references.
For example, a software reference guide should follow the software’s architecture.
What we mean by following the software architecture is that the conceptual and logical arrangement of the reference guides parts should mirror that of the software where possible.
Consistency
Write consistency into references from six essential areas:
Concise factual information.
Consistent logo or branding placement.
Consistent colours.
Consistent tone in writing.
Consistent imagery.
Consistent Typography, layout and formatting.
Writing tone is possibly the most important, with intelligent use of language that is purposeful and doesn’t use uncommon or obscure words where possible.
Just Describe
A reference is a concise, factual document, so there is no room for speculation, opinions, or discussion.
Reference guides may sometimes seem bare; however, providing links to tutorials and how-to’s where appropriate is better than confusing the focus of the reference.
Examples
Good examples can help the reader connect ideas, concepts and how the machinery interacts with each other, especially if they involve levels of abstraction.
Further Reading#
For further interesting reading on this topic, see Diátaxis References
Discussions#
Summary#
Discussions clarify and illuminate a particular topic. Discussions are understanding-oriented.
Discussions deepen and broaden the reader’s understanding of a subject.
Discussions aren’t concerned with what the user might be doing, like tutorials and how-to guides.
Discussions approach a topic from a higher perspective and from different angles that allow a more relaxed, more unrestrained way to consider something.
Discussions join things together, and it makes sense to read while being away from the product itself.
About#
Discussion clarifies a particular topic. Discussions are understanding-oriented which broadens the reader’s understanding of the subject.
Discussion documentation provides a more relaxed way to consider a subject and joins things together. Often it makes sense to read while away from the product in a more comfortable environment.
Description#
Discussion documentation doesn’t have a natural part in the user’s practice or work, which can appear to reduce its importance.
Discussion documentation may be less urgent than tutorials, how-tos and reference documentation, but it is no less critical.
Discussion documentation is explanatory information that weaves it all together. Without discussion documentation, the users grasping and holding onto the subject concepts can be diminished.
Boundaries#
Writing good discussion documentation is difficult due to the open-ended nature of its scope.
Rarely is specific discussion documentation written; it is more likely to be scattered in small sections throughout tutorials, how-tos and references.
One place to start writing good discussion documentation is with a question, Why? From here, it is possible to set some rough scope boundaries to get started.
FAQ can provide a subject to get started; here are real-world reasons to write a discussion document.
How-to write Discussions#
Connections
Discussions help spin the web of understanding for your readers. Connections, even to things outside the immediate topic, can add clarity and context.
Context
Tell a story—the background and why things have progressed to this point, historical reasons, design decisions, statutory obligations, and technical constraints may all be part of the story.
If a good example can be shared, that provides additional context, then consider including that.
Whats in a name
Naming your discussion can be either explicit or implicit. The discussion document is a high-level view of the subject; therefore, being precise is not required.
Just an opinion
Consider alternatives and other options in your discussion. Discussing pro’s and cons opens up the topic to be more informative and perhaps guide the reader onto other material in their quest for knowledge.
Discussions may sometimes seem bare; however, providing links to tutorials, how-to’s and reference material where appropriate is better than confusing the the focus of the discussion.
Further Reading#
For further interesting reading on this topic, see Diátaxis Explanation
Document Templates#
See a list of the Document Templates we have completed below.
Index Template#
Use the copy button and paste the template into your new index.
Note
Change the highlighted line numbers 3, 6 and 8 to suit you use case.
Tip
Remove the optional highlighted toctree
options that aren’t required.
See Sphinx toctree for more information about toctree options.
1.. include:: /extras.rst.txt
2.. highlight:: rst
3.. index:: template-index ; Index
4
5
6.. _template-index:
7================
8Index Title Here
9================
10
11An optional brief description describes the index.
12
13
14.. toctree::
15 :titlesonly:
16 :maxdepth: int
17 :hidden:
18 :caption:
19 :includehidden:
20 :reversed:
21 :numbered:
22 :glob:
to include .rst files in the TOC
/path-to-first-page
/path-to-second-page
to include markdown files in the TOC use the full name with file extension
/path/to/markdown-file.md
reST Documentation#
What is it: One or two lines description
Why does it exist: One or two lines description
How-to#
How-to: Write one or two lines describing the in-depth explanation that follows.
Use admonitions, inline-tabs and other reST tools to get a concise message across.
Demonstrate what the reST code will look like here.
1Add reST here
Reference#
Many other examples follow below, in the How it Looks and reST syntax tabs.
First Example#
Have reST syntax to render how an example looks here.
1Have the reST syntax here; this should mirror the How it Looks tab.
Discussion#
Further Reading#
For further interesting reading on this topic, see Name of the link.
Tutorial Template#
Two Tutorial Template copy options are available:
Copy a tutorial template with some examples and hints in each section to help you get started.
Copy an empty tutorial template framework.
Use the copy button and paste the tutorial template into your new tutorial.
See the rst code in Template with Examples
rendered here.
Important
The highlighted items are the template parts to modify for your use case.
Examples provided in the Tutorial body
are for demonstration
purposes.
Delete any examples that you wish to.
1.. include:: /extras.rst.txt
2.. highlight:: rst
3.. index:: template-tutorial ; Index
4
5
6.. _template-tutorial:
7================
8Name of Tutorial
9================
10
11|
12
13A brief description about the tutorials aims.
14
15.. admonition:: Example - Using Admonitions
16
17 Use notes to bring something to the user's attention where it improves
18 user experience.
19
20 See `Write a tutorial using Diataxis <https://junction-box.readthedocs.io/en/
21 latest/Document-Framework/diataxis-tutorials.html>`_
22 for assistance on how to write a well-structured tutorial.
23
24|
25
26Pre-requisites
27==============
28
29Examples of pre-requisites
30
31`Python 3.6 <https://www.python.org/downloads/>`_ or greater installed on
32your computer.
33
34:ref:`Create an index page.<template-index>`
35
36
37.. _the-name-tutorial:
38Tutorial
39========
40
41
42
43.. _first-step-title:
44First Step Title
45----------------
46
47Select the tab for your preferred Operating System.
48
49.. admonition:: Example - Using Admonitions
50
51 You can use numbered step headings; however, well-described titles appear
52 to flow in the TOC.
53
54 Using Tabs can condense the page and group logical items together,
55 for example, different Operating Systems have various commands
56 to achieve the same outcome.
57
58 See this example below.
59
60.. tab:: Linux
61
62 Do some linux command.
63
64.. tab:: macOS
65
66 Do some macOS command.
67
68.. tab:: Windows
69
70 Do some Windows command.
71
72Whats next?
73-----------
74
75.. hint::
76
77 Here you can guide the user to expand their knowlege with relevant
78 information.
79
80 For example:
81
82 See `Diataxis Introduction <https://junction-box.readthedocs.io/en/latest/Document-Framework/diataxis-intro.html>`_
83 for more information about writing documentation.
1.. include:: /extras.rst.txt
2.. highlight:: rst
3.. index:: template-tutorial ; Index
4
5
6.. _template-tutorial:
7================
8Name of Tutorial
9================
10
11|
12
13A brief description about the tutorials aims.
14
15|
16
17Pre-requisites
18==============
19
20|
21
22.. _the-name-tutorial:
23Tutorial
24========
25
26|
27
28.. _first-step-title:
29First Step Title
30----------------
31
32|
33
34Whats next?
35-----------
An index for design ideas chosen or considered for our project.
Design Principles#
Design UX Introduction#
Summary#
User experience aims to provide positive experiences for the user. Some benefits are:
Reduce cognitive load on the user to complete a task.
Help improve user productivity.
Improve customer loyalty.
Help improve the customers’ journey to ensure business success.
UX design process summary#
Clever user experience design starts by following a simple process of
Identifying the users’ problem.
Listening and steering ideas to the solution.
Using Who, What, Why, How and When logic, we can build a simple design framework to get started. Some ideas are listed below.
Who has the problem?
end-users,
a business group or
others.
What is the problem?
Can the problem be solved with a UX design solution?
What features will solve the problem?
Why do users need this solution?
Has the need been well defined?
Has the benefit been well defined?
How will the solution be implemented?
When will the solution be required?
This stage is for budget and resource estimates.
UX Design process detail#
Who#
Getting to know the users allows you to understand their needs and gives them a voice in the solution.
Create a user persona representing a particular user of the product or service you are designing.
What#
The design process may combine some or all of these suggestions.
Conduct business representative interviews to understand the business needs. are under consideration?
Conduct user interviews and, where possible, spend time with them interacting with their existing system.
Write short descriptions of the features the user would like and the problems it will solve.
Why#
Clearly define each “problem” and each “benefit” in a report from information gathered in the “What” step.
How#
Some things to help complete this step are:
Functionality mapping: This is a hierarchy of pages and subpages. Functionality maps can help accurately map user workflows.
Wireframes: Visual guides to how the solution looks and feels. Users can use wireframes to provide input to remove useability issues before the development process begins.
Prototype: A mockup of the final product.
User testing: Users have the prototype to test and resolve issues before going to development.
When#
Often this is the first thing you need to understand; it can drive all the other steps timeframes, resource allocation and so on.
UX Design Tips#
Here are eight tips to help improve the UX design process:
Rely on a design system, for example, Figma.
Create a natural flow through the User Interface.
Starting left and moving right is one natural flow style; there may be others more valuable. What’s important is to follow the natural flow identified.
Following a left to right workflow, to go back, the user sees this as moving left, so the “back” button should be on the left side of the screen, not the right.
Following a left to right workflow, the “previous” button is on the left, and the “next” button is on the right.
Colours have meaning.
A simple system is
Errors are red.
Warnings are orange.
Ok is green.
Use one colour for clickable components and other colours for accents.
Using opacity can assist with the appearance of flows by reducing the visual impact and alerting the user.
Icons can provide additional information to the user if coloured and positioned appropriately.
Have a single primary clickable action per screen.
Decide what the primary purpose of the screen is.
Make any clickable actions on the screen less prominent, for example, changing them to outline instead of solid colour.
Separate navigation from actions.
Be obvious between the navigation and action settings within navigation bars, e.g. use buttons to distinguish the differences.
Make your user interface predictable.
Be careful adding and removing dynamic elements from the interface.
Good example
Disable <send email> action button while no user selected
Enable <send email> action button when a user is selected.
Bad example
Hide <send email> action button while no user selected
Show <send email> action button when a user is selected.
Use space to separate things.
Use spacing to define grouped items.
Use spacing to define different user interface sections.
Build an intuitive interface for the user.
The user interface should make the users’ experience as easy as possible.
Don’t design the user interface around how the system works.
When user input is required for an action to occur, e.g. selecting a check box, action buttons for that action should be disabled until user input is received.
When valid user input is required for an action to occur, e.g. an email address, action buttons should be disabled until validated user input is received.
These eight steps have been summarised from this fantastic tutorial about UX Design by ArjanCodes.
Design with Tailwind css and Figma#
Tailwindcss, a utility first CSS framework with classes that can be composed to build any website design directly in your markup.
Figma, a free UX design tool, allows the entire team to interact with the latest web design by accessing a single, live URL.
Figma helps teams create, test, and ship better website designs from start to finish.
Figma Tutorial#
Tailwind Tutorials#
Tailwind from zero to hero series
Figma & Tailwind - Build Sign-in and Registration forms with Auto Layout and grids
Generally we follow PEP 8 in our Python code.
Style Guides#
Style Guide#
What#
Style guides provide guidelines for presenting your Brand from a visual and written perspective.
How#
Provide well-written style guides developed from six essential areas:
Your story.
Your logo.
Your colours.
Your voice.
Your imagery.
and Typography.
Why#
Style guides establish consistent usage of language and layout across several different contributors.
Well structured and written style guides, including layouts for the four pillars of Diátaxis content framework, reduce the load on technical and content creators.
When#
Right now is an excellent time to start.
See our list of style guides below.
Tip
Style guides are under construction… More to come : )
Developer Styles#
Git#
Commit Message#
The git commit message follows the Conventional Commits style.
1
2# tag(subject):<Description> #nn being the issue number if it exists
3# (subject): CHANGELOG update groups items with the same subject.
4# |<---- Preferably using up to 50 chars --->|<--Max of 72 chars-->|
5# Example: docs(style):Added a new reST style guide #42
6
7
8# (Optional) Explain why this change is being made
9# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
10# Example: There wasnt a reST style guide.
11
12
13# (Optional) Provide links or keys to any relevant tickets, articles or other resources
14# Example: closes #42
15
16
17# --- COMMIT END ---
18# Tags with ** will be included in the CHANGELOG
19# ** chore (a chore that needs to be done)
20# dbg (changes in debugging code/frameworks; no production code change)
21# defaults (changes default options)
22# ** docs (changes to documentation)
23# ** feat (new feature)
24# ** fix (bug fix)
25# hack (temporary fix to make things move forward; please avoid it)
26# license (edits regarding licensing; no production code change)
27# ** perf (performance improvement)
28# ** refactor (refactoring code)
29# ** style (formatting, missing semi colons, etc; no code change)
30# ** test (adding or refactoring tests; no production code change)
31# version (version bump/new release; no production code change)
32# WIP (Work In Progress; for intermediate commits to keep patches reasonably sized)
33# jsrXXX (patches related to the implementation of jsrXXX, where XXX the JSR number)
34# jdkX (patches related to supporting jdkX as the host VM, where X the JDK version)
35#
36# --------------------
37# Remember to:
38# * Capitalize the subject line start
39# * Use the imperative mood in the subject line
40# * Do not end the subject line with a period
41# * Separate subject from body with a blank line
42# * Use the body to explain what and why vs. how
43# * Can use multiple lines with "-" or "*" for bullet points in body
44# --------------------
Important
For Auto-generate CHANGELOG Github Action to pick up the changes, the heading must be in the following format.
tag(subject):<Description> #nn being the issue number if it exists
Example: docs(style):Added a new reST style guide #42
(subject): The CHANGELOG’s update groups items with the same subject.
CHANGELOG#
Two Auto-generate CHANGELOG yaml files use BobAnkh/auto-generate-changelog.
The first, below, updates the CHANGELOG for the repo and includes additional tags to assist the developers, particularly with WIP.
Important
Don’t forget to change line 21 REPO_NAME if you are using this for your Github repo.
Important
Don’t forget to change line 22 REPO_NAME if you are using this for your Github repo.
More to come:
reStructured Text Style#
There may be a need to modify one of the pre-existing templates or create a new one to improve how the author can convey their message.
For those occasions, here is Junction Box’s reST styling guide.
Text Emphasis#
Bold and Italic#
Sphinx can render text as either bold or italic but not both.
1Normal text, **bold text** and *italic text*.
See the styling above rendered by Sphinx below.
Normal text, bold text and italic text.
Line Spaces#
Line spaces can help emphasise text in some cases.
Text not separated by a blank line will join.
Blank lines in reST don’t render as blank lines in the document.
Line spaces will render when using the | symbol.
1 Text on line 1
2 Text on line 2
3
4
5
6
7 Text on line 4
8
9 |
10
11 Text on line 6
See the styling above rendered by Sphinx below.
Text on line 1 Text on line 2
Text on line 4
Text on line 6
Important
See the effect of no line separation between Text on line 1 and Text on Line 2.
| symbol is not rendered but provides a clean line space.
Document Headings#
In reST, you can use different underlining styles in any order.
For reST (.rst) Title and Heading styles, see below.
1 ========
2 DocTitle
3 ========
4
5 Heading 1
6 =========
7
8 Heading 1.1
9 -----------
10
11 Heading 1.1.1
12 ~~~~~~~~~~~~~
13
14 Heading 1.1.1.1
15 """""""""""""""
See the styling above rendered by Sphinx below.
DocTitle#
Heading 1#
Heading 1.1#
Heading 1.1.1#
Heading 1.1.1.1#
Links#
Link to a Heading#
Sphinx provides the ability to link to internal document references.
1.. _random-heading:
2
3Random Heading
4==============
5
6Some random text to help with some unexpected challenges.
7
8
9
10
11
12See here :ref:`random-heading` for information to help with your unexpected challenge.
Important
Sphinx is sensitive to line spaces in this scenario.
If your link doesn’t appear, check for an empty line between the internal link reference and the heading declaration.
See the styling above rendered by Sphinx below.
Random Heading#
Some random text to help some unexpected challenge.
Scroll down so “Random Heading” is off the screen, and click the hyperlink to see the internal linking in action.
See here Random Heading for information to help with your unexpected challenge.
Important
The :ref:`random heading-link` text is surrounded by backticks, not single apostrophe’s!
API Summary Index#
This page displays how autosummary displays the API summary.
Click one of the options below to see autoclasstoc grouping.
Sphinx Examples#
The environment in which the ReST files are translated. |
|
|
Return a relative URL from |
Local Examples#
This class docstring shows how to use sphinx and rst syntax |
|
A very very simple set of calculators |
Indices and tables#
How-To#
See below for a list of How-To for Junction Box.
Linux Servers#
See below for a list of Linux Server How-To for Junction Box.
CLI Cheat Sheet#
Docker#
A selection of useful Docker CLI commands, with copy button convenience.
Show me#
Stop#
docker stop <container-id>
docker stop $(docker ps -a -q)
Prune / Delete#
Docker takes a conservative approach to remove unused objects. Items such as images, containers, volumes, and networks are generally not removed unless you explicitly ask Docker to do so. The result is Docker uses extra disk space.
To solve this problem, Docker provides a prune command for each type of object.
Docker also provides docker system prune
[1] to clean up multiple types
of objects at once.
See a selection of the most commonly used Docker commands for the development of the django-cookiecutter project below.
docker container prune
docker image prune
docker image prune -a
docker network prune
docker volume prune
One command to rule them all…
Suppose you want to do a major cleanup with one command.
Ensure nothing happens to your production stack; make sure your production stacks are running.
Warning
WARNING! This will remove:
all stopped containers.
all networks not used by at least one container.
all dangling images.
all dangling build cache.
docker system prune
Linux-macOS-Windows#
A selection of useful CLI commands, with copy button convenience.
Check Ports#
Useage options: LISTEN
, ESTABLISHED
and CLOSED
.
sudo lsof -i -P -n | grep LISTEN
sudo lsof -i:22 ## see a specific port such as 22 ##
sudo nmap -sTU -O IP-address-Here
sudo ss -tulpn | grep LISTEN
Hint
ss command options.
-t
: Show only TCP sockets on Linux.
-u
: Display only UDP sockets on Linux.
-l
: Show listening sockets. For example, TCP port 22 is opened by SSHD server.
-p
: List process name that opened sockets.
-n
: Don’t resolve service names i.e. don’t use DNS.
Useage options:
LISTEN
,ESTABLISHED
andCLOSED
.
sudo lsof -i -P -n | grep LISTEN
netstat -a -n | grep 'LISTEN '
Hint
command options.
-i
: for IPv4 and IPv6 protocols.
-p
: Display raw port number, not resolved names like ftp
, http
.
-P
: Omit the port names.
-n
: Don’t resolve service names i.e. don’t use DNS.
-a
: [Netstat] Show all sockets.
-n
: [Netstat] Don’t resolve service names i.e. don’t use DNS.
netstat -bano | more
netstat -bano | grep LISTENING
netstat -bano | findstr /R /C:"[LISTEING]"
Django Secret Key#
To generate a Django secret key, in your favourite CLI paste the code below and hit enter.
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
Copy the key generated and exit the python shell.
Caution
If you are storing your secret key in an environment variable.
In linux style OS the secret key must be enclosed in ” “.
If not an error may be raised and the key may not save.
export SECRET_KEY="YOUR_SECRET_KEY"
See here for a tutorial about creating environment variables.
Footnotes
Security - Fail2Ban#
What is Fail2Ban#
extract from Fail2Ban website
Fail2Ban scans log files like /var/log/auth.log and bans IP addresses conducting too many failed login attempts. It does this by updating system firewall rules to reject new connections from those IP addresses for a configurable amount of time. Fail2Ban comes out-of-the-box ready to read many standard log files, such as those for sshd and Apache, and readily configured to read any log file of your choosing for any error you wish.
Though Fail2Ban can reduce the rate of incorrect authentication attempts, it cannot eliminate the risk presented by weak authentication. Set up services to use only two factor or public/private authentication mechanisms if you want to really protect services.
Install and Default Configure#
Log into your server.
Update the server and install Fail2Ban.
sudo apt update
sudo apt upgrade
sudo apt install fail2ban
Check fail2ban has installed.
sudo systemctl status fail2ban
Example output.
● fail2ban.service - Fail2Ban Service
Loaded: loaded (/lib/systemd/system/fail2ban.se>
Active: active (running) since Fri 2021-11-26 0>
Docs: man:fail2ban(1)
Process: 636 ExecStartPre=/bin/mkdir -p /run/fai>
Main PID: 650 (f2b/server)
Tasks: 5 (limit: 1136)
Memory: 14.9M
CGroup: /system.slice/fail2ban.service
└─650 /usr/bin/python3 /usr/bin/fail2ba>
Check what fail2ban is doing for us.
sudo fail2ban-client status
Example output, showing 1 jail is in use and that is sshd. Monitoring sshd is a default setting fail2ban comes with out of the box.
Status
|- Number of jail: 1
`- Jail list: sshd
Move to the root users fail2ban config folder.
sudo cd etc/fail2ban/
sudo ls
Example output
action.d jail.d
fail2ban.conf paths-arch.conf
fail2ban.d paths-common.conf
filter.d paths-debian.conf
jail.conf paths-opensuse.conf
Copy jail.conf to jail.local. The local folder is the preferred way to configure fail2ban. The reason is that jail.conf may be overwriten during updates.
sudo cp jail.conf jail.local
Using your favourite text editor, you can inspect and edit jail.local to suit your configuration needs.
Under the JAILS section, items in [brackets] are options you can enable.
See line 291
as an example of an enabled option.
Everything below the bracketed option is the configuration for that option.
Line numbers are indicative and may be different in your editor.
272 # JAILS 273 # 274 275 # 276 # SSH servers 277 # 278 279 [sshd] 280 281 # To use more aggressive sshd modes set filter pa rameter "mode" in jail.local: 282 # normal (default), ddos, extra or aggressive (co mbines all). 283 # See "tests/files/logs/sshd" or "filter.d/sshd.c onf" for usage example and details. 284 #mode = normal 285 port = ssh 286 logpath = %(sshd_log)s 287 backend = %(sshd_backend)s 288 289 290 [dropbear] 291 enabled = true 292 port = ssh 293 logpath = %(dropbear_log)s 294 backend = %(dropbear_backend)s 295 296 297 [selinux-ssh] 298 299 port = ssh 300 logpath = %(auditd_log)s 301 302
Restart fail2ban.
sudo systemctl restart fail2ban
Check fail2ban status.
sudo fail2ban-client status
Example output after updating and saving jail.local, notice the new service
dropbear`
has been enabled in Jail list:
.
Status
|- Number of jail: 2
`- Jail list: dropbear, sshd
Inspect fail2ban log file.
sudo cat /var/log/fail2ban.log
Example output
--------------------------------------------------
2021-11-26 06:11:47,432 fail2ban.server [3089]: INFO Starting Fail2ban v0.11.1
2021-11-26 06:11:47,434 fail2ban.observer [3089]: INFO Observer start...
2021-11-26 06:11:47,439 fail2ban.database [3089]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
2021-11-26 06:11:47,440 fail2ban.jail
2021-11-26 05:45:02,953 fail2ban.jail [2566]: INFO Jail 'dropbear' uses pyinotify {}
2021-11-26 05:45:02,957 fail2ban.jail [2566]: INFO Initiated 'pyinotify' backend
2021-11-26 05:45:02,963 fail2ban.filter [2566]: INFO maxRetry: 5
2021-11-26 05:45:02,963 fail2ban.filter [2566]: INFO findtime: 600
2021-11-26 05:45:02,964 fail2ban.actions [2566]: INFO banTime: 600
2021-11-26 05:45:02,964 fail2ban.filter [2566]: INFO encoding: UTF-8
Inspect fail2ban individual jail.
sudo fail2ban-client status sshd
Example output
Status for the jail: sshd
|- Filter
| |- Currently failed: 1
| |- Total failed: 1
| `- File list: /var/log/auth.log
`- Actions
|- Currently banned: 0
|- Total banned: 0
`- Banned IP list:
Further Reading#
Here is an excellent YouTube tutorial video on the subject.
LearnLinuxTV Securing your Cloud Server with Fail2Ban.
reST#
See a list of the How-to help files below.
Introduction to reST and Sphinx#
reStructuredText, commonly referred to as reST, is an easy-to-read plaintext markup syntax and parser system.
It is excellent for inline program documentation (such as Python docstrings), quickly creating simple web pages and standalone documents using Sphinx.
Paragraphs#
Paragraphs are text separated by one or more blank lines.
1This is some text in a paragraph.
2This is some more text in the same paragraph.
3Here is more text that is written in the first paragraph.
4
5This is some text in a New paragraph.
See Paragraph styling above rendered by Sphinx below.
This is some text in a paragraph. This is some more text in the same paragraph. Here is more text that is written in the first paragraph.
This is some text in a New paragraph.
Note
The next code block took from the following example of using text in a paragraph from here.
1Paragraphs contain text and may contain inline markup:
2*emphasis*, **strong emphasis**, `interpreted text`, ``inline
3literals``, standalone hyperlinks (http://www.python.org),
4external hyperlinks (Python_), internal cross-references
5(example_), footnote references ([#1]_), citation references
6([CIT2002]_), substitution references (|example|),
7and _`inline internal targets`.
8
9Paragraphs are separated by blank lines and are left-aligned.
See Paragraph styling above rendered by Sphinx below.
Paragraphs contain text and may contain inline markup:
emphasis, strong emphasis, interpreted text
, inline
literals
, standalone hyperlinks (http://www.python.org),
external hyperlinks (Python), internal cross-references
(example), footnote references ([2]), citation references
([CIT2002]), and inline internal targets.
Paragraphs are separated by blank lines and are left-aligned.
Indentation#
All indentation is significant; the level of indentation must be consistent. For example, indentation is the sole markup indicator for block quotes.
Note
This example of using text in a paragraph was taken from here
1This is a top-level paragraph.
2
3 This paragraph belongs to a first-level blockquote.
4
5 This paragraph belongs to a second-level blockquote.
6
7This is another top-level paragraph.
8
9 This paragraph belongs to a second-level block quote.
10
11This paragraph belongs to a first-level block quote. The
12second-level block quote above is inside this first-level
13block quote.
See Indentation styling above rendered by Sphinx below.
This is a top-level paragraph.
This paragraph belongs to a first-level blockquote.
This paragraph belongs to a second-level blockquote.
This is another top-level paragraph.
This paragraph belongs to a second-level block quote.
This paragraph belongs to a first-level block quote. The second-level block quote above is inside this first-level block quote
Further Reading#
For further interesting reading on this topic, see reST How-to Index
Example of links used in test.
Here is a footnote numbered 1.
Here is the citation for CIT2002
Click to go back to the link examples above: .. code-block:: rest
Admonition Messages#
Admonitions are a particular group of reST directives.
Admonitions purpose is to highlight a message to the user with colour and formatting.
How-to#
The code block below demonstrates the syntax for one of the available admonition styles and is the “note” directive.
1.. note:: Text in the title bar or
2 on the first row will be displayed
3 in the message body, with one exception. The general purpose
4 :sep:`.. admonition::` includes text in the Title bar as a title.
5
6 See :ref:`Admonition <reference-admonition>` for details.
7
8 Here is the note admonition...
Pay attention to the spacing of the highlighted message block line.
As you can see below, this renders correctly.
Note
Text in the title bar or on the first row will be displayed in the message body, with one exception. The general purpose .. admonition:: includes text in the Title bar as a title.
See Admonition for details.
Here is the note admonition…
1.. note:: Text in the title bar or 2 on the first row will be displayed 3 in the message body, with one exception. The general purpose 4 :sep:`.. admonition::` includes text in the Title bar as a title. 5 6 See :ref:`Admonition <reference-admonition>` for details. 7 8 Here is the note admonition... 9 10 Here is the note admonition...
Here the spacing of the highlighted message block lines doesn’t produce the desired layout for this example.
As you can see below, this does not render correctly.
Note
- Text in the title bar or
on the first row will be displayed in the message body, with one exception. The general purpose .. admonition:: includes text in the Title bar as a title.
See Admonition for details.
Here is the note admonition…
Here is the note admonition…
Reference#
Many other examples follow below, in the How it Looks and reST syntax tabs.
Admonition#
A generic, Titled admonition
This is some random text on the topic.
1.. admonition:: A generic, Titled admonition
2
3 This is some random text on the topic.
Warning
Admonition directive Title is required!
The syntax must look like this .. admonition:: Some User Title. or this particular style may not render correctly.
See also#
See also
Admonitions in docutils.
1 .. seealso::
2
3 Admonitions in `docutils <http://docutils.sourceforge.net/0.7/docs/ref/rst/directives.html#admonitions>`__.
Note#
Note
Here is a short note.
1.. note::
2
3 Here is a short note.
Tip#
Tip
A tip is an idea that can help.
1.. tip::
2
3 A tip is an idea that can help.
Hint#
Hint
A hint is an indirect suggestion or advice.
1.. hint::
2
3 A hint is an indirect suggestion or advice.
Important#
Important
Important information that should be considered.
1.. important::
2
3 Important information that should be considered.
Caution#
Caution
Caution dragons may live here.
1.. caution::
2
3 Caution dragons may live here.
Warning#
Warning
Warning dragons probably live here.
1.. warning::
2
3 Warning dragons probably live here.
Danger#
Danger
Danger dragons do live here.
1.. danger::
2
3 Danger dragons do live here.
Attention#
Attention
Look out the dragon has seen you!
1.. attention::
2
3 Look out the dragon has seen you!
Error#
Error
Ooops to late you didnt heed all the messages about dragons…
1.. error::
2
3 Ooops to late you didnt heed all the messages about dragons...
Discussion#
Please consider the display order of admonitions in the Reference section and the accompanying messages in each.
You may notice a hierarchy of colour and message urgency as you scroll down the page.
This hierarchy is a good guide for using the admonitions in your documentation and serves as a reference to maintain consistency in admonitions usage.
There are a few different ways to write admonitions. Depending on the length and style of the message, each has its merits.
For example, this works, but it looks messy in the text file.
1.. note:: Here is a line of
2 text that doesn't produce anything of interest; it just looks messy and challenging to follow in the text file where it's written. The line width is too wide for the text editor,
3 and you need to scroll to get the message
Note
Here is a line of text that doesn’t produce anything of interest; it just looks messy and challenging to follow in the text file where it’s written. The line width is too wide for the text editor, and you need to scroll to get the message
Here are two alternative ways to layout the same .. note:: and text that improves the source text files readability and produce the same output as the first example.
1.. note::
2 Here is a line of text that doesn't produce anything of interest;
3 it just looks messy and challenging to follow in the text file
4 where it's written. The line width is too wide for the text editor,
5 and you need to scroll to get the message
1.. note::
2
3 Here is a line of text that doesn't produce anything of interest;
4 it just looks messy and challenging to follow in the text file
5 where it's written. The line width is too wide for the text editor,
6 and you need to scroll to get the message
Here are two short message options for a readable layout in the text editor. Both produce the same results.
1.. note:: Here is a short message.
2
3.. note::
4
5 Here is a short message.
Note
Here is a short message.
Admonition messages give you the flexibility to combine many different reST options to provide a rich statement.
See below for some demonstrated common options.
1.. note::
2
3 Here is a short message with **bold** text.
4
5 Here is a short message *with some italic text.*
6
7 Here is some short text with an indentation!
8
9 Here is a link to :ref:`Reference <reference-admonitions>`.
10
11 Here is a link to `Google <https://google.com>`__.
Further Reading#
For further interesting reading on this topic, see reStructuredText directives in docutils documentation.
In-Line-Tabs#
Basic#
Create a tab with the tab directive. Consecutive tab directives create a single set of tabs.
1 This is text before the tabs.
2
3 .. tab:: First
4
5 First tab text is interesting.
6
7 .. tab:: Second
8
9 Second tab text is twice as interesting as the first tab.
10
11 .. tab:: Third
12
13 Third tab is an odd one indeed.
14
15 .. tab:: Fourth
16
17 Fourth is four times better.
18
19 Text directly below the tabs will be visible in all the tabs and
20 does not break the document flow.
See the styling above rendered by Sphinx below.
This is text before the tabs.
First tab text is interesting.
Second tab text is twice as interesting as the first tab.
Third tab is an odd one indeed.
Fourth is four times better.
Text directly below the tabs will be visible in all the tabs and does not break the document flow.
Multiple Tab Sets#
It is possible to start a new tab within an existing tab by placing content between sets or providing the :new-set: option to the tab directive.
1 This is text before the tabs.
2
3 .. tab:: First
4
5 First tab text is interesting.
6
7 .. tab:: Second
8
9 Second tab text is twice as interesting as the first tab.
10
11 .. tab:: Third
12
13 Third tab is an odd one indeed.
14 .. tab:: Fourth
15
16 Fourth is four times better.
17 .. tab:: Fifth
18 :new-set:
19
20 Five is a nice number.
21
22 .. tab:: Sixth
23
24 Six is also nice.
See the styling above rendered by Sphinx below.
This is text before the tabs.
First tab text is interesting.
Second tab text is twice as interesting as the first tab.
Third tab is an odd one indeed.
Fourth is four times better.
Five is a nice number.
Six is also nice.
Code in Tabs#
Code-block’s in a tabs’ content area will display in the tab contents, making things very straightforward for programming language snippets and OS-based command suggestions.
.. tab:: Python
.. code-block:: Python
:linenos:
print("Hello World!")
.. code-block:: Python
print("Another Hello World!")
.. tab:: Yaml
.. code-block:: Yaml
:linenos:
name: Auto-generate CHANGELOG-WIP
on:
# release:
# types: [created, edited]
# # schedule:
# - cron: "0 14 * * *"
# push:
# branches:
# - main
workflow_dispatch:
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: BobAnkh/auto-generate-changelog@master
with:
REPO_NAME: "your repo/your-project"
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
PATH: "/CHANGELOG.md"
COMMIT_MESSAGE: "docs(CHANGELOG): update release notes:repo"
TYPE: "chore:Chore,feat:Feature,fix:Bug Fixes,docs:Documentation,
perf:Performance Improvements,refactor:Refactor,style:Styling,test:Tests, WIP:In Progress"
.. tab:: C++
.. code-block:: C++
:linenos:
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
}
See the styling above rendered by Sphinx below.
1print("Hello World!")
1print("Another Hello World!")
1name: Auto-generate CHANGELOG-WIP
2on:
3# release:
4# types: [created, edited]
5# # schedule:
6# - cron: "0 14 * * *"
7# push:
8# branches:
9# - main
10workflow_dispatch:
11
12jobs:
13generate-changelog:
14 runs-on: ubuntu-latest
15 steps:
16 - uses: actions/checkout@v2
17 with:
18 fetch-depth: 0
19 - uses: BobAnkh/auto-generate-changelog@master
20 with:
21 REPO_NAME: "your repo/your-project"
22 ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
23 PATH: "/CHANGELOG.md"
24 COMMIT_MESSAGE: "docs(CHANGELOG): update release notes:repo"
25 TYPE: "chore:Chore,feat:Feature,fix:Bug Fixes,docs:Documentation,
26 perf:Performance Improvements,refactor:Refactor,style:Styling,
27 test:Tests, WIP:In Progress"
1#include <iostream>
2
3int main() {
4std::cout << "Hello World!" << std::endl;
5}
Synchronisation#
With JavaScript enabled on the end users browser, Tabs across multiple sets will synchronise unconditionally.
Hint
Synchronisation behaviour is unconditional because tabbed content usually stays consistent, for example, the Operating System or programming language.
.. tab:: Unix (MacOS / Linux)
.. code-block:: console
:linenos:
$ python -m pip install sphinx
.. tab:: Windows
.. code-block:: console
:linenos:
$ py -m pip install sphinx
.. tab:: Unix (MacOS / Linux)
:new-set:
.. code-block:: console
:linenos:
$ make html
.. tab:: Windows
.. code-block:: console
:linenos:
$ make.bat html
See the styling above rendered by Sphinx below.
Click on the Windows tab to see Synchronisation in action.
1$ python -m pip install sphinx
1$ py -m pip install sphinx
1$ make html
1$ make.bat html
Hint
For good document flow, keep the tab order the same throughout the document. As shown above, Unix precedes Windows.
Nesting#
Nested Tabs allow the creation of decision trees using tabs. Nested tabs are also synchronised.
.. tab:: Unix (MacOS / Linux)
.. tab:: Bash
.. code-block:: Bash
:linenos:
bash
.. tab:: Zsh
.. code-block:: Zsh
:linenos:
zsh
.. tab:: Windows
.. tab:: Command Prompt
.. code-block:: console
:linenos:
cmd.exe
.. tab:: Powershell
.. code-block:: Powershell
:linenos:
ps2.exe
See the styling above rendered by Sphinx below.
1bash
1zsh
1cmd.exe
1ps2.exe
File Inclusion#
..literalincludes:: is a particular Sphinx reST directive.
..literalincludes:: purpose is to read and render text files into the documentation.
How-to#
Caution
..literalinclude
does not use the System Path to connect to target
files. The target files location is relative to the calling file.
Often the target file is in the same folder as the calling file, as in this example, see the reST syntax tab for the code.
See the Path Examples tab for more information on how to access target files in different directories.
1Example file for literal include: file_tree_literal_include_example_1.txt
2
3junction-box
4├── file_tree_literal_include_example_2.txt
5├── code_examples
6│ ├── __init__.py
7│ ├── __pycache__
8│ │ ├── __init__.cpython-39.pyc
9│ │ ├── reST_docstrings_example.cpython-39.pyc
10│ │ ├── simple_calculators_example.cpython-39.pyc
11│ │ └── square_example.cpython-39.pyc
12│ ├── reST_docstrings_example.py
13│ ├── simple_calculators_example.py
14│ └── square_example.py
15│
16│
17└── docs
18 └── source
19 ├── _static
20 │ ├── code_examples_2
21 │ │ ├── square_example.py
22 │ │ └── file_tree_literal_include_example_3.txt
23 │ └── css
24 │ └── custom.css
25 └── how-to
26 ├── how-to-docker-linux-cheatsheet.rst
27 ├── index-how-to.rst
28 └── reST
29 ├── file_tree_literal_include_example_1.txt
30 ├── file_tree_literal_include_example_1_old.txt
31 ├── index-reST.rst
32 ├── reST-admonitions.rst
33 ├── reST-inline-tabs.rst
34 ├── reST-intro-rest-sphinx.rst
35 ├── reST-literalinclude-file.rst
36 ├── reST-titles-headings.rst
37 └── reST-toctree.rst
Note
Line 1: Example file name.
Line 26: Location of the file being called.
Line 32: Location of the .. literalinclude::
calling the file.
1.. literalinclude:: file_tree_literal_include_example_1.txt
2:language: text
3:linenos:
4:emphasize-lines: 1, 26, 35
Hint
This example demonstrates ..literalinclude <path-to-file> with the target file three folders above.
1.. literalinclude:: ../../../../file_tree_literal_include_example_2.txt
2 :language: text
3 :linenos:
4 :emphasize-lines: 1, 4, 35
1Example file for literal include: file_tree_literal_include_example_2.txt
2
3junction-box
4├── file_tree_literal_include_example_2.txt
5├── code_examples
6│ ├── __init__.py
7│ ├── __pycache__
8│ │ ├── __init__.cpython-39.pyc
9│ │ ├── reST_docstrings_example.cpython-39.pyc
10│ │ ├── simple_calculators_example.cpython-39.pyc
11│ │ └── square_example.cpython-39.pyc
12│ ├── reST_docstrings_example.py
13│ ├── simple_calculators_example.py
14│ └── square_example.py
15│
16│
17└── docs
18 └── source
19 ├── _static
20 │ ├── code_examples_2
21 │ │ ├── square_example.py
22 │ │ └── file_tree_literal_include_example_3.txt
23 │ └── css
24 │ └── custom.css
25 └── how-to
26 ├── how-to-docker-linux-cheatsheet.rst
27 ├── index-how-to.rst
28 └── reST
29 ├── file_tree_literal_include_example_1.txt
30 ├── file_tree_literal_include_example_1_old.txt
31 ├── index-reST.rst
32 ├── reST-admonitions.rst
33 ├── reST-inline-tabs.rst
34 ├── reST-intro-rest-sphinx.rst
35 ├── reST-literalinclude-file.rst
36 ├── reST-titles-headings.rst
37 └── reST-toctree.rst
Note
Line 1: Example file name.
Line 4: Location of the file being called.
Line 32: Location of the .. literalinclude::
calling the file.
Hint
This example demonstrates ..literalinclude <path-to-file> with the target file up one folder and across two folders.
1.. literalinclude:: ../../_static/code_examples_2/file_tree_literal_include_example_2.txt
2 :language: text
3 :linenos:
4 :emphasize-lines: 1, 22, 35
1Example file for literal include: file_tree_literal_include_example_3.txt
2
3junction-box
4├── file_tree_literal_include_example_2.txt
5├── code_examples
6│ ├── __init__.py
7│ ├── __pycache__
8│ │ ├── __init__.cpython-39.pyc
9│ │ ├── reST_docstrings_example.cpython-39.pyc
10│ │ ├── simple_calculators_example.cpython-39.pyc
11│ │ └── square_example.cpython-39.pyc
12│ ├── reST_docstrings_example.py
13│ ├── simple_calculators_example.py
14│ └── square_example.py
15│
16│
17└── docs
18 └── source
19 ├── _static
20 │ ├── code_examples_2
21 │ │ ├── square_example.py
22 │ │ └── file_tree_literal_include_example_3.txt
23 │ └── css
24 │ └── custom.css
25 └── how-to
26 ├── how-to-docker-linux-cheatsheet.rst
27 ├── index-how-to.rst
28 └── reST
29 ├── file_tree_literal_include_example_1.txt
30 ├── file_tree_literal_include_example_1_old.txt
31 ├── index-reST.rst
32 ├── reST-admonitions.rst
33 ├── reST-inline-tabs.rst
34 ├── reST-intro-rest-sphinx.rst
35 ├── reST-literalinclude-file.rst
36 ├── reST-titles-headings.rst
37 └── reST-toctree.rst
Note
Line 1: Example file name.
Line 22: Location of the file being called.
Line 32: Location of the .. literalinclude::
calling the file.
See Reference section below for modifying options.
Reference#
Examples follow below, in the How it Looks and reST syntax tabs of using optional classes to change the rendered files appearance.
Line Numbers
1# version: 2
2
3build:
4 image: testing
5
6# formats: [pdf]
7sphinx:
8 configuration: docs/source/conf.py
9
10python:
11 version: 3.9
12 install:
13 - method: pip
14 path: .
15 extra_requirements: [doc]
1.. literalinclude:: ../../../../.readthedocs.yaml
2 :language: yaml
3 :linenos:
Line Highlight
1# version: 2
2
3build:
4 image: testing
5
6# formats: [pdf]
7sphinx:
8 configuration: docs/source/conf.py
9
10python:
11 version: 3.9
12 install:
13 - method: pip
14 path: .
15 extra_requirements: [doc]
1.. literalinclude:: ../../../../.readthedocs.yaml
2 :language: yaml
3 :linenos:
4 :emphasize-lines: 1,2, 10-13
Line Selection
1# version: 2
2
3python:
4 version: 3.9
5 install:
6 - method: pip
Tip
Compare this example with the Line Highlight example above.
As seen in the reST syntax tabs, the same lines have been selected and appear here.
Notice that the line numbers in this example are consecutive and don’t indicate the source file line numbers.
1.. literalinclude:: ../../../../.readthedocs.yaml
2 :language: yaml
3 :linenos:
4 :lines: 1,2, 10-13
Code Language
See also
All examples above have used a single yaml file to display the options.
Other code language options exist, and here is a Python file to demonstrate.
For other supported coding languages see Pygments Lexers
1""" A very very simple square function"""
2
3
4def square(a):
5 """a very simple squaring function
6
7 long description: returns the square of a: :math:`a^2`
8
9 :param a: an input argument
10
11 :returns: a*a
12 """
13 return a * a
1.. literalinclude:: ../../_static/code_examples_2/square_example_2.py
2 :language: python
3 :linenos:
File Diff
1--- /home/docs/checkouts/readthedocs.org/user_builds/junction-box/checkouts/latest/docs/source/how-to/reST/file_tree_literal_include_example_1_old.txt
2+++ /home/docs/checkouts/readthedocs.org/user_builds/junction-box/checkouts/latest/docs/source/how-to/reST/file_tree_literal_include_example_1.txt
3@@ -1,15 +1,37 @@
4-Example file for literal include: File Tree Number 1
5+Example file for literal include: file_tree_literal_include_example_1.txt
6
7 junction-box
8 ├── file_tree_literal_include_example_2.txt
9+├── code_examples
10+│ ├── __init__.py
11+│ ├── __pycache__
12+│ │ ├── __init__.cpython-39.pyc
13+│ │ ├── reST_docstrings_example.cpython-39.pyc
14+│ │ ├── simple_calculators_example.cpython-39.pyc
15+│ │ └── square_example.cpython-39.pyc
16+│ ├── reST_docstrings_example.py
17+│ ├── simple_calculators_example.py
18+│ └── square_example.py
19+│
20+│
21 └── docs
22 └── source
23- └── reST
24- ├── index-reST.rst
25- ├── reST-admonitions.rst
26- ├── reST-inline-tabs.rst
27- ├── reST-intro-rest-sphinx.rst
28- ├── reST-literalinclude-file.rst
29- ├── reST-titles-headings.rst
30- ├── reST-toctree.rst
31- └── file_tree_literal_include_example_1.txt
32+ ├── _static
33+ │ ├── code_examples_2
34+ │ │ ├── square_example.py
35+ │ │ └── file_tree_literal_include_example_3.txt
36+ │ └── css
37+ │ └── custom.css
38+ └── how-to
39+ ├── how-to-docker-linux-cheatsheet.rst
40+ ├── index-how-to.rst
41+ └── reST
42+ ├── file_tree_literal_include_example_1.txt
43+ ├── file_tree_literal_include_example_1_old.txt
44+ ├── index-reST.rst
45+ ├── reST-admonitions.rst
46+ ├── reST-inline-tabs.rst
47+ ├── reST-intro-rest-sphinx.rst
48+ ├── reST-literalinclude-file.rst
49+ ├── reST-titles-headings.rst
50+ └── reST-toctree.rst
1.. literalinclude:: file_tree_literal_include_example_1.txt
2:language: text
3:linenos:
4:diff: file_tree_literal_include_example_1_old.txt
File Encoding
1# version: 2
2
3build:
4 image: testing
5
6# formats: [pdf]
7sphinx:
8 configuration: docs/source/conf.py
9
10python:
11 version: 3.9
12 install:
13 - method: pip
14 path: .
15 extra_requirements: [doc]
Note
Default file encoding is utf-8-sig.
Use this class for different target file encodings, e.g. latin-1.
1.. literalinclude:: ../../../../.readthedocs.yaml
2 :language: yaml
3 :linenos:
4 :encoding: utf-8-sig
Discussion#
The documentation may include more extended text displays by storing the example text in an external plain text file.
Literal include is handy for including code files and has several classes included in the .. code-block:: directive.
It is a more lightweight tool than the Autodoc Sphinx extension to keep small files documentation synchronised with the source file.
Further Reading#
For further interesting reading on this topic, see Spinx Directives.
Titles and Headings#
Titles and headings are reST formats for defining the document structure.
Text is modified with adornments from valid characters to create the document structural elements Title, Heading and Subheadings.
How-to#
Important
Following is the list of valid adornment characters
! ” # $ % & ‘ ( ) * + , - . / : ; < = > ? @ [ ] ^ _ { | } ~
Following is the list of recommended adornment characters
= - ~ ‘ . *
reST does not enforce any particular adornment or order of usage when building the document structure.
The first adornment style encountered will be the top level, and each adornment style discovered after that will increment down the structure.
1==============
2Document Title
3==============
4
5Heading 1 Title
6===============
7
8Section 1 Title
9---------------
10
11Section 2 Title
12~~~~~~~~~~~~~~~
13
14Section 3 Title
15'''''''''''''''
16
17Section 4 Title
18...............
19
20Section 5 Title
21***************
See how the document sections look with the recommended adornments below.
The document structure is visible in the index to the right under How-to.
Document Title#
Heading 1 Title#
Section 1 Title#
Section 2 Title#
Section 3 Title#
Section 4 Title#
Section 5 Title#
Reference#
Reference documentation is included in the reST syntax tab in the How-to section.
Discussion#
Document titles, headings and sections form the structural elements of the documents hierarchy tree.
Sphinx reads these structural elements in the building process and constructs, then renders the Document Tree to the specified format, for example, HTML, pdf and epub.
The Document Titles are the most common element in the Table of Contents (TOC); however, configuring the Document Tree depth using the :maxdepth: directive in the .. toctree:: offers excellent flexibility for the design.
The TOC is a valuable source of information for a user. Structural elements combination planning, completed early in the document writing process, improves user experience and reduces author fatigue.
About#
JUNCTION BOX#
What’s in a name?#
The process of writing software is very similar to the electrical trade in the sense that things are wired up or connected.
Hence the name Junction Box, a place where things are connected.
Overview#
This project is about documenting how we use several technologies that meet the needs of our software development initiatives.
What#
To kick-off, we will be exploring and documenting these technologies:
When how we use the first two items has been documented, other technologies on our list include:
Continuous Delivery: Dave Farley Style.
Django: A python web framework.
Pytest: A software testing tool.
Hypothesis: A software testing tool.
Playwright: End-to-end testing for modern web apps.
How#
Create and follow a style guide.
Create standard layouts for content.
Follow the Diátaxis document content framework.
Only record what we have used and tested.
Why#
You want people to use your project.
If you have good documentation, people are more likely to use your project.
If people are more likely to use your project, you will have more contributors.
If people have trouble installing your project with poor documentation, they are more likely to opt out.
Continuous documentation is a critical task often overlooked or poorly executed.
Over time as memories fade, the need for good quality documentation becomes evident.
Things that make sense now often don’t make sense later.
When it is needed, good documentation can ease the load of remembering.
This may help some one else!
When#
Following Continuous Delivery Principles, this is a living document.
CHANGELOG#
v0.7.1 (2021-11-01)#
Fix#
how-to: Main index link updated to new location #215 (
aa76a29
)
v0.7.0 (2021-11-01)#
Feature#
how-to: Reorganise structure, add CLI cheatsheet #213 (
cac844a
)
v0.6.0 (2021-11-01)#
Feature#
docs: Add Diataxis quickstart document #209 (
064fa1b
)
Fix#
pyup: Exclude autoclasstoc from checks #210 (
a1e68f0
)
v0.5.1 (2021-10-31)#
Fix#
docs: Move changelog to docs folder #202 (
0a3f093
)
v0.5.0 (2021-10-31)#
Feature#
docs: Add additional Tutorial Template #199 (
629e1f0
)
v0.4.1 (2021-10-31)#
Fix#
docs: Fix version source in conf.py #194 (
a862ebd
)
v0.4.0 (2021-10-31)#
Feature#
docs: Add sem-ver changelog to docs #190 (
811b056
)
v0.3.1 (2021-10-31)#
Fix#
deps: Tidy up requirements.txt unused deps #188 (
5bd1772
)
v0.3.0 (2021-10-30)#
Feature#
pyup: Add pyup dependency checks and badge #186 (
4721097
)
v0.2.1 (2021-10-30)#
Fix#
docs: Update autoclasstoc version #177 (
d0267cc
)
v0.2.0 (2021-10-30)#
Feature#
sem-ver: Add semantic versioning and changelog #179 (
f5e57bc
)sphinx: Add support for markdown #49 (
ab2b705
)sphinx: Theme is now t3SphinxThemeRtd #12 (
86f3afb
)sphinx: Added custom theme furo #12 (
e3f351b
)sphinx: Update requirements.txt (
7403cd7
)sphinx: Install with base config (
75a8fb5
)pre-commit: Add tox.ini (
6db58b0
)pre-commit: Add pyproject.toml file (
cce2a1c
)pre-commit: Add yaml config file (
8cc0799
)#6: Add chore to CHANGELOG choices (
4ae4a80
)#6: Delete CHANGELOG template (
35f489c
)#6: Update CHANGELOG yaml (
b9920f1
)
Fix#
Documentation#
CHANGELOG: Update release notes:docs (
f0813f1
)CHANGELOG: Update release notes:docs (
c152c4b
)CHANGELOG: Update release notes:repo (
1411cb9
)CHANGELOG: Update release notes:docs (
563546a
)CHANGELOG: Update release notes:repo (
5502a5a
)CHANGELOG: Update release notes:docs (
aa674e1
)CHANGELOG: Update release notes:docs (
e1957f9
)CHANGELOG: Update release notes:repo (
b9e876e
)CHANGELOG: Update release notes:docs (
9d18e64
)CHANGELOG: Update release notes:docs (
d2175e5
)CHANGELOG: Update release notes:repo (
5c6c34b
)CHANGELOG: Update release notes:docs (
ce0c91e
)CHANGELOG: Update release notes:docs (
1193d92
)CHANGELOG: Update release notes:docs (
76b8520
)CHANGELOG: Update release notes:docs (
64bc9ec
)CHANGELOG: Update release notes:repo (
f0e33b1
)CHANGELOG: Update release notes:docs (
936a719
)CHANGELOG: Update release notes:docs (
e54add2
)CHANGELOG: Update release notes:docs (
9b70bb0
)CHANGELOG: Update release notes:docs (
cc9edc0
)CHANGELOG: Update release notes:docs (
3508096
)CHANGELOG: Update release notes:docs (
96f9e90
)CHANGELOG: Update release notes:repo (
c1565b9
)CHANGELOG: Update release notes:docs (
87a4663
)CHANGELOG: Update release notes:repo (
3dbf7ee
)CHANGELOG: Update release notes:docs (
341aaab
)CHANGELOG: Update release notes:repo (
a2f8197
)CHANGELOG: Update release notes:repo (
166335b
)images: Add .png and .svg diataxus #25 (
a360ff5
)CHANGELOG: Update release notes:repo (
c3d14c8
)style: Created how-to-diataxus.rst #25 (
0aa9d46
)CHANGELOG: Update release notes:repo (
f110fcb
)CHANGELOG: Update release notes:docs (
0e69c24
)CHANGELOG: Update release notes:repo (
b5fd747
)CHANGELOG: Update release notes:docs (
8c80c10
)CHANGELOG: Update release notes:repo (
d413a53
)CHANGELOG: Update release notes:docs (
4d5bf27
)CHANGELOG: Update release notes:repo (
db05b56
)CHANGELOG: Update release notes:docs (
71f7584
)CHANGELOG: Update release notes:repo (
34528f1
)CHANGELOG: Update release notes:docs (
cd863a7
)CHANGELOG: Update release notes:repo (
0ee2349
)CHANGELOG: Update release notes (
4d107f5
)CHANGELOG: Update release notes (
3e099b4
)CHANGELOG: Update release notes (
598084d
)CHANGELOG: Update release notes (
d775868
)CHANGELOG: Update release notes (
ce23157
)CHANGELOG: Update release notes (
d492b4d
)images: Add .png and .svg logo’s #37 (
1c7abc3
)CHANGELOG: Update release notes (
c824da2
)style: Add Development Pipeline style #35 (
c9847bb
)CHANGELOG: Update release notes (
acb6de2
)CHANGELOG: Update release notes (
5451668
)CHANGELOG: Update release notes (
8ca36f8
)CHANGELOG: Update release notes (
952f6ef
)Style: Add intro Style Guide, Update Index (
2df9ad0
)CHANGELOG: Update release notes (
063c3e5
)about: Improve wording in the Why section (
ec5c76e
)CHANGELOG: Update release notes (
6b2eb6f
)CHANGELOG: Update release notes (
6a88c33
)README: Add a link to the readthedocs docs (
2f4159d
)CHANGELOG: Update release notes (
6d4aeee
)about: Add an about page, update index (
09c9cc1
)CHANGELOG: Update release notes (
312f31c
)CHANGELOG: Update release notes (
e95580b
)CHANGELOG: Update release notes (
37306fa
)CHANGELOG: Update release notes (
71ad5b6
)CHANGELOG: Update release notes (
645662f
)CHANGELOG: Update release notes (
c12a15f
)CHANGELOG: Update release notes (
8478039
)CHANGELOG: Update release notes (
83a0228
)CHANGELOG: Update release notes (
e529d8c
)
Chore#
docs:
pre-commit:
reST:
files:
file:
readthedocs:
conf:
Feature#
Bug Fixes#
Documentation#
sphinx:
template:
reST:
Autodoc:
style:
index:
Styling#
Tests#
sphinx:
v0.0.1-alpha-2 - 2021-07-19 03:32:22#
Completed some Style guides and Diátaxis documentation. A reasonable body of work to release and clean up the In Progress list.
Chore#
files:
file:
log:
Feature#
sphinx:
docs:
style:
Bug Fixes#
log:
yaml:
Documentation#
images:
style:
README:
log:
about:
Style:
In Progress#
v0.0.1-alpha-1 - 2021-07-08 07:35:04#
Sphinx and the Furo theme have been installed with basic configurations. A basic about page was written and deployed to readthedocs. Snyk was deployed to monitor this project.
Feature#
Bug Fixes#
Documentation#
v0.0.1-alpha - 2021-07-07 08:23:31#
Basic git workflow setup.
Chore#
Feature#
pre-commit:
#6:
Add chore to CHANGELOG choices https://www.conventionalcommits.org/en/v1.0.0/ allows other choices for commit. Chore was added because it was missing in our choices. This change adds additional flexibility for categorizing commit messages. issue (#6) (4ae4a80) (#9)
Delete CHANGELOG template The template is no longer required for this feature upgrade. issue #6 (35f489c) (#7)
Update CHANGELOG yaml Rewrite update-changelog.yaml and point it to https://github.com/BobAnkh/auto-generate-changelog issue #6 (b9920f1) (#7)
* This CHANGELOG was automatically generated by auto-generate-changelog
Would you mind providing feedback or creating a discussion on our GitHub discussion board?