Skip to content

refactor(datashare-python): register workers through entry point plugins#6

Open
ClemDoum wants to merge 3 commits intomainfrom
feature(datashare-python)/support-worker-plugins
Open

refactor(datashare-python): register workers through entry point plugins#6
ClemDoum wants to merge 3 commits intomainfrom
feature(datashare-python)/support-worker-plugins

Conversation

@ClemDoum
Copy link
Contributor

@ClemDoum ClemDoum commented Feb 27, 2026

Changes

Implement workflows and activities discovery through Python entrypoints for plugin.

When devs create worker packages, and installs it together with datashare-python, they can then start their worker running the workflow and activities of the choice as following:

datashare-python worker start --queue <queue> [--activities <activity-regex>] [--workflows <workflow-regex>] --temporal-address localhost:7233

This API lets the CLI user cherry picking the activities and workflow of their choice and route them to a given queue.

The registry machnism works as following:

  1. the dev must expose all workflows and activites in some variable inside their package say in a worker_package/registry.py:
from .workflow_a import WorkflowA
from .workflow_b import WorkflowB
from .activiy_a import actitiy_a_fn
from .activiy_b import ActB

WORKFLOWS = [WorkflowA, WorkflowB]
ACTIVITIES = [actitiy_a_fn, ActB.act_fn]
  1. they must then expose these variables [registering an entrypoint](entrypoints for plugin) in their pyproject.toml under the datashare.workflows and datashare.activities plugin/entrypoint group:
[project.entry-points."datashare.workflows"]
workflows = "worker_package.registry:WORKFLOWS"

[project.entry-points."datashare.activities"]
activities = "worker_package.registry:ACTIVITIES"

After that the datashare-python CLI will auto discover registered activities and workflow and perform filtering through regexes

Note: workflows and activite must use explicit name through the name= keywoard arg when using the activity/workflow.defn(name=) function

datashare-python

Added

  • workflow and activities registration through plugin entry points

@ClemDoum ClemDoum force-pushed the feature(datashare-python)/support-worker-plugins branch 7 times, most recently from 7e9caee to 8a8b2f9 Compare February 27, 2026 11:09
@ClemDoum ClemDoum changed the base branch from refactor/extract-worker-template to main February 27, 2026 11:11
@ClemDoum ClemDoum force-pushed the feature(datashare-python)/support-worker-plugins branch 8 times, most recently from 95277cb to 9ad0bb7 Compare February 27, 2026 14:06
@ClemDoum ClemDoum force-pushed the feature(datashare-python)/support-worker-plugins branch from 9ad0bb7 to 62f8850 Compare February 27, 2026 14:08
@ClemDoum ClemDoum marked this pull request as ready for review February 27, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant