Development¶
Repositories¶
Riptide consists of multiple Python packages and Git repositories listed below:
riptide-lib: Main Python library packageriptide-proxy: HTTP(S) and Websocket Reverse Proxy for Riptide projectsriptide-cli: Riptide command-line interfaceriptide-engine-docker: Docker Engine implementationriptide-engine-dummy: Dummy Engine implementation (for tests)riptide-db-mysql: MySQL and MariaDB database driverriptide-db-mongo: MongoDB database driverriptide-plugin-php-xdebug: PHP XDebug PluginDocumentation: DocumentationCommunity Repository: Riptide Community Repository for shared apps, services and commandsDocker Images: Docker images used by the Community Repositoryriptide-all: Riptide meta package and Nix Flake
Plugins¶
Riptide can be extended with plugins. To write a plugin, create a Python package, that has the following entry point defined:
[riptide.plugin]
php-xdebug=riptide_plugin_php_xdebug.plugin:PhpXdebugPlugin
Replace php-xdebug with the identifier of your plugin and the rest
with the entry point of your plugin, implementing AbstractPlugin (see below).
Plugin Interface¶
- class AbstractPlugin¶
Bases:
abc.ABCA Riptide plugin extends the functionality of Riptide.
For this it can:
Add new CLI commands to riptide-cli.
Set flags, which can be retrieved from the configuration using a variable helper
Directly read and modify all parts of the configuration entities loaded.
Communicate with the loaded engine.
Respond to events.
- abstractmethod after_load_engine(engine: riptide.engine.abstract.AbstractEngine)¶
After the engine was loaded.
engineis the interface of the configured engine.
- abstractmethod after_load_cli(main_cli_object)¶
Called after the last CLI of Riptide CLI has loaded. Can be used to add CLI commands using Click. The passed object is the main CLI command object.
- abstractmethod after_reload_config(config: riptide.config.document.config.Config)¶
Called whenever a project is loaded or if the initial configuration is loaded without a project.
- responds_to_event(event: riptide.hook.event.AnyHookEvent) bool¶
Returns whether this plugin responds to the given event.
event_triggeredwill be called for these events if so.
- event_triggered(config: riptide.config.document.config.Config, event: riptide.hook.event.AnyHookEvent, arguments: Sequence[str]) int¶
Called when an event is triggered, unless the user has disabled hooks for the given event. Only triggered if
responds_to_eventreturnsTruefor this event.The plugin may output to stdout or stderr to indicate what it is doing, if it is processing a hook. Please note that no visual indication of your event handler being run is printed by Riptide itself. If the task you are doing could take some time, you should print some status indication/feedback.
The function must return an exit code. 0 means success, Riptide will continue. On a non-zero exit code, Riptide will abort the current process and exit with that error code. Note that for Git Hooks, git may ignore this exit code.
- abstractmethod get_flag_value(config: riptide.config.document.config.Config, flag_name: str) Any¶
Return the value of a requested plugin flag. Return False if not defined. The current config is passed, to give a context about the calling project. Please note, that flag values are usually loaded before after_reload_config!