ProjectGraph
Foliant Meta Command which draws a scheme of project sections. This extension uses meta-information, collected by folinatcontrib.meta extension.
Graphviz is used to build a scheme.
libgraphviz-dev is required to be installed on your machine.
Installation
$ pip install foliantcontrib.project_graph
Usage
First you need to specify all relations between the documents in your project. To do this add the relates section to your document's meta-data:
---
relates:
- tests/test1.md
- specs/spec.md
---
in relates section you need to specify a list of documents to which current document relates. You can specify either a relative path to connected document or its ID (if the corresponding document has an ID assigned in its meta section):
# index.md
---
id: index
---
# glossary.md
---
relates:
- index
---
After you specified all relations, run the draw command:
$ foliant draw
Scheme will appear in the file project_graph.png
Config
ProjectGraph has a number of options:
project_graph:
directed: false
filename: project_graph.png
gv_attributes:
node:
shape: rect
color: green
edge:
arrowhead: open
graph:
ranksep: 1
main_relation:
penwidth: 2
directed
: Specifies graph to be directed or not. Default: false
filename
: Graph output filename. Default: project_graph.png
gv_attributes
: A dictionary with global attributes of the graph. Each dictionary should be stored under the Graphviz Entity key (node, edge, or graph), or under type key. All sections or relations which have this type will get these attributes.
If you want to adjust the look of just one node, add a gv_attributes option into the meta of the document:
---
id: index
relates:
- glossary
gv_attributes:
color: green
shape: circle
---
You can also change the look of the edges, which connect nodes. To do this you can use a detailed syntax of relations.
Relations detailed syntax
As stated in the beginning, to specify relations you need to add a relates param and include a list of related documents IDs\file paths:
---
relates:
- doc1.md
- MAIN_SPEC
---
But there's also a detailed syntax for specifying relations, it looks like this:
---
relates:
- rel_path: doc1.md
type: details
- rel_id: MAIN_SPEC
gv_attributes:
color: #CCCCCC
arrowhead: none
---
In the detailed syntax each relation is not a string, but a mapping. This time you have to explicitly use either rel_path key, if you are pointing to a document by path, or rel_id if you do it by ID.
Also you can specify relation type by adding a type key. Right now the value of this key just goes to the edge label, but soon you'll be able to change the appearance of all edges with one type.
Finally you can override this specific edge's appearance by adjusting Graphviz attributes in the gv_attributes key.
Metadata
Release files for foliantcontrib.project-graph 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| foliantcontrib.project_graph-1.0.1.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| foliantcontrib.project_graph-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / foliantcontrib.project_graph-1.0.1.tar.gz
| Download URL | foliantcontrib.project_graph-1.0.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7892ab8df5216a4410941493150181510ff9514e76c89b00ce8c9deecf78ef5
|
|
BLAKE2b-256 checksum How to use checksums |
3f315083cd37dde376f296dfb2ef58aa17ad4c908994a5d2504f19108db01450
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.14.2 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1
|
Release files / foliantcontrib.project_graph-1.0.1-py3-none-any.whl
| Download URL | foliantcontrib.project_graph-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89cf6cadf9f9d2ac69e3db0ff61adae53b3bd489005919cc14082969a45281e3
|
|
BLAKE2b-256 checksum How to use checksums |
13ae03f8a29c2512ed4e24ab50f70636e15f67fa36fb38fdd092a7344ea06fb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.14.2 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1
|