-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Core): system for extending Docq with external modules (aka plug…
…ins) (#148) * feat(extensions): extension system v0.1 (alpha) to handle UI and data layer extension. See [docs](docs/developers-guides/extensions.md) * docs: add docs for Extensions feature * chore: instrument extension loading * chore: fix run with Otel task * feat(core): system-level settings (original system settings became org level setting when the concept of organisations was introduced) *fix(core): initialising `settings` table with defaults for system settings and org settings *fix(setting page UI): if no persisted settings, stop showing options in the selectbox. * chore(observability): add more OTel instrumentation * feat(core): toggle free user signup UI with system feature. `FREE_USER_SIGNUP` feature toggle enables the signup UI * build(docs): remove mkapi plugin. It breaks docs build due to a lack of support for Python 3.11. MkApi project seems abandoned * docs: fix code formatting. * chore: update lock file * build: pin some dependencies. update lockfile
- Loading branch information
Showing
48 changed files
with
2,743 additions
and
1,912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Extensions (alpha) | ||
|
||
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: | ||
|
||
- `DocqWebUiExtension` - Web UI extensions | ||
- `DocqWebApiExtension` - Web API extensions (in the future as there's no web API at present) | ||
- `DocqDalExtension` - Database layer extensions | ||
|
||
Docq implements extensions as a event hooks system. In places that can be extended Docq fires the `callback_handler()` method on all registered extensions. The `event_name` is used identify which hook was fired. Together with `ExtensionContext` allows implementing logic. | ||
|
||
## 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. | ||
|
||
## `.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`" | ||
} | ||
} | ||
``` | ||
|
||
Example | ||
|
||
```json | ||
{ | ||
"docq_extensions.web.layout.example": { | ||
"name": "Docq example web extension", | ||
"module_name": "docq_extensions.web.layout.example", | ||
"source": "../docq-extensions/source/docq_extensions/web/layout/example.py", | ||
"class_name": "Example" | ||
}, | ||
"docq_extensions.web.layout.example_dal": { | ||
"name": "Docq example DAL extension", | ||
"module_name": "docq_extensions.docq.example_dal", | ||
"source": "../docq-extensions/source/docq_extensions/docq/example_dal.py", | ||
"class_name": "ExampleDal" | ||
} | ||
} | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"docq_extensions": { | ||
"name": "friendly name", | ||
"module_name": "fully qualified module name ref", | ||
"source": "path to module *.py file. relative to 'docq' repo root" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.