Skip to content

Commit

Permalink
GH-#1: Add some examples on README.
Browse files Browse the repository at this point in the history
  • Loading branch information
ankostis committed Mar 29, 2015
1 parent eb3b28f commit 1762a34
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=========
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ 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
10 changes: 6 additions & 4 deletions cmd_graphx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
5 changes: 3 additions & 2 deletions test_cmd_graphx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 1762a34

Please sign in to comment.