-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: default importdemocourse to the new course & lib #976
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- 💥 [Feature] `tutor local do importdemocourse` will now import the new [Open edX Demo Course](https://github.com/openedx/openedx-demo-course), which has been rebuilt from scratch. If you wish to import the old demo course instead (which no longer receives updates), you can run: `tutor local do importdemocourse --repo-dir . --version open-release/palm.4`. | ||
- [Feature] The new command `tutor local do importdemolibrary` will import a Demo Content Library, which is an optional but helpful extension to the Open edX Demo Course. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,14 +124,14 @@ def create_user_template( | |
@click.option( | ||
"-r", | ||
"--repo", | ||
default="https://github.com/openedx/edx-demo-course", | ||
default="https://github.com/openedx/openedx-demo-course", | ||
show_default=True, | ||
help="Git repository that contains the course to be imported", | ||
) | ||
@click.option( | ||
"-d", | ||
"--repo-dir", | ||
default="", | ||
default="demo-course/course", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change will cause some existing commands to fail, when users try to import a different custom course that is not stored in a subdirectory:
I wonder if we could simplify the CLI by auto-detecting the location of the "course.xml" file? This would make the import script much more complex. But I see no other option if we want to preserve ease-of-use and compatibility with the new demo course structure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe, for now, if the repo path ends with openedx-demo-course, treat the default as demo-course/course, otherwise ""? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @regisb I am OK with that complexity. I'll implement this logic:
@DawoudSheraz The old and new demo course are both stored in the same repo, "openedx-demo-course". "edx-demo-course" has redirected to "openedx-demo-course" a couple years. |
||
show_default=True, | ||
help="Git relative subdirectory to import data from", | ||
) | ||
|
@@ -154,6 +154,37 @@ def importdemocourse( | |
yield ("cms", template) | ||
|
||
|
||
@click.command(help="Import the demo content library") | ||
@click.argument("owner_username") | ||
@click.option( | ||
"-r", | ||
"--repo", | ||
default="https://github.com/openedx/openedx-demo-course", | ||
show_default=True, | ||
help="Git repository that contains the library to be imported", | ||
) | ||
@click.option( | ||
"-t", | ||
"--repo-tar-path", | ||
default="dist/demo-content-library.tar.gz", | ||
show_default=True, | ||
help="Git relative .tar.gz path to import content library from", | ||
) | ||
@click.option( | ||
"-v", | ||
"--version", | ||
help="Git branch, tag or sha1 identifier. If unspecified, will default to the value of the OPENEDX_COMMON_VERSION setting.", | ||
) | ||
def importdemolibrary( | ||
owner_username: str, repo: str, repo_tar_path: str, version: t.Optional[str] | ||
) -> t.Iterable[tuple[str, str]]: | ||
version = version or "{{ OPENEDX_COMMON_VERSION }}" | ||
template = f""" | ||
git clone {repo} --branch {version} --depth 1 /tmp/course | ||
yes | ./manage.py cms import_content_library /tmp/course/{repo_tar_path} {owner_username}""" | ||
yield ("cms", template) | ||
|
||
|
||
@click.command( | ||
name="print-edx-platform-setting", | ||
help="Print the value of an edx-platform Django setting.", | ||
|
@@ -324,6 +355,7 @@ def do_callback(service_commands: t.Iterable[tuple[str, str]]) -> None: | |
[ | ||
createuser, | ||
importdemocourse, | ||
importdemolibrary, | ||
initialise, | ||
print_edx_platform_setting, | ||
settheme, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should replace "palm.4" by "quince.1".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that you need to be on
quince.2
to get the new version of the course, or will it be possible to be on an older version of the platform but still import the new course?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, or even
quince.master
.Older versions of Open edX and Tutor will default to the old demo course, but it is possible to import the new demo course into them with the right arguments:
I'll update this message to be clearer about this.