Skip to content

Commit 1dc6140

Browse files
committed
Update doc format
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 4809471 commit 1dc6140

File tree

5 files changed

+191
-59
lines changed

5 files changed

+191
-59
lines changed

docs/source/general.rst

Lines changed: 83 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ General
77
AboutCode Toolkit Defined
88
=========================
99

10-
AboutCode Toolkit is a tool for your software development team to document your code inside your codebase, typically in preparation for a product release, side-by-side with the actual code. ABOUT file(s) have a simple, standard format that identifies components and their associated licenses. The current AboutCode Toolkit subcommands are:
10+
AboutCode Toolkit is a tool for your software development team to document your code
11+
inside your codebase, typically in preparation for a product release, side-by-side with the
12+
actual code. ABOUT file(s) have a simple, standard format that identifies components and their
13+
associated licenses. The current AboutCode Toolkit subcommands are:
1114

1215
- **attrib**: Generate a Product Attribution notice document from your ABOUT file(s), JSON, CSV or XLSX. You can also generate documents for other purposes (such as a License Reference) by varying your input control file and your template.
1316

@@ -43,7 +46,11 @@ Using gen to Generate ABOUT file(s)
4346
Prepare Your Software Inventory for gen Standard Field Names
4447
------------------------------------------------------------
4548

46-
You should start with a software inventory of your codebase in spreadsheet or JSON format. You need to prepare a version of it that will identify the field values that you want to appear in your .ABOUT files. Note the following standard field names (defined in the ABOUT File Specification), which gen will use to look for the values that it will store in your generated .ABOUT files, as well as any additional text files that you identify, which it will copy and store next to the .ABOUT files.
49+
You should start with a software inventory of your codebase in spreadsheet or JSON format. You need
50+
to prepare a version of it that will identify the field values that you want to appear in your .ABOUT
51+
files. Note the following standard field names (defined in the ABOUT File Specification), which gen
52+
will use to look for the values that it will store in your generated .ABOUT files, as well as any
53+
additional text files that you identify, which it will copy and store next to the .ABOUT files.
4754

4855
.. list-table::
4956
:widths: 10 45 45
@@ -171,9 +178,12 @@ You should start with a software inventory of your codebase in spreadsheet or JS
171178
Fields Renaming and Optional Custom Fields
172179
------------------------------------------
173180

174-
Since your input's field name may not match with the AboutCode Toolkit standard field name, you can use the transform subcommand to do the transformation.
181+
Since your input's field name may not match with the AboutCode Toolkit standard field name,
182+
you can use the transform subcommand to do the transformation.
175183

176-
A transform configuration file is used to describe which transformations and validations to apply to a source CSV/JSON/XLSX file. This is a simple text file using YAML format, using the same format as an .ABOUT file.
184+
A transform configuration file is used to describe which transformations and validations to
185+
apply to a source CSV/JSON/XLSX file. This is a simple text file using YAML format,
186+
using the same format as an .ABOUT file.
177187

178188
The attributes that can be set in a configuration file are:
179189

@@ -186,12 +196,15 @@ The attributes that can be set in a configuration file are:
186196
bar : foo
187197
188198
189-
The renaming is always applied first before other transforms and checks. All other field names referenced below are AFTER the renaming have been applied.
190-
For instance with this configuration, the field "Directory/Location" will be renamed to "about_resource" and "foo" to "bar":
199+
The renaming is always applied first before other transforms and checks. All other
200+
field names referenced below are AFTER the renaming have been applied.
201+
For instance with this configuration, the field "Directory/Location" will be
202+
renamed to "about_resource" and "foo" to "bar":
191203

192204
- required_fields: An optional list of required field names that must have a value, beyond the standard field names. If a source CSV/JSON/XLSX does not have such a field or an entry is missing a value for a required field, an error is reported.
193205

194-
For instance with this configuration, an error will be reported if the fields "name" and "version" are missing, or if any entry does not have a value set for these fields:
206+
For instance with this configuration, an error will be reported if the fields "name"
207+
and "version" are missing, or if any entry does not have a value set for these fields:
195208

196209
.. code-block:: none
197210
@@ -222,7 +235,9 @@ For instance with this configuration, the target file will not contain the "type
222235
Run gen to Generate ABOUT file(s)
223236
---------------------------------
224237

225-
When your software inventory is ready, you can save it as a .csv, .json or .xlsx file, and use it as input to run gen to generate ABOUT file(s). The official gen parameters are defined here: :ref:`reference`
238+
When your software inventory is ready, you can save it as a .csv, .json or .xlsx file,
239+
and use it as input to run gen to generate ABOUT file(s). The official gen parameters
240+
are defined here: :ref:`reference`
226241

227242
Here is an example of a gen command:
228243

@@ -240,7 +255,8 @@ This gen example command does the following:
240255

241256
- Specifies a target output directory.
242257

243-
Review the generated ABOUT file(s) to determine if it meets your requirements. Here is a simple example of a linux-redhat-7.2.ABOUT file that documents the directory /linux-redhat-7.2/ :
258+
Review the generated ABOUT file(s) to determine if it meets your requirements. Here is a
259+
simple example of a linux-redhat-7.2.ABOUT file that documents the directory /linux-redhat-7.2/ :
244260

245261
.. code-block:: none
246262
@@ -259,28 +275,43 @@ Review the generated ABOUT file(s) to determine if it meets your requirements. H
259275
owner: Red Hat
260276
redistribute: Y
261277
262-
You can make appropriate changes to your input software inventory and then run gen as often as necessary to replace the ABOUT file(s) with the improved version.
278+
You can make appropriate changes to your input software inventory and then run
279+
gen as often as necessary to replace the ABOUT file(s) with the improved version.
263280

264281
Using attrib to Generate a Product Attribution Notice Package
265282
=============================================================
266283

267284
Prepare an Attribution Template to Use
268285
--------------------------------------
269286

270-
You can run attrib using the default_html.template (or default_json.template) provided with the AboutCode Toolkit tools:
287+
You can run attrib using the default_html.template (or default_json.template)
288+
provided with the AboutCode Toolkit tools:
271289

272290
https://github.com/nexB/aboutcode-toolkit/blob/develop/templates/default_html.template
273291

274-
If you choose to do that, you will most likely want to edit the generated .html file to provide header information about your own organization and product.
292+
If you choose to do that, you will most likely want to edit the generated .html
293+
file to provide header information about your own organization and product.
275294

276-
Running attrib with the default_html.template file is probably your best choice when you are still testing your AboutCode Toolkit process. Once you have a good understanding of the generated output, you can customize the template to provide the standard text that serve your needs. You can also create alternative versions of the template to use attrib to generate other kinds of documents, such as a License Reference.
295+
Running attrib with the default_html.template file is probably your best choice when
296+
you are still testing your AboutCode Toolkit process. Once you have a good understanding
297+
of the generated output, you can customize the template to provide the standard text that
298+
serve your needs. You can also create alternative versions of the template to use attrib
299+
to generate other kinds of documents, such as a License Reference.
277300

278301
Use jinja2 Features to Customize Your Attribution Template
279302
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
280303

281-
The attrib tool makes use of the open source python library jinja2 (http://jinja.pocoo.org/docs/dev/templates/) in order to extend .html capabilities and transform AboutCode Toolkit input data into the final format of the generated attribution file. The ``default_html.template`` file contains text that complies with jinja2 syntax specifications in order to support grouping, ordering, formatting and presentation of your AboutCode Toolkit data. If your attribution requirements are complex, you may wish to study the jinja2 documentation to modify the default_html.template logic or create your own template; alternatively, here are a few relatively simple concepts that relate to the attribution document domain.
304+
The attrib tool makes use of the open source python library jinja2
305+
(http://jinja.pocoo.org/docs/dev/templates/) in order to extend .html capabilities and
306+
transform AboutCode Toolkit input data into the final format of the generated attribution file.
307+
``default_html.template`` file contains text that complies with jinja2 syntax specifications
308+
in order to support grouping, ordering, formatting and presentation of your AboutCode
309+
Toolkit data. If your attribution requirements are complex, you may wish to study the jinja2
310+
documentation to modify the default_html.template logic or create your own template; alternatively,
311+
here are a few relatively simple concepts that relate to the attribution document domain.
282312

283-
The simplest modifications to the default_html.template file involve the labels and standard text. For example, here is the default template text for the Table of Contents:
313+
The simplest modifications to the default_html.template file involve the labels and standard
314+
text. For example, here is the default template text for the Table of Contents:
284315

285316
.. code-block:: none
286317
@@ -292,7 +323,8 @@ The simplest modifications to the default_html.template file involve the labels
292323
{% endfor %}
293324
</div>
294325
295-
If you would prefer something other than a simple space between the component name and the component version, you can modify it to something like this:
326+
If you would prefer something other than a simple space between the component name and
327+
the component version, you can modify it to something like this:
296328

297329
.. code-block:: none
298330
@@ -304,9 +336,20 @@ If you would prefer something other than a simple space between the component na
304336
{% endfor %}
305337
</div>
306338
307-
The ``if about_object.version.value`` is checking for a component version, and if one exists it generates output text that is either a space followed by the actual version value, or, as in this customized template, it generates output text as " - Version ", followed by the actual version value. You will, of course, want to test your output to get exactly the results that you need.
308-
309-
Note that you can actually use attrib to generate an AboutCode Toolkit-sourced document of any kind for varying business purposes, and you may want to change the grouping/ordering of the data for different reporting purposes. (Here we get into somewhat more complex usage of jinja2 features, and you may wish to consult the jinja2 documentation to reach a more comprehensive understanding of the syntax and features.) The default ordering is by component, but In the following example, which is intended to support a "license reference" rather than an attribution document, the customized template modifies the data grouping to use a custom field called "confirmed_license":
339+
The ``if about_object.version.value`` is checking for a component version, and if one
340+
exists it generates output text that is either a space followed by the actual version
341+
value, or, as in this customized template, it generates output text as " - Version ",
342+
followed by the actual version value. You will, of course, want to test your output to
343+
get exactly the results that you need.
344+
345+
Note that you can actually use attrib to generate an AboutCode Toolkit-sourced document
346+
of any kind for varying business purposes, and you may want to change the grouping/ordering
347+
of the data for different reporting purposes. (Here we get into somewhat more complex usage of
348+
jinja2 features, and you may wish to consult the jinja2 documentation to reach a more comprehensive
349+
understanding of the syntax and features.) The default ordering is by component, but In the
350+
following example, which is intended to support a "license reference" rather than an attribution
351+
document, the customized template modifies the data grouping to use a custom field
352+
called "confirmed_license":
310353

311354
.. code-block:: none
312355
@@ -321,7 +364,10 @@ Note that you can actually use attrib to generate an AboutCode Toolkit-sourced d
321364
{% endfor %}
322365
</div>
323366
324-
After the table of contents, this example customized template continues with the license details using the jinja2 for-loop capabilities. Notice that the variable "group.grouper.value" is actually the license name here, and that “License URL” can be any URL that you have chosen to store in your .ABOUT files:
367+
After the table of contents, this example customized template continues with the license details
368+
using the jinja2 for-loop capabilities. Notice that the variable "group.grouper.value" is
369+
actually the license name here, and that “License URL” can be any URL that you have chosen
370+
to store in your .ABOUT files:
325371

326372
.. code-block:: none
327373
@@ -362,12 +408,16 @@ After the table of contents, this example customized template continues with the
362408
{% endfor %}
363409
<hr>
364410
365-
In summary, you can start with simple, cosmetic customizations to the default_html.template, and gradually introduce a more complex structure to the attrib output to meet varying business requirements.
411+
In summary, you can start with simple, cosmetic customizations to the default_html.template,
412+
and gradually introduce a more complex structure to the attrib output to meet
413+
varying business requirements.
366414

367415
Run attrib to Generate a Product Attribution Notice Package
368416
-----------------------------------------------------------
369417

370-
You can then run the attrib to generate your product attribution notice package from the generated ABOUT file(s) or from an inventory (.csv/.json/.xlsx). The official attrib parameters are defined here: :ref:`reference`
418+
You can then run the attrib to generate your product attribution notice package from the
419+
generated ABOUT file(s) or from an inventory (.csv/.json/.xlsx). The official attrib
420+
parameters are defined here: :ref:`reference`
371421

372422
Here is an example of a attrib command:
373423

@@ -389,11 +439,19 @@ Using inventory to Generate a Software Inventory
389439
Generate a Software Inventory of Your Codebase from ABOUT file(s)
390440
-----------------------------------------------------------------
391441

392-
One of the major features of the ABOUT File specification is that the .ABOUT files are very simple text files that can be created, viewed and edited using any standard text editor. Your software development and maintenance processes may require or encourage your software developers to maintain .ABOUT files and/or associated text files manually. For example, when a developer addresses a software licensing issue with a component, it is appropriate to adjust the associated ABOUT file(s) manually.
442+
One of the major features of the ABOUT File specification is that the .ABOUT files
443+
are very simple text files that can be created, viewed and edited using any standard
444+
text editor. Your software development and maintenance processes may require or encourage
445+
your software developers to maintain .ABOUT files and/or associated text files manually.
446+
For example, when a developer addresses a software licensing issue with a component,
447+
it is appropriate to adjust the associated ABOUT file(s) manually.
393448

394-
If your organization adopts the practice of manually creating and maintaining ABOUT file(s), you can easily re-create your software inventory from your codebase using inventory. The official inventory parameters are defined here: :ref:`reference`
449+
If your organization adopts the practice of manually creating and maintaining ABOUT file(s),
450+
you can easily re-create your software inventory from your codebase using inventory.
451+
The official inventory parameters are defined here: :ref:`reference`
395452

396-
A successful execution of inventory will create a complete software inventory in .csv, .json or .xlsx format based on defined format.
453+
A successful execution of inventory will create a complete software inventory in .csv,
454+
.json or .xlsx format based on defined format.
397455

398456

399457

docs/source/home.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ version may be pre-installed, open a terminal and type:
4848
python --version
4949

5050
.. note::
51-
Debian has decided that distutils is not a core python package, so it is not included in the last versions of debian and debian-based OSes.
51+
Debian has decided that distutils is not a core python package, so it is not included
52+
in the last versions of debian and debian-based OSes.
5253

5354
A solution is to run: `sudo apt install python3-distutils`
5455

@@ -69,9 +70,11 @@ or on windows:
6970
configure
7071

7172
.. note::
72-
For MacOS users, it's a known issue the Python36 may case SSL Certificates error if the Certificates is not up to date.
73+
For MacOS users, it's a known issue the Python36 may case SSL Certificates error
74+
if the Certificates is not up to date.
7375

74-
A solution is to run: `sudo /Applications/Python\\ 3.6/Install\\ Certificates.command` to upgrade the outdated certificates.
76+
A solution is to run: `sudo /Applications/Python\\ 3.6/Install\\ Certificates.command`
77+
to upgrade the outdated certificates.
7578

7679
ACTIVATE the VIRTUALENV
7780
-----------------------
@@ -89,7 +92,8 @@ To deactivate the virtualenv, run (on both posix and windows):
8992

9093
VERSIONING SCHEMA
9194
-----------------
92-
Starting at AboutCode version 4.0.0, the AboutCode Toolkit will follow SemVer for the versioning schema.
95+
Starting at AboutCode version 4.0.0, the AboutCode Toolkit will follow SemVer
96+
for the versioning schema.
9397

9498
i.e. MAJOR.MINOR.PATCH format
9599
1. MAJOR version when making incompatible API changes,

docs/source/reference.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ Options
8080
Purpose
8181
-------
8282

83-
Generate an attribution file which contains license information from the INPUT along with the license text.
83+
Generate an attribution file which contains license information
84+
from the INPUT along with the license text.
8485

8586
Assume the following:
8687

@@ -254,7 +255,8 @@ Options
254255
Purpose
255256
-------
256257

257-
Collect sources that have 'redistribute' flagged as 'True' in .ABOUT files or inventory to the output location.
258+
Collect sources that have 'redistribute' flagged as 'True' in .ABOUT
259+
files or inventory to the output location.
258260

259261
Details
260262
^^^^^^^
@@ -427,7 +429,8 @@ Options
427429
Purpose
428430
-------
429431

430-
Fetch licenses (Default: ScanCode LicenseDB) in the license_expression field and save to the output location.
432+
Fetch licenses (Default: ScanCode LicenseDB) in the license_expression
433+
field and save to the output location.
431434

432435
Details
433436
^^^^^^^
@@ -590,7 +593,9 @@ Options
590593
Purpose
591594
-------
592595

593-
Transform the CSV/JSON/XLSX file at LOCATION by applying renamings, filters and checks and then write a new CSV/JSON/Excel to OUTPUT (Format for input and output need to be the same).
596+
Transform the CSV/JSON/XLSX file at LOCATION by applying renamings,
597+
filters and checks and then write a new CSV/JSON/Excel to OUTPUT
598+
(Format for input and output need to be the same).
594599

595600
Details
596601
^^^^^^^
@@ -728,4 +733,6 @@ output.csv
728733

729734
Special Notes
730735
-------------
731-
When using the field_filters configuration, all the standard required columns (about_resource and name) and the user defined required_fields need to be included.
736+
When using the field_filters configuration, all the standard required
737+
columns (about_resource and name) and the user defined required_fields
738+
need to be included.

0 commit comments

Comments
 (0)