Skip to content

Commit

Permalink
docs(extensions): add details re deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
janaka committed Nov 25, 2023
1 parent a3bfc59 commit 4ff0016
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions docs/developer-guide/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Note: this interface is highly unstable. Expect breaking changes.

Extensions is a type of plugin system that enables you to extend Docq functionality. This enables developing custom extensions as external modules. Then add to Docq through configuration (so imported dynamically at build time or run).

Extensions are Python modules that implement one of the `DocqExtension` classes:
An extension is a Python _module_ that implement one of the `DocqExtension` interface (that is inherits from):

- `DocqWebUiExtension` - Web UI extensions
- `DocqWebApiExtension` - Web API extensions (in the future as there's no web API at present)
Expand All @@ -14,22 +14,24 @@ Docq implements extensions as a event hooks system. In places that can be extend

## Configure Docq Extensions

Drop a `.docq-extensions.json` file into the root folder of the Docq app deployment. In the future we'll develop easier way to deploy extensions without having to redeploy the entire Docq app.
Drop a `.docq-extensions.json` file into the root folder of the Docq app deployment. In the future we'll develop an easier way to deploy extensions without having to redeploy the entire Docq app.

Any custom modules that are imported within an extension also needs to be added to `.docq-extensions.json`. Otherwise you will get import errors when the using module is being loaded and registered during Docq initialisation.

## `.docq-extensions.json` Schema

```json
{
"unique_key": {
"name": "any friendly name",
"module_name": "<the full module path. Same as `from` in an static import",
"source": "<location of the source. Relative path or git url",
"class_name": "<name of your class that inherits from `DocqExtension`"
"module_name": "<the full qualified module path. Same as `from` in an static import",
"source": "<location of the source. Relative path (or git url in the future)",
"class_name": "<(optional) name of your class that inherits from `DocqExtension`"
}
}
```

Example
Example:

```json
{
Expand All @@ -48,4 +50,27 @@ Example
}
```

## Deploying Extensions

In the above example, relative paths is based on the extension package source code living in a sibling folder to Docq.

``` md

- workspace
- docq-repo
- source/docq
- web
- .docq-extensions.json
- docq-extension-repo
- source
- docq
- web
```

When Docq is deployed same relative folder structure should be maintained for the above example `.docq-extensions.json` to work. Otherwise adjust relative paths for source.

The build step must perform a `poetry install` to install third-party dependencies used by the extensions package.

## Developing Extensions

Details on local dev workflow coming soon.

0 comments on commit 4ff0016

Please sign in to comment.