build!: Restructure repo & rename to xblocks-core - #244
Conversation
cbb0348 to
e92b6ed
Compare
| @@ -14,7 +14,7 @@ <h3 class="hd hd-2">{{ display_name|escape }}</h3> | |||
| data-block-id='{{ block_id|escape }}' | |||
| data-course-id='{{ course_id|escape }}' | |||
| tabindex="-1" | |||
| data-package-name="xblocks-contrib"> | |||
| data-package-name="xblocks-core"> | |||
There was a problem hiding this comment.
The only mention of this is in this file and I didn't see any mention of this in the openedx-platform history so I have no idea.
There was a problem hiding this comment.
We added it for testing purpose to differentiate between BuiltIn and Extracted Block at brower.
- renaming with repo sounds good.
- We can remove it after removal of BuiltIn blocks, removing now seems alright as well as we are pretty much done with the major testing.
86c65f3 to
5fbbf35
Compare
a70e618 to
a91002d
Compare
bd1ae1d to
76dd6bc
Compare
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: true | ||
| fail-fast: false |
There was a problem hiding this comment.
| fail-fast: false | |
| fail-fast: true |
Note to self: Undo this before merging
fe1f184 to
7a9efbf
Compare
|
@feanil Tests all pass on this locally. I'm still manually testing and waiting on GHA to catch up, but feel free to take a look if you have time. You can review commit-by-commit. |
fbe6c1c to
ba3dc09
Compare
feanil
left a comment
There was a problem hiding this comment.
I tried to do as thorough a review as I could on this big change, but there are a lot of moving parts so the openedx-platform testing will be critical for this. That said, a not for other reviewers is that the consolidated diff makes reading the translations changes a bit confusing since it makes it seem like translations conf files were move around in between blocks. But looking at the commit diffs it's more obvious what's going on.
| @@ -14,7 +14,7 @@ <h3 class="hd hd-2">{{ display_name|escape }}</h3> | |||
| data-block-id='{{ block_id|escape }}' | |||
| data-course-id='{{ course_id|escape }}' | |||
| tabindex="-1" | |||
| data-package-name="xblocks-contrib"> | |||
| data-package-name="xblocks-core"> | |||
There was a problem hiding this comment.
The only mention of this is in this file and I didn't see any mention of this in the openedx-platform history so I have no idea.
|
Thanks @feanil ! Per my latest testing, this is working fine on
I'll hold off until merging until I can fix |
farhan
left a comment
There was a problem hiding this comment.
LGTM!
Skipped translations code review as it needs to work on it later on.
There was a problem hiding this comment.
| * Done: The built-in block has been removed. The setup.py entrypoint has been removed from edx-platform and added to xblock-core. |
376c4da to
8b0aa19
Compare
e183482 to
e35a81f
Compare
The src/xblock_pdf/js_tests workspace (pdf-block) declares vitest, vite, @vitest/browser-playwright, and typescript as devDependencies, but package-lock.json was not regenerated to include their dependency tree. This left the lock out of sync with the workspace's package.json, so `npm ci` would fail. Regenerate the lock to add the missing (dev-only) transitive dependencies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The repository was originally named "xblocks-contrib", inspired by "django.contrib", which is a collection of nonessential but widely used django modules such as django.contrib.auth. But, the "Contrib" the term is not widely understood in Open edX, whereas "Core Blocks" is a widely understood concept. So, we've decided to rename the project while it's still new. This commit updates the PyPI package name, the GitHub repository URL, the development status classifier (Alpha → Production/Stable), the README title, and all documentation references. Code and file layout are unchanged here; the module restructuring follows in the next commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Related: #149
Each XBlock now lives in its own standalone package under src/. Previously, all built-in XBlocks shared a single xblocks_contrib namespace package (xblocks_contrib.annotatable, xblocks_contrib.video, etc.), with xblock_pdf as a separate exception. The new layout is: src/xblock_annotatable/ src/xblock_discussion/ src/xblock_html/ src/xblock_lti/ src/xblock_pdf/ src/xblock_poll_question/ src/xblock_problem/ src/xblock_video/ src/xblock_word_cloud/ src/xblocks_core/ (shared legacy utilities) Each package has a single block.py entry point, an __init__.py that re-exports the block class, and its own conf/locale/ and .tx/config for translations. This makes it straightforward to eventually publish any XBlock as a separate, independently versioned package, if that is ever desired. It also is also now possible and low-risk to add new blocks in (e.g. xblock_drag_and_drop_v2) without changing their improt path. The poll XBlock becomes xblock_poll_question rather than xblock_poll because the name xblock_poll is already registered on PyPI by OpenCraft's polling XBlock (https://github.com/open-craft/xblock-poll), which has a different feature set. The entry-point key was already _poll_question_extracted, so consumers using the entry-point API are unaffected; only direct Python imports of xblocks_contrib.poll change. Dev and prod static-asset paths are now the same (public/<asset> relative to each block), removing a special-case code path that produced different paths in the two environments. Related: #237 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The discussion and problem XBlock webpack configs use the webpack-merge v5 API to combine shared and environment-specific configuration objects. Webpack- merge was previously available only as a transitive dependency, so it was not guaranteed to be at the right major version. Adding it explicitly as a direct devDependency ensures the correct version is installed regardless of what other packages happen to pull in. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Now that all packages live under src/, pytest and coverage need to know to look there rather than at the old top-level xblocks_contrib/ and xblock_pdf/ directories. On the pytest side: add "." and "src" to pythonpath so that test_settings.py (at the repo root) and the new src/xblock_*/ packages are both importable without an editable install. Add "build" to norecursedirs so that any compiled artifacts under build/lib/ are not mistakenly collected as test modules. Update --cov to point at src so that coverage is reported across all packages in one pass. On the coverage side: set source = ["src"] for the same reason. Tox already runs pytest with "src" as the positional argument, which is unchanged here; this commit focuses on the ini-level defaults that apply whether you run pytest directly or through tox. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The docs environment uses uv-venv-lock-runner with package = true, so the project is already installed when tox sets up the virtual environment. The pip install -e . call was not present on main and is not needed. It was also causing a tox failure because pip is not listed in allowlist_externals for that environment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
563f2b3 to
269c3d2
Compare
495d816 to
269c3d2
Compare
The previous commits had updated package-lock.json on macOS, which caused it to be broken on other platforms like CI. This regenerates package-lock.json from scratch on Ubuntu 24.04.

Related
xblocks-core#149Description
Overview
This PR reshapes the project around two breaking changes: it renames the distribution from
xblocks-contribto
xblocks-core, and it restructures the codebase so each built-in XBlock lives in its own standalonepackage under
src/.The changes are broken down by commit, with the major ones highlighted below.
Rename:
xblocks-contrib→xblocks-coreThe project was originally named "xblocks-contrib" after
django.contrib, but "Contrib" isn't a widelyunderstood term in Open edX, whereas "Core Blocks" is. Since the project is still new, we're renaming it
now. This updates the PyPI package name, the GitHub repository URL, the development-status classifier (Alpha
→ Production/Stable), and all README and documentation references. No code or file layout changes are part
of the rename itself.
Restructure: one package per XBlock under
src/Previously all built-in XBlocks shared a single
xblocks_contribnamespace package(
xblocks_contrib.annotatable,xblocks_contrib.video, etc.), withxblock_pdfas a separate exception.Each XBlock now lives in its own standalone package under
src/:Each package has a single
block.pyentry point, an__init__.pythat re-exports the block class, and itsown
conf/locale/and.tx/configfor translations. This makes it straightforward to eventually publishany XBlock as an independently versioned package, and makes it low-risk to add new blocks without changing
their import paths.
A couple of notable details:
xblock_poll_questionrather thanxblock_poll, becausexblock_pollis alreadyregistered on PyPI by OpenCraft's polling XBlock. The entry-point key was already
_poll_question_extracted, so consumers using the entry-point API are unaffected — only direct Pythonimports of
xblocks_contrib.pollchange.public/<asset>relative to each block), removing aspecial-case code path that produced different paths in the two environments.
Supporting changes
The remaining commits are follow-on build and cleanup work to support the new layout: updated test and
coverage configuration for the
src/layout, an explicitwebpack-mergedev dependency, apackage-lock.jsonregeneration to pick up thepdf-blockVitest dependency tree, aruff formatpass,and removal of a redundant pip install from the docs tox environment.
BREAKING CHANGES (across all commits)
xblocks-contribtoxblocks-core.xblocks_contrib.*namespace to per-block packages (e.g.xblocks_contrib.poll→xblock_poll_question). Consumers using the XBlock entry-point API are unaffected.AI
Opus did the first-pass restructuring. Feanil and I both added fixes of our own. I reviewed all changes line-by-line/
The git history became a mess, so I used Sonnet to split it back up into multiple commits.
Testing
Needs to be tested with the accompanying platform PR:
I validated that this works with dev settings on my machine using my bare-metal setup.
I validated that this works with prod settings using the sandbox on the linked openedx-platform PR.
Testing process: