Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Change history for XBlock
Unreleased
----------

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.
Comment on lines +11 to +12

@kdmccormick kdmccormick Jun 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just confirming, once this PR is released, will you open an openedx-platform PR to make this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdmccormick Yep! Will do :)


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

@kdmccormick kdmccormick Jun 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you try adding a quick fragments.rst file so that we can get web_fragements' docstrings in to the xblock docs?

Just something like this:

.. _Fragments API:

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

.. automodule:: web_fragments.fragment
    :members:

.. autoclass:: web_fragments.views.FragmentView
    :members:

I think that'll be enough to get it to automatically show up in the XBlock docs page, but LMK if it doesn't work easily and we can punt it.

Example source (Fields API)
https://github.com/openedx/XBlock/blob/c57c1bde8ff980c85bf29ef179b15b99e844b650/docs/fields.rst

Example rendered:
https://docs.openedx.org/projects/xblock/en/latest/fields.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdmccormick Added. Needed some slight tweaking to not throw errors/warnings, but seemed to work.


validate: test

Expand Down
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:
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ in depth and guides developers through the process of creating an XBlock.
runtime
plugins
exceptions
fragments
xblock-tutorial/index
xblock-utils/index
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ dependencies = [
"pytz",
"pyyaml",
"simplejson",
"web-fragments",
"webob>=1.6.0",
]

Expand All @@ -54,10 +53,15 @@ local_scheme = "no-local-version"
include-package-data = true

[tool.setuptools.packages.find]
include = [
"xblock*",
"web_fragments*",
]

[tool.setuptools.package-data]
"xblock.utils" = ["public/*", "templates/*", "templatetags/*"]
"xblock.test.utils" = ["data/*"]
"web_fragments" = ["templates/*"]

[dependency-groups]
# Base test packages, no Django version pinned
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = tox-uv>=1

[pytest]
DJANGO_SETTINGS_MODULE = xblock.test.settings
addopts = --cov xblock
addopts = --cov xblock --cov web_fragments
filterwarnings = always
norecursedirs = .* docs requirements

Expand All @@ -14,7 +14,7 @@ dependency_groups =
django42: django42
django52: test
commands =
python -Wd -m pytest {posargs:xblock}
python -Wd -m pytest {posargs:xblock web_fragments}
python -m coverage xml
allowlist_externals =
make
Expand Down
11 changes: 0 additions & 11 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions web_fragments/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Web fragments.
"""
12 changes: 12 additions & 0 deletions web_fragments/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Web Fragments Django application initialization.
"""
from django.apps import AppConfig


class WebFragmentsConfig(AppConfig):
"""
Configuration for the Web Fragments Django application.
"""

name = 'web_fragments'
Empty file.
12 changes: 12 additions & 0 deletions web_fragments/examples/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python

"""
Provides a URL for testing
"""
from django.urls import path

from web_fragments.examples.views import EXAMPLE_FRAGMENT_VIEW_NAME, ExampleFragmentView

urlpatterns = [
path('test_fragment', ExampleFragmentView.as_view(), name=EXAMPLE_FRAGMENT_VIEW_NAME),
]
25 changes: 25 additions & 0 deletions web_fragments/examples/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python

"""
Example fragment view.
"""
from web_fragments.fragment import Fragment
from web_fragments.test_utils import TEST_CSS, TEST_HTML, TEST_JS
from web_fragments.views import FragmentView

EXAMPLE_FRAGMENT_VIEW_NAME = 'example_fragment_view'


class ExampleFragmentView(FragmentView):
"""
Simple fragment view for testing.
"""

def render_to_fragment(self, request, **kwargs):
"""
Returns a simple fragment
"""
fragment = Fragment(TEST_HTML)
fragment.add_javascript(TEST_JS)
fragment.add_css(TEST_CSS)
return fragment
Loading