overhangio / tutor-ecommerce

Ecommerce plugin for Tutor
GNU Affero General Public License v3.0
17 stars 50 forks source link

openedx/ecommerce and openedx/ecommerce-worker Python 3.12 upgrade #78

Closed DawoudSheraz closed 3 months ago

DawoudSheraz commented 5 months ago

As mentioned on https://discuss.openedx.org/t/these-idas-will-not-be-upgraded-to-python-3-11-by-redwood/12755, ecommerce and ecommerce-worker are not prioritized for Python 3.11/3.12 upgrades and are free for community to pick them up. Since these are important repositories and their upgrades are blocking tutor-ecommerce upgrade (https://github.com/overhangio/tutor-ecommerce/issues/68), Edly can take a dig at upgrading them. A note that these upgrade will be backwards compatible with 3.8.

Upstream issues

DawoudSheraz commented 4 months ago

@Danyal-Faheem Please add a status update for this issue. Thanks

Danyal-Faheem commented 4 months ago

Thank you for reminding me @DawoudSheraz.

The PR for ecommerce is still in progress as I am currently facing an issue after updating the MySQL client for compatibility with python 3.11 and 3.12. It seems like an issue with the pkg-config package which tox can't seem to locate. Also, for some reason, tox seems to be enforcing python3.8 even when the PYTHON_ENV and TOXENV is set to py311/py312 which seems to crash tox.

As for the ecommerce-worker PR, it is pending a review from the opened team as I have made the required changes.

Prakash1210 commented 3 months ago
  1. Fork the Repositories

First, fork the openedx/ecommerce and openedx/ecommerce-worker repositories to your GitHub account:

Navigate to the [openedx/ecommerce] (https://github.com/openedx/ecommerce) repository and click the "Fork" button. Navigate to the [openedx/ecommerce-worker] (https://github.com/openedx/ecommerce-worker) repository and click the "Fork" button.

  1. Clone the Forked Repositories

Clone your forked repositories to your local machine:

git clone https://github.com/<your-username>/ecommerce.git
git clone https://github.com/<your-username>/ecommerce-worker.git
  1. Set Up Python Environments

Set up Python environments for both projects. You can use tools like pyenv and virtualenv to manage multiple Python versions.

# For ecommerce
cd ecommerce
pyenv install 3.11.0
pyenv install 3.12.0
pyenv local 3.11.0: Switch to Python 3.11
Python: -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt

# For ecommerce-worker
cd ../ecommerce-worker
pyenv local 3.11.0: Switch to Python 3.11
Python: -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
  1. Update CI Configurations

Update the CI configurations to include Python 3.11 and 3.12. Typically, these configurations are in .github/workflows/ci.yml or similar files.

For example, in a GitHub Actions workflow:

# .github/workflows/ci.yml
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.8, 3.11, 3.12]
    steps:
    uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
        pip install -r requirements-dev.txt
    - name: Run tests
      run: |
        pytest  # Or the test command specific to the project
  1. Fix Compatibility Issues

Run the tests locally for Python 3.11 and 3.12 and fix any compatibility issues. This may involve updating dependencies, modifying code to be compatible with new Python versions, or fixing deprecations.

 For ecommerce
cd ecommerce
pyenv local 3.11.0
source venv/bin/activate
pytest

pyenv local 3.12.0
source venv/bin/activate
pytest

 For ecommerce-worker
cd ../ecommerce-worker
pyenv local 3.11.0
source venv/bin/activate
pytest

pyenv local 3.12.0
source venv/bin/activate
pytest
  1. Commit and Push Changes

After ensuring that all tests pass, commit and push your changes to your forked repositories:

 For ecommerce
cd ecommerce
git add .
git commit -m "Add CI support for Python 3.11 and 3.12"
git push origin main

 For ecommerce-worker
cd ../ecommerce-worker
git add .
git commit -m "Add CI support for Python 3.11 and 3.12"
git push origin main
  1. Create Pull Requests

Create pull requests to the original repositories:

8. Monitor and Respond to Feedback

Monitor the pull requests for any feedback from the repository maintainers and respond promptly. You may need to make additional changes based on their comments.

Summary

  1. Fork and clone the repositories.
  2. Set up Python environments for Python 3.11 and 3.12.
  3. Update CI configurations to include Python 3.11 and 3.12.
  4. Fix any compatibility issues and run tests locally.
  5. Commit and push the changes.
  6. Create pull requests.
  7. Monitor and respond to feedback.

By following these steps, you should be able to contribute to the upgrade of openedx/ecommerce and openedx/ecommerce-worker to support Python 3.11 and 3.12.

DawoudSheraz commented 3 months ago

The above seems like an AI-generated comment, it is a very generic to-do list.

DawoudSheraz commented 3 months ago

@Faraz32123 Please add the updates on the issue, including the PRs. Thank you.

Faraz32123 commented 3 months ago

PR for ecommerce-Worker is already merged and its Issue is closed.

For ecommerce, it's PR is up for review. Already asked some folks for a review. Once it's reviewed & merged, it's issue will also be closed.

Faraz32123 commented 3 months ago

Closing this issue as the upstream Issues are closed.