Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
cf335f0
refactor: fold web_fragments into XBlock python project (#917)
Kelketek Jun 10, 2026
125ad1d
feat: force release
Kelketek Jun 10, 2026
142a111
Merge pull request #926 from open-craft/fox/force-release
feanil Jun 10, 2026
61999bd
Release workflow was broken (#928)
salman2013 Jun 12, 2026
34c5acc
chore: Upgrade Python requirements (#929)
edx-requirements-bot Jun 15, 2026
b5b33a3
chore: Upgrade Python requirements (#930)
edx-requirements-bot Jun 22, 2026
d33a8b1
build(deps): bump actions/checkout from 6.0.3 to 7.0.0 (#931)
dependabot[bot] Jun 22, 2026
9b311b8
chore: Upgrade Python requirements (#932)
edx-requirements-bot Jun 29, 2026
397613a
chore: Upgrade Python requirements (#935)
edx-requirements-bot Jul 6, 2026
8ce6aa9
fix: make Mixologist async-safe, deprecate ObjectAggregator (#934)
irfanuddinahmad Jul 8, 2026
d071493
chore: Upgrade Python requirements (#938)
edx-requirements-bot Jul 13, 2026
8d7c3aa
build(deps): bump actions/setup-python from 6.2.0 to 6.3.0 (#933)
dependabot[bot] Jul 13, 2026
48bf881
build(deps): bump python-semantic-release/publish-action (#936)
dependabot[bot] Jul 13, 2026
c8bfb49
build(deps): bump python-semantic-release/python-semantic-release (#937)
dependabot[bot] Jul 13, 2026
61e1d4b
chore: Upgrade Python requirements (#939)
edx-requirements-bot Jul 20, 2026
0c3239d
chore: Upgrade Python requirements (#941)
edx-requirements-bot Jul 27, 2026
091f45a
chore: Upgrade Python requirements (#943)
edx-requirements-bot Aug 3, 2026
3bf6822
chore: Upgrade Python requirements (#944)
edx-requirements-bot Aug 10, 2026
3b962ea
build(deps): bump actions/setup-python from 6.3.0 to 7.0.0
dependabot[bot] Aug 10, 2026
c77811d
build(deps): bump actions/checkout from 7.0.0 to 7.0.1
dependabot[bot] Aug 10, 2026
0b9e38f
Merge pull request #942 from openedx/dependabot/github_actions/action…
feanil Aug 10, 2026
56c2b0f
chore: Upgrade Python requirements (#945)
edx-requirements-bot Aug 17, 2026
bfcf036
chore: Upgrade Python requirements (#946)
edx-requirements-bot Aug 24, 2026
267a6c2
chore: Upgrade Python requirements (#947)
edx-requirements-bot Aug 31, 2026
ad72be6
build(deps): bump python-semantic-release/python-semantic-release
dependabot[bot] Aug 31, 2026
59fb6f9
Merge pull request #948 from openedx/dependabot/github_actions/python…
feanil Sep 1, 2026
b0d7826
fix: make release workflow compatible with immutable releases (#949)
farhan Sep 1, 2026
0c5be48
chore: Upgrade Python requirements (#950)
edx-requirements-bot Sep 7, 2026
6160076
chore: Upgrade Python requirements (#951)
edx-requirements-bot Sep 14, 2026
a1782c2
chore: Upgrade Python requirements (#954)
edx-requirements-bot Sep 21, 2026
a3a92d8
build(deps): bump codecov/codecov-action from 7.0.0 to 7.1.1 (#955)
dependabot[bot] Sep 21, 2026
8ca6651
chore: Upgrade Python requirements (#956)
edx-requirements-bot Sep 28, 2026
7eb703b
build(deps): bump python-semantic-release/python-semantic-release (#957)
dependabot[bot] Sep 28, 2026
e4b2b96
chore: Update VirtualEnv website
AmmarCodes Sep 18, 2026
384e405
Merge pull request #953 from AmmarCodes/patch-1
feanil Oct 1, 2026
bf326e3
chore: Upgrade Python requirements
edx-requirements-bot Oct 4, 2026
4af4b89
fix: move pylint disable comments to lines where warnings fire
farhan Oct 5, 2026
7c34adc
Merge pull request #958 from openedx/repo-tools/upgrade-python-requir…
feanil Oct 7, 2026
948a378
chore: Upgrade Python requirements (#959)
edx-requirements-bot Oct 12, 2026
a9cf33b
build(deps): bump actions/upload-artifact from 7.0.1 to 7.0.2
dependabot[bot] Oct 13, 2026
0033d77
Merge pull request #961 from openedx/dependabot/github_actions/action…
feanil Oct 14, 2026
52977ae
build(deps): bump actions/download-artifact from 8.0.1 to 8.0.2
dependabot[bot] Oct 14, 2026
d1f50e5
Merge pull request #960 from openedx/dependabot/github_actions/action…
feanil Oct 16, 2026
26ccd61
chore: Upgrade Python requirements (#962)
edx-requirements-bot Oct 19, 2026
36b7210
build: upgrade certifi to 2026.10.19
edx-requirements-bot Oct 21, 2026
5693f68
Merge pull request #963 from openedx/repo-tools/certifi-2026-10-19-26…
UsamaSadiq Oct 21, 2026
c73c4bb
build: upgrade uv to 0.13.5 (#964)
edx-requirements-bot Oct 22, 2026
db3f31d
chore: Upgrade Python requirements (#965)
edx-requirements-bot Oct 26, 2026
c8dcf3d
build(deps): bump actions/setup-python from 7.0.0 to 7.1.0
dependabot[bot] Oct 26, 2026
e72700f
Merge pull request #966 from openedx/dependabot/github_actions/action…
farhan Oct 26, 2026
8436dfb
build(deps): bump pypa/gh-action-pypi-publish from 1.14.2 to 1.14.3
dependabot[bot] Oct 26, 2026
4b3f524
Merge pull request #967 from openedx/dependabot/github_actions/pypa/g…
farhan Oct 26, 2026
5f272fd
chore: Upgrade Python requirements (#968)
edx-requirements-bot Nov 2, 2026
b359094
fix: preserve all Set-Cookie headers in webob_to_django_response
cpruijsen Sep 13, 2026
7f8584d
fix: reject Set-Cookie headers that do not parse to one cookie
cpruijsen Oct 26, 2026
645fc1c
Merge pull request #952 from cpruijsen/fix/issue-523
feanil Nov 2, 2026
52d0c10
chore: Upgrade Python requirements (#969)
edx-requirements-bot Nov 10, 2026
f1b8572
chore: Upgrade Python requirements (#970)
edx-requirements-bot Nov 16, 2026
8966748
chore: Upgrade Python requirements (#971)
edx-requirements-bot Nov 23, 2026
a40459e
chore: Upgrade Python requirements (#974)
edx-requirements-bot Nov 30, 2026
5bb6ed4
feat: poc implementation of extendable services
felipemontoya Jun 10, 2026
09c0004
feat: addressing feedback on tests and key-presence
felipemontoya Jun 10, 2026
d23091d
fix: correcting docs for build
felipemontoya Jun 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
toxenv: [quality, docs, django42, django52]

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: setup python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -34,7 +34,7 @@ jobs:

- name: Run Coverage
if: matrix.python-version == '3.12' && matrix.toxenv == 'django42'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
flags: unittests
fail_ci_if_error: true
Expand Down
47 changes: 33 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,71 @@ jobs:
version: ${{ steps.release.outputs.version }}

steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.ref_name }}
fetch-depth: 0

- run: git reset --hard ${{ github.sha }}

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v10.5.3
uses: python-semantic-release/python-semantic-release@b700dbeb1f431a0fcc30a79f3f0869407fe07278 # v10.7.0
with:
github_token: ${{ secrets.OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "github-actions@github.com"
changelog: "false"
# Commit, tag, push and build, but don't create the GitHub release.
# We create it ourselves in the next step so that the distributions
# are attached before the release is published. See that step for why.
vcs_release: "false"

- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@v10.5.3
# This repo has immutable releases enabled, which freezes a release's
# assets the moment it is published, so assets cannot be attached
# afterwards. `gh release create` handles this by creating the release as
# a draft, uploading the assets, and only then publishing it:
# https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
- name: Publish | Create GitHub Release with Assets
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Reuse the release notes python-semantic-release generated for us.
RELEASE_NOTES: ${{ steps.release.outputs.release_notes }}
TAG: ${{ steps.release.outputs.tag }}
run: |
# Output the release notes to a file
printf '%s' "$RELEASE_NOTES" > "$RUNNER_TEMP/release_notes.md"
# Creates the release as a draft, uploads the assets, and then
# publishes it -- all within this one command.
gh release create "$TAG" \
--verify-tag \
--title "$TAG" \
--notes-file "$RUNNER_TEMP/release_notes.md" \
dist/*

- name: Upload dist artifacts
if: steps.release.outputs.released == 'true'
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: dist/
if-no-files-found: error

publish_to_pypi:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.released == 'true'
if: github.ref_name == 'master' && needs.release.outputs.released == 'true'
permissions:
contents: read
id-token: write

steps:
- name: Download dist artifacts
uses: actions/download-artifact@v8
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
16 changes: 16 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ Change history for XBlock
Unreleased
----------

* Fixed ``webob_to_django_response`` dropping all but the last ``Set-Cookie``
header; they are now loaded into the Django response's cookie jar so every
cookie is sent to the client.
* Removed ``threading.RLock`` from ``Mixologist``'s class cache to make it safe
for ASGI/async deployments. ``dict.setdefault()`` atomicity (via CPython's GIL)
provides equivalent thread safety without blocking the event loop.
Relates to `openedx/openedx-platform#38680 <https://github.com/openedx/openedx-platform/issues/38680>`_.
* Deprecated ``ObjectAggregator`` from ``xblock.runtime``; it had no production
callers and will be removed in a future major release.

6.2.0 - 2026-06-09
------------------

* Migrated web_fragments into XBlock's project. You should remove web_fragments as a separate dependency if you
currently depend on it directly.

5.3.0 - 2025-12-19
------------------

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ help: ## display this help message

quality: ## check coding style with pycodestyle and pylint
pycodestyle
pylint xblock
pylint xblock web_fragments

validate: test

Expand Down
175 changes: 175 additions & 0 deletions docs/decisions/0001-service-entry-points.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
0001 Plugin-provided runtime services via entry points
######################################################

Comment on lines +1 to +3
Status
******

Proposed

Context
*******

XBlocks consume capabilities from their environment through *runtime
services*: a block declares ``@XBlock.needs("name")`` or
``@XBlock.wants("name")`` and calls ``self.runtime.service(self, "name")``.
The base ``Runtime.service()`` resolves the name against the ``_services``
dict that the runtime application populated at construction time.

This makes the *consumption* side of services fully generic, but the
*provision* side closed: only the application that instantiates the runtime
can decide which services exist. In Open edX — by far the largest user of
this library — service wiring is hardcoded in several places
(``ModuleStoreRuntime`` service dicts for LMS/Studio/preview, and the
``if/elif`` chain in the newer ``XBlockRuntime``), and there is no supported
way for a separately installed package to offer a new service.

The need is real and recurring. The motivating case is an AI-extensions
plugin that wants to offer an ``"ai_extensions"`` service so that blocks like
ORA can call LLM workflows without pinning provider SDKs or importing plugin
internals (see the community thread in the References). But the same gap
applies to any optional capability a pip-installed package might offer to
blocks: translation backends, proctoring integrations, institution-specific
storage, and so on.

Two facts about the existing design make this library the right place to
close the gap:

1. **Every runtime already funnels through ``Runtime.service()``.** Open edX
runtimes either populate ``_services`` and delegate to the base method
(``ModuleStoreRuntime``), or run their own chain and fall back to the base
method (``XBlockRuntime``). The xblock-sdk workbench uses the base
behavior directly. A fallback added here is therefore reached by every
known runtime without any changes to host applications.

2. **The library already has the discovery machinery and the stated intent.**
``xblock/plugin.py`` loads XBlocks (``xblock.v1``) and asides
(``xblock_asides.v1``) from entry points, with caching, ambiguity
detection, and an ``.overrides`` group. The reference ``Service`` class in
``xblock/reference/plugins.py`` has documented the goal for years: services
should *"be able to load through Stevedore, and have a plug-in mechanism
similar to XBlock."*

Decision
********

Add a third entry-point group to the XBlock framework, ``xblock.service.v1``,
and a fallback in ``Runtime.service()`` — the ``_load_service_from_entry_point``
method — that consults it.

A package provides a service by declaring::

entry_points={
"xblock.service.v1": [
"my_service = my_package.services:MyService",
],
}

where the entry-point name is the service name blocks declare with
``needs``/``wants``. Resolution order in ``Runtime.service()`` becomes:

1. Reject undeclared requests (unchanged): a block that never declared the
service still gets ``NoSuchServiceError``.
2. Return the runtime-provided service from ``_services`` if present
(unchanged).
3. **New:** if the runtime has nothing, try
``_load_service_from_entry_point(block, service_name)``, which loads the
provider class from the ``xblock.service.v1`` group and instantiates it as
``provider_class(runtime=self, xblock=block)``.
4. Apply ``need``/``want`` semantics to the result (unchanged): ``None`` for
a wanted-but-absent service, ``NoSuchServiceError`` for a needed one.

Reasoning behind the specific choices
=====================================

**Why a fallback in the base class rather than a hook in each runtime.**
Placing the lookup after the ``_services`` miss, inside the one method every
runtime inherits, gives complete coverage (all Open edX runtimes, the
workbench, third-party runtimes that don't override ``service()``) for a
single small change, and gives a hard guarantee: *runtime-provided services
always shadow plugin-provided ones*. A pip package cannot replace or
intercept ``user``, ``field-data``, ``i18n``, or any other service the host
application provides deliberately. "Provided" is decided by key presence in
``_services``, not truthiness: runtimes use an explicit ``None`` to mean
"this service exists but is disabled here" — the Open edX LMS maps
``completion`` to ``None`` for anonymous users, and this library's own test
suite passes ``services={'i18n': None}`` — and a plugin must not resurrect a
service the runtime switched off. Runtimes that override ``service()``
entirely keep that freedom — the fallback only exists in the default path
they opt into by calling ``super().service()``.

**Why entry points rather than configuration.** Entry points are how this
library already discovers XBlocks and asides, so providers and operators deal
with one consistent model: installing a package is the act that makes its
plugins available, and the trust decision is the install decision — exactly
as it is for XBlocks themselves. A settings-based registry would be
runtime-application-specific (this library is not Django-bound) and would put
the burden of wiring on every operator instead of on the providing package.

**Why the existing ``Plugin`` loader.** Reusing ``Plugin.load_class`` buys,
for free: per-process caching of hits *and misses* (steady-state cost of the
fallback is one dict lookup); loud ``AmbiguousPluginError`` when two installed
packages claim the same service name, instead of last-write-wins — the exact
failure mode that makes monkey-patching unacceptable; a sanctioned override
path (``xblock.service.v1.overrides``) when replacing a default implementation
is intentional; and ``register_temp_plugin`` for tests.

**Why ``provider_class(runtime=…, xblock=…)``.** This mirrors the
constructor of the reference ``Service`` class, gives the provider the two
context objects almost every service needs (and from which the rest — user,
usage key, learning context — is reachable), and keeps the contract so small
that providers do not need to import ``xblock`` at all. Note that the
fallback returns an *instance*, never a class: some runtimes
(``ModuleStoreRuntime``) call callable services with ``(block)``, and a
class-valued service would be invoked accidentally. Instantiation is
per-request for now; providers with expensive set-up are expected to cache it
themselves (module- or class-level), consistent with the long-standing
"don't over-initialize" guidance in ``reference/plugins.py``. Memoizing per
``(runtime, service_name)`` in the base class is a possible follow-up once
real-world usage shows it is needed.

**Why the ``needs``/``wants`` gate stays in front.** The declaration check
runs before any entry-point lookup, so a plugin-provided service is only ever
handed to blocks that explicitly asked for it. ``wants`` gives blocks a
portable soft-dependency: the same block works on installs with and without
the providing package, enabling features conditionally.

Rejected alternatives
=====================

* **Wiring extension points into each host-application runtime** (new
``openedx.*`` entry-point group, an ``XBLOCK_EXTRA_SERVICES`` Django
setting, or an openedx-filters filter at resolution time) — all viable, but
each covers only the call sites it patches, must be replicated for every
current and future runtime, and lives in repositories whose architectural
direction is to *shrink* their XBlock-runtime surface, not grow it. These
were prototyped and documented by the openedx-ai-extensions project (see
References) before converging here.

Consequences
************

* Installed packages can provide named runtime services to consenting blocks
on any runtime that uses the default resolution path; no host-application
changes are required.
* The service namespace becomes shared between runtime applications and
installed packages. Runtimes always win, and duplicate provider claims
fail loudly, but a future registry of well-known service names would help
providers avoid accidental collisions.
* Operators implicitly accept a package's service registrations by installing
it, as with XBlocks. If field experience shows a need for finer control, a
block-list mechanism can be layered on without changing the provider
contract.
* The behavior of every existing runtime and block is unchanged unless a
package registering ``xblock.service.v1`` entry points is installed.

References
**********

* Community discussion: https://discuss.openedx.org/t/plugin-provided-xblock-runtime-services/18682
* Prior analysis and prototypes of the platform-side alternatives:
ADR-0005 and ADR-0011 in https://github.com/openedx/openedx-ai-extensions
* Original pluggability intent: ``xblock/reference/plugins.py`` (``Service``
docstring)
* Discovery machinery reused: ``xblock/plugin.py``
* Open edX platform ADR *Role of XBlocks* (scope reduction of the platform
runtime): ``docs/decisions/0006-role-of-xblock.rst`` in edx-platform
11 changes: 11 additions & 0 deletions docs/fragments.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _Fragments API:

#############
Fragments API
#############

.. automodule:: web_fragments.fragment
:members:

.. autoclass:: web_fragments.views.FragmentView
:members:
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ in depth and guides developers through the process of creating an XBlock.
runtime
plugins
exceptions
fragments
decisions/0001-service-entry-points
xblock-tutorial/index
xblock-utils/index
2 changes: 1 addition & 1 deletion docs/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.. _GitHub Help: https://help.github.com/articles/set-up-git
.. _Git: https://help.github.com/articles/set-up-git

.. _VirtualEnv: http://www.virtualenv.org/en/latest/
.. _VirtualEnv: https://virtualenv.pypa.io/en/latest/

.. _Virtual Environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/

Expand Down
6 changes: 6 additions & 0 deletions docs/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ Plugins API
.. autoclass:: xblock.plugin.Plugin
:members:

.. autoclass:: xblock.plugin.AmbiguousPluginError
:members:

.. autoclass:: xblock.reference.plugins.Service
:members:

.. autoclass:: xblock.reference.plugins.Filesystem
:members:
Loading
Loading