Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Commit

Permalink
docs: Added instructions for running py interpreter in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
beneboy committed Sep 2, 2019
1 parent d602d50 commit ced430b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,45 @@ serialized = """{"type": "Heading", "content": ["Heading Text"], "depth": 2}"""

h2 = from_json(serialized)
```

## Interpreter

This library can also be used to interpret executable documents. Once installed it can be used like this:

```bash
$ python3 -m stencila.schema execute <inputfile> <outputfile> [parameters]
```

`inputfile` and/or `outputfile` can be set to `-` to read from stdin and/or write to stdout (respectively).

`[parameters]` is a list of parameters to pass to the document –- these will differ based on what the document defines.
They can be passed either by `--parameter_name=parameter_value` or `--parameter_name parameter_value`. Each parameter
must be named.

### Usage in Development

There are three options to run the interpreter without installing this package (which can be useful when developing).

#### setup.py develop

Run `python3 setup.py develop` which will link this library into your site packages directory. You can then execute
documents with the above Interpreter command.

#### Run interpreter.py directly

You can run the `interpreter.py` script directly, the arguments are the same as running as a module in the example
above except the first `execute` argument is omitted:

```bash
$ python3 schema/py/stencila/schema/interpreter.py <inputfile> <outputfile> [parameters]
```

### cd into stencila directory

You can run the interpreter as a module by changing into the `stencila` directory first, and then ommitting the
`stencila` namespace:

```bash
$ cd schema/py/stencila
$ python3 -m schema execute <inputfile> <outputfile> [parameters]
```

0 comments on commit ced430b

Please sign in to comment.