This is the README documentation for the daptics Design of Experiments GraphQL API and the Python API client.
- The Python API client package and several tutorial Jupyter notebooks are available from the daptics-api GitHub repository at https://github.com/ProtoLife/daptics-api
- Auto-generated documentation for the API and the client is available from the GitHub Pages for this project at https://ProtoLife.github.io/daptics-api
- For more information on Daptics technology, please see the Documentation section of the daptics website at https://daptics.ai
To use the daptics API, you must first register at the https://daptics.ai to establish your login and password for API authentication.
The python_client
folder contains the Python GraphQL client package module
sources (in the daptics_client
, phoenix
, and syncasync
folders),
and several interactive Python notebooks for experimenting with the API.
Follow the instructions in the README-NOTEBOOKS.md file in that folder to set up a local Jupyter Notebook
server if you do not have access to a server that can open .ipynb
files.
-
Install graphql-markdown
-
Then in the
pydocmd
folder, run:
NODE_TLS_REJECT_UNAUTHORIZED=0 graphql-markdown --no-toc --title 'Daptics GraphQL API' https://api.daptics.ai/api >graphql_api.md
Notes:
-
The
NODE_TLS_REJECT_UNAUTHORIZED=0
is to handle our ZeroSSL certificates. -
If this fails, you can use the appropriate JSON schema file to generate the docs, with this command:
graphql-markdown --no-toc --title 'Daptics GraphQL API' api-0.14.1.json >graphql_api.md
- If using
yarn
to manage node packages, try this:
yarn bin graphql-markdown
to get the location of the graphql-markdown
executable.
-
Install these tools in order:
a. tornado - Important! Specify version 5.1.1 (version 6.0 will break MkDocs) b. pdoc3 c. MkDocs d. mkdocs-rtd-dropdown - Theme for MkDocs
-
Create Markdown documentation for the
daptics_client.py
file usingpdoc3
. In thepython_client
folder, run:pdoc3 --pdf --force --template-dir ../pdoc/templates daptics_client >../pydocmd/daptics_client.md
-
Then build the entire "Read the Docs" site, using
mkdocs
. In the root project folder, where themkdocs.yml
configuration file is located, run:mkdocs build
Html and Markdown files will be produced in the docs
folder.
-
Install jupytext
-
Set up metadata in any ipynb file that has Python code:
jupytext --set-formats ipynb,python//py:light 03_SimpleTutorial.ipynb
-
Export Python code to
/python
subdirectory:jupytext --from ipynb --to python//py:light 03_SimpleTutorial.ipynb
-
Edit Python code as needed. Or when you run in Jupyter notebook, and make changes, the corresponding Python file will be kept up to date!
-
Rebuild notebook from Python file without outputs (do this before checking into version control):
jupytext --from python//py:light --to notebook python/03_SimpleTutorial.py
You can also use jupyter nbconvert
to remove all output from .ipynb files:
jupyter nbconvert 03_SimpleTutorial.ipynb --to notebook --ClearOutputPreprocessor.enabled=True --inplace