Skip to content
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: add mitxpro-social-auth #376

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Anas12091101
Copy link
Contributor

@Anas12091101 Anas12091101 commented Sep 12, 2024

What are the relevant tickets?

https://github.com/mitodl/hq/issues/5404

Description (What does it do?)

Adds social-auth-mitxpro renamed as ol-social-auth in open-edx-plugins

How can this be tested?

  • Start edx-platform and mitxpro containers.
  • Clone this project in the src folder present in your Open edX work directory.
  • Install pants locally and run the command in the project folder: pants package ::. This will create a tar file ol-social-auth-1.0.0.tar.gz in the dist folder.
  • Configure Open edX with mitxpro using https://github.com/mitodl/mitxpro/blob/master/docs/configure_open_edx.md if not already and replace social_auth_mitxpro.backends.MITxProOAuth2 with ol_social_auth.backends.MITxProOAuth2 in THIRD_PARTY_AUTH_BACKENDS
  • Install the tar file in your lms by first creating the lms shell using make lms-shell command in the devstack folder and then pip install /edx/src/open-edx-plugins/dist/ol-social-auth-1.0.0.tar.gz.
  • Open a private window and create a new account on xpro. Validate that the same user is created in edx-platform.

Additional Context

@Anas12091101 Anas12091101 marked this pull request as draft September 12, 2024 14:55
Copy link
Contributor

@arslanashraf7 arslanashraf7 left a comment

Choose a reason for hiding this comment

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

This is just the code review. I will functionality test this in the next iteration.

Comment on lines 47 to 55
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies:
- types-pytz
- types-requests
- types-pkg_resources
- types-python-dateutil
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you tell me why we have removed it in this PR or any specific reason as to why we are removing it at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were some errors thrown by the pre-commit for mypy therefore, I decided to run the pre-commit without it. I also checked MiTxPRO, MITxOnline and Bootcamp and didn't find the mypy hook.

I'll re-add it in the next commit after resolving the errors

@@ -21,6 +21,7 @@ cd /open-edx-plugins

# Installing test dependencies
pip install pytest-mock==3.14.0
pip install responses==0.25.3
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it being installed through testing.txt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No

Copy link
Contributor

Choose a reason for hiding this comment

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

pyproject.toml Outdated
@@ -17,6 +17,7 @@ gitpython = "^3.1.37"
python-json-logger = "^2.0.2"
sentry-sdk = "^2.0.0"
XBlock = "*"
social-auth-core = "*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should pin this. We don't want to override this package in our open edX instances other than what is being installed by open edx.

],
provides=setup_py(
name="ol-social-auth",
version="1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

None of our apps go with 1.x. They all start with a major version. 0.x.x. If we are starting this off we should go with 0.1.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to 0.1.0 but when we added the openedx-companion-auth plugin, it was also started from 1.0.0 (reference)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think 0.1.0 is more suitable based on how we use the versioning of our projects.

@@ -0,0 +1,29 @@
BSD 3-Clause License
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any LICENSE files that include this line? I think you can copy this from one of the existing LICENSE files from other packages in this repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

openedx-companion-auth also has this line. Changing both in the next commit

provides=setup_py(
name="ol-social-auth",
version="1.0.0",
description="A package implementing MIT social auth backend",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description="A package implementing MIT social auth backend",
description="An Open edX plugin implementing MIT social auth backend",

poetry.lock Outdated
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
Copy link
Contributor

Choose a reason for hiding this comment

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

Have we downgraded the poetry version? The previous file was generated using 1.8.3 but this time its generated with 1.6.1.

Copy link
Contributor Author

@Anas12091101 Anas12091101 Sep 26, 2024

Choose a reason for hiding this comment

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

Regenerated with the 1.8.3 version in the next commit

Version Compatibility
---------------------

Compatible with the Nutmeg release of the Open edX and onwards. May work with prior releases as well.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is not correct, Our backend has been working prior to that. Did you copy this from the documentation in the original project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I copied this from openedx-companion-auth Readme. Since both are used together, I thought they would have a similar support. What should I write here? Compatible with all edx releases?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you check the history of the original repo and if there is compatibility mentioned there. If not, you can check the history of that repo to see if it is correct. Otherwise, you can skip this heading altogether.

Comment on lines +49 to +51
* Install the plugin in the lms following the installation steps above.
* Verify that you are not logged in on edx-platform.
* Create a new user in your MIT application and verify that a corresponding user is successfully created on the edX platform.
Copy link
Contributor

Choose a reason for hiding this comment

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

These steps should include that the provider and other configuration be done before testing this.

* **MITxOnline with Tutor:** If you're using MITxOnline with Tutor for development purposes, specific configuration steps are outlined in the `documentation <https://github.com/mitodl/mitxonline/blob/main/docs/source/configuration/tutor.rst>`_


Working
Copy link
Contributor

Choose a reason for hiding this comment

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

We should keep things standardized. We are using this heading as How To Use in other plugins.

@Anas12091101
Copy link
Contributor Author

CI failing due to a recent commit in Tutor in which packaging library was used but the package was not set in the requirements file. A fix is already in progress.

Copy link
Contributor

@arslanashraf7 arslanashraf7 left a comment

Choose a reason for hiding this comment

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

The code looks good. But the setup.py file the generate bundle doesn't contain the 'install_requires' section which should have the dependencies for this package.

@@ -0,0 +1,21 @@
python_sources(
name="ol_social_auth_source",
dependencies=["//:external_dependencies#social-auth-core"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

pants was not detecting social-auth-core automatically, therefore I added it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants