diff --git a/CHANGES.rst b/CHANGES.rst index 6f27ca7..c94be8e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,12 +6,12 @@ Changes Known deficiencies ================== -- cannot filter-include target-deps. TODOs ===== -- move matpotlib draw-data in external files. -- Pass kw-options from cmd-line to `store_XXX()` methods. +- Pass kw-options from cmd-line to `nx.store_XXX()` methods. +- Add graphviz graphs. +- Add more tests, setup Travis, add Docs contents. Changelog ========= diff --git a/README.rst b/README.rst index 8a57711..2b17de0 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,7 @@ doit-graphx =========== -Command plugin to generate graphical or textual graphs of [doit](http://pydoit.org) -task-dependencies using [NetworkX](http://networkx.github.io). +A `doit `_ command plugin that generates graphical or textual dependency-graphs using the `NetworkX `_ library. .. figure:: docs/doit_graph.png :align: center @@ -12,15 +11,25 @@ task-dependencies using [NetworkX](http://networkx.github.io). Install ------- -Requires *doit* version >= 0.28, `networkx` and `matplotlib`:: +Requires *doit* version >= 0.28, `networkx` and `matplotlib`. +You can install it from directly from github:: pip install git+https://github.com/pydoit/doit-graphx.git +Since currently (March-2015) *doit-0.28* is not yet released, +you have to install the latest version also from github:: + + pip install git+https://github.com/pydoit/doit.git + +Use the `-I` option if you have already *doit* installed. + + + Usage ----- -To activate this plugin add a file named :file:`doit.cfg` into root of -your project with the following content:: +To activate this *doit* plugin add a file named :file:`doit.cfg` into +the root of your project with the following content:: [command] cmd_graphx:Graphx @@ -29,3 +38,12 @@ your project with the following content:: Now you can just use the `graphx` command:: doit graphx + doit graph ## By default, plots a matplotlib frame + doit graph --deps file,calc,target --private + doit graph --out-file some.png + doit graph --graph-type json --out-file some.png + +Multiple output-formats are supported by the `--graph-type ` option. +Type ``doit help graphx`` to see them. +By default, results are written to standard output. + diff --git a/cmd_graphx.py b/cmd_graphx.py index 9c7d47b..f7da6e7 100644 --- a/cmd_graphx.py +++ b/cmd_graphx.py @@ -96,7 +96,7 @@ def find_edge_attr(g, attr, value): def _store_json(graph, fname, disp_params, **kws): import json - # TODO: obey disp_params + # TODO: Obey disp_params on json m = nx.to_dict_of_dicts(graph) json.dump(m, fname, **kws) @@ -220,13 +220,15 @@ class Graphx(DoitCmdBase): doc_usage = "[TASK ...]" doc_description = dedent("""\ Without any options, includes all known taks. - TODO: Task-selection works also with wildcards. + TODO: Task-selection works with wildcards. Examples: - doit graph + doit graph ## By default, plots a matplotlib frame doit graph --deps file,calc,target --private doit graph --out-file some.png doit graph --graph-type json --out-file some.png + + See https://github.com/pydoit/doit-graphx """) cmd_options = (opt_subtasks, opt_private, opt_no_children, opt_deps, @@ -396,5 +398,5 @@ def _execute(self, out_file = self._prepare_out_file(out_file, graph_type) disp_params = dict(zip(['graph_type', 'show_status', 'deps', 'template'], [graph_type, show_status, deps, template])) - kws = {} # TODO: kws not used yet. + kws = {} # TODO: kws not used on write_XXX() methods. func(graph, out_file, disp_params, **kws) diff --git a/test_cmd_graphx.py b/test_cmd_graphx.py index b481d95..c70e71f 100644 --- a/test_cmd_graphx.py +++ b/test_cmd_graphx.py @@ -124,16 +124,17 @@ def test_store_json_stdout(self): self.assertIn("t3", got) self.assertIn("join_files", got) - def test_target(self): + def test_target_in(self): output = StringIO() cmd = CmdFactory(Graphx, outstream=output, task_list=self._tasks()) cmd._execute(graph_type='json') got = output.getvalue() self.assertIn("fout.hdf5", got) + def test_target_out(self): output = StringIO() cmd = CmdFactory(Graphx, outstream=output, task_list=self._tasks()) - cmd._execute(graph_type='json', deps='file') + cmd._execute(graph_type='json', deps='task') got = output.getvalue() self.assertNotIn("fout.hdf5", got)