[WIP] poc implementation of extendable services#1
Open
felipemontoya wants to merge 6 commits into
Open
Conversation
Part of: openedx/web-fragments#309 Bumps version to 6.2.0
This commit contains no changes, but satisfies the requirements of the configured GitHub actions to publish a release to PyPi.
feat: force release
There was a problem hiding this comment.
Pull request overview
Adds a proof-of-concept mechanism for loading XBlock runtime services from installed-package entry points (xblock.service.v1), so runtimes can pick up optional capabilities without hardcoding them in the host application.
Changes:
- Introduces a
ServiceProviderplugin loader (entry-point based) and aRuntime.service()fallback to instantiate provider classes when a runtime service isn’t present. - Adds pytest coverage for plugin-provided services, runtime shadowing, and needs/wants behavior.
- Adds an ADR documenting the motivation and intended resolution order for service discovery.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
xblock/runtime.py |
Adds ServiceProvider and runtime fallback that loads service providers from xblock.service.v1. |
xblock/test/test_plugin_services.py |
New tests validating entry-point service loading and interaction with runtime-provided services. |
docs/decisions/0001-service-entry-points.rst |
ADR describing the design rationale and expected behavior of entry-point-provided services. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+56
to
+63
| @ServiceProvider.register_temp_plugin( | ||
| DummyAIService, identifier='ai_extensions', group='xblock.service.v1', | ||
| ) | ||
| def test_runtime_service_shadows_plugin_service(): | ||
| sentinel = object() | ||
| runtime = TestRuntime(services={'ai_extensions': sentinel}) | ||
| block = make_block(WantsAIBlock, runtime=runtime) | ||
| assert block.runtime.service(block, 'ai_extensions') is sentinel |
Comment on lines
+1
to
+3
| 0001 Plugin-provided runtime services via entry points | ||
| ###################################################### | ||
|
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
35dbbd5 to
ea3e7b0
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is test PR to see the implementation in action internally. It will be closed in favor of a public PR to the upstream repo