Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Add a tutor plugin to easily run this on a devstack #50

Merged

Conversation

bradenmacdonald
Copy link
Contributor

@bradenmacdonald bradenmacdonald commented Jul 5, 2022

It's a bit tricky to get this working on a Tutor-based devstack, but this plugin should make it easy!

This updates the README to explain how to use this MFE on a Tutor-based devstack, using the included plugin. See https://github.com/openedx/frontend-app-library-authoring/blob/bb9ee6590cc715daaf74fe84947ccc0baf3a07b8/tutor-contrib-library-authoring-mfe/README.rst for the details on how to use it.

Tested end-to-end using the drag and drop v2 XBlock. Other XBlocks may not work correctly for unrelated reasons.

CI failure is unrelated.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 5, 2022
@openedx-webhooks
Copy link

Thanks for the pull request, @bradenmacdonald! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@natabene
Copy link

@bradenmacdonald Thank you for your contribution. Please let me know once this is ready for our review.

@bradenmacdonald
Copy link
Contributor Author

@natabene It's ready now. There is an error in the CI build but it's not related to this. I'm not sure if this repo has a maintainer at the moment? Because the build is failing because nobody is updating the dependencies of this repo and/or several related repos like @edx/frontend-component-footer

@connorhaugh
Copy link
Contributor

connorhaugh commented Aug 15, 2022

Braden, I gave this a test (for local dev development) on my local tutor and it seems to work. I'll give a thumb here when we resolve the unrelated CI issues (which we are working on presently) and see this PR merged.

@connorhaugh
Copy link
Contributor

@bradenmacdonald a rebase off master should fix the CI issues.

@codecov
Copy link

codecov bot commented Aug 15, 2022

Codecov Report

Base: 42.20% // Head: 48.69% // Increases project coverage by +6.49% 🎉

Coverage data is based on head (bd5f231) compared to base (07c8ccc).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   42.20%   48.69%   +6.49%     
==========================================
  Files          72       76       +4     
  Lines        1834     1957     +123     
  Branches      317      354      +37     
==========================================
+ Hits          774      953     +179     
+ Misses       1025      970      -55     
+ Partials       35       34       -1     
Impacted Files Coverage Δ
src/library-authoring/common/LibraryIndexTabs.jsx 75.00% <0.00%> (-25.00%) ⬇️
...rc/library-authoring/create-library/data/thunks.js 20.00% <0.00%> (-7.28%) ⬇️
src/library-authoring/create-library/data/slice.js 16.00% <0.00%> (-3.05%) ⬇️
src/index.jsx 0.00% <0.00%> (ø)
src/library-authoring/common/data/constants.js 60.00% <0.00%> (ø)
src/library-authoring/list-libraries/data/slice.js 30.76% <0.00%> (ø)
...ary-authoring/create-library/LibraryCreateForm.jsx
...brary-authoring/list-libraries/LibraryListItem.jsx
.../library-authoring/common/OrganizationDropdown.jsx 95.23% <0.00%> (ø)
src/library-authoring/common/FormGroup.jsx 94.11% <0.00%> (ø)
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bradenmacdonald
Copy link
Contributor Author

@connorhaugh Thanks!! Yep, that did it.

@brian-smith-tcril
Copy link
Contributor

I tested this locally.

tl;dr

I needed to run pip install -e git+https://github.com/open-craft/frontend-app-library-authoring.git@tutor-devstack-plugin#egg=tutor_contrib_library_authoring_mfe\&subdirectory=tutor-contrib-library-authoring-mfe for this to install correctly.

Questions

  • Is escaping the & is required on all platforms?
  • What are the conventions around using contrib in tutor plugin names?
    • Should tutor-contrib-library-authoring-mfe be updated to be tutor-library-authoring-mfe in setup.py before this gets merged?

Play by play

First issue I encountered was related to the line

pip install -e git+https://github.com/openedx/frontend-app-library-authoring.git#egg=tutor_library_authoring_mfe&subdirectory=tutor-contrib-library-authoring-mfe

which, for testing purposes, i updated to be

pip install -e git+https://github.com/open-craft/frontend-app-library-authoring.git@tutor-devstack-plugin#egg=tutor_library_authoring_mfe&subdirectory=tutor-contrib-library-authoring-mfe

when running it, I encountered an error

ERROR: tutor_library_authoring_mfe from git+https://github.com/open-craft/frontend-app-library-authoring.git@tutor-devstack-plugin#egg=tutor_library_authoring_mfe (from -r /tmp/pipenv-ikn3q7vk-requirements/pipenv-a7yegfe3-requirement.txt (line 1)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

which I resolved by escaping the & by using \&

pip install -e git+https://github.com/open-craft/frontend-app-library-authoring.git@tutor-devstack-plugin#egg=tutor_library_authoring_mfe\&subdirectory=tutor-contrib-library-authoring-mfe

when running that, I encountered another error

  WARNING: Generating metadata for package tutor_library_authoring_mfe produced metadata for project name tutor-contrib-library-authoring-mfe. Fix your #egg=tutor_library_authoring_mfe fragments.
ERROR: Could not find a version that satisfies the requirement tutor-library-authoring-mfe (unavailable) (from versions: none)
ERROR: No matching distribution found for tutor-library-authoring-mfe (unavailable)

I'm not sure what the conventions around using contrib are, but that seemed to be causing the issue.

I pushed the branch to my fork, and made a commit (brian-smith-tcril@4982704) updating setup.py to use tutor-library-authoring-mfe as the name instead of tutor-contrib-library-authoring-mfe

installing this using

pip install -e git+https://github.com/brian-smith-tcril/frontend-app-library-authoring.git@tutor-plugin#egg=tutor_library_authoring_mfe\&subdirectory=tutor-contrib-library-authoring-mfe

worked as expected, at which point I uninstalled and decided to try

pip install -e git+https://github.com/open-craft/frontend-app-library-authoring.git@tutor-devstack-plugin#egg=tutor_contrib_library_authoring_mfe\&subdirectory=tutor-contrib-library-authoring-mfe

which worked as expected

@brian-smith-tcril
Copy link
Contributor

After getting it running, I tried creating a content library and adding some components. Creating the library worked as expected, but every component is failing to load with the error: Cannot GET /library_authoring/xblock-bootstrap.html

I'm thinking this may be related to the change from library_authoring to library-authoring in this commit d719044

Copy link
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

Overall this is really great! I'm super excited to see MFEs working as tutor plugins!

The big one here is the change in plugin.py, without that this just doesn't work.

I'm not sure about escaping the & in the readme, but running the command didn't work for me without it. I'm also not sure what to do about the tutor_contrib_library_authoring_mfe vs tutor_library_authoring_mfe thing, so it'd be helpful to get some outside input on that.

Looking forward to seeing what we can do to get this merged in!

@arbrandes
Copy link
Contributor

arbrandes commented Sep 9, 2022

Thanks for the in-depth review, @brian-smith-tcril! From where I stand those are all great catches, though I'll let @bradenmacdonald weigh in and/or pull in your changes before we merge.

Also,

I'm not sure what the conventions around using contrib are

There's some prior art by our colleague @kdmccormick:

https://github.com/openedx/tutor-contrib-coursegraph

Which is to say, I'd try to fix it in the other direction, if possible. (In other words, getting rid of the error when the package is prefixed with tutor-contrib.)

@kdmccormick
Copy link
Contributor

I'm excited about this plugin @bradenmacdonald, and thanks for working through that @brian-smith-tcril.

I agree that the Python distribution name (the thing defined in setup.py) should be tutor-contrib-library-authoring-mfe. That way, if this is ever pushed to PyPI, it would be installed as pip install tutor-contrib-library-authoring-mfe, clarifying that it's a contributor plugin, not an official one.

The Python package name is good to remain as tutor_library_authoring_mfe. That'll ensure that the plugin can be enabled via tutor enable library_authoring_mfe instead of the awkward tutor enable contrib_library_authoring_mfe.

(the docs on all of this ^ aren't great yet, but they're deductible by reverse engineering https://github.com/overhangio/cookiecutter-tutor-plugin)

Some other notes:

  • The #egg= should match the Python distribution name, not the Python package name. That is, it should be #egg=tutor-contrib-library-authoring-mfe, not #egg=tutor_library_authoring_mfe. I think it is working somewhat by coincidence currently because pip is willing to silently translate the underscores into hyphens.
  • Instead of escaping the &, we could wrap the entire git+https://... thing in single quotes. That way, bash won't treat & as a special character.

@bradenmacdonald
Copy link
Contributor Author

Thanks for the review @brian-smith-tcril ! I've pushed bd5f231 to make those fixes. Would you mind checking if that did it?

What are the conventions around using contrib in tutor plugin names?

Using contrib is required - Regis has asked that any plugins that aren't created by him, i.e. any unofficial plugins, use contrib in the name to clearly distinguish them from plugins supported by overhang.io.

Copy link
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

Perfect!

I can verify this worked locally for me when I followed the instructions in tutor-contrib-library-authoring-mfe/README.rst when changing the install step to

pip install -e 'git+https://github.com/open-craft/frontend-app-library-authoring.git@tutor-devstack-plugin#egg=tutor-contrib-library-authoring-mfe&subdirectory=tutor-contrib-library-authoring-mfe'

I can verify again using the actual line from the README after this is merged.

@connorhaugh connorhaugh self-requested a review September 12, 2022 15:28
@bradenmacdonald
Copy link
Contributor Author

@brian-smith-tcril @arbrandes Can we merge this now?

@arbrandes arbrandes self-requested a review October 12, 2022 13:34
@arbrandes arbrandes merged commit e668986 into openedx-unsupported:master Oct 17, 2022
@openedx-webhooks
Copy link

@bradenmacdonald 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@arbrandes
Copy link
Contributor

Let's merge this! Apologies for the delay, @bradenmacdonald, and thanks for the contrib!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants