synthpy

Note

This section assumes you have completed the installation process and have an instance of synthd running on localhost:8182. If your setup is different, you might need to make the appropriate changes to the examples given.

Install using pip

The recommended way to setup the client is using pip. Simply run

$ pip install getsynthpy

This will install the latest stable release of synthpy.

Install from source

Alternatively, you can install synthpy directly from its source code hosted on GitHub.

$ git clone https://github.com/openquery-io/synthpy.git
$ cd synthpy/
$ pip install -e .

Install with Nix Flakes

If you are using the Nix package manager, you can also install synthpy using Flakes.

$ TODO

Getting started

Once you have successfully installed synthpy, we can get started generating some synthetic data. The first thing we have to do is instantiate the main API client Synth, from which we can access all the functionalities of synthd. From a Python REPL:

>>> from synthpy import Synth
>>> synth = Synth("localhost:8182")
>>> synth.get_namespaces()  # to check everything is working as expected
{}

Using the pre-configured interactive shell

synthpy ships a pre-configured interactive shell. It can start either a standard Python REPL or an IPython prompt. It gets started by the synthpy script. If you have installed synthpy as pointed to above (and the script is in your PATH), you can run it with:

$ synthpy --host=localhost:8182

If you want to run the shell inside IPython, add the --ipython flag. You can also set a default namespace with --namespace. For a full list of available arguments, run synthpy --help.

Once inside the shell, the client is available under the variable synth.

In [1]: synth
Out[1]: <synthpy.client.Synth at 0x7fbb6f203150>

Most of the required classes have also been imported on startup for convenience.