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

tutor-ecommerce codebase Python 3.12 upgrade #68

Closed
2 tasks done
DawoudSheraz opened this issue Feb 21, 2024 · 4 comments
Closed
2 tasks done

tutor-ecommerce codebase Python 3.12 upgrade #68

DawoudSheraz opened this issue Feb 21, 2024 · 4 comments
Assignees

Comments

@DawoudSheraz
Copy link

DawoudSheraz commented Feb 21, 2024

  • Ensure tutor-ecommerce codebase is compatible with Python 3.12
  • Update Python to 3.12 in Dockerfile for nightly and ensure the image builds as expected. The changes would be merged to nightly. This task would rely on upgrade of ecommerce to Python 3.12

See overhangio/tutor#1004 for the context.

@Faraz32123
Copy link
Collaborator

Faraz32123 commented Mar 18, 2024

I attempted building ecommerce and ecommerce-worker dockerfile on Python 3.12.2 on Nightly branch. Here's a PR for it.

Build for ecommerce-worker's dockerfile was a success after a change in ecommerce-worker repo as i was facing conflict in dependencies. Here's a PR for ecommerce-worker to resolve dependency issue..

For ecommerce's dockerfile, i faced below error. The error seems to occur due to depreciation of formatargspec method from inspect in python 3.12.2. Will further investigate it.

=> ERROR [python 19/25] RUN python manage.py compilemessages                                                                          1.3s
------
 > importing cache manifest from docker.io/overhangio/openedx-ecommerce:17.0.1-nightly-cache:
------
------
 > [python 19/25] RUN python manage.py compilemessages:
1.067 Traceback (most recent call last):
1.067   File "/openedx/venv/lib/python3.12/site-packages/oscar/core/loading.py", line 244, in get_model
1.067     return apps.get_model(app_label, model_name)
1.067            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.067   File "/openedx/venv/lib/python3.12/site-packages/django/apps/registry.py", line 199, in get_model
1.068     self.check_models_ready()
1.068   File "/openedx/venv/lib/python3.12/site-packages/django/apps/registry.py", line 141, in check_models_ready
1.068     raise AppRegistryNotReady("Models aren't loaded yet.")
1.068 django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
1.068 
1.068 During handling of the above exception, another exception occurred:
1.068 
1.068 Traceback (most recent call last):
1.068   File "/openedx/venv/lib/python3.12/site-packages/vine/five.py", line 361, in <module>
1.068     from inspect import formatargspec, getfullargspec
1.069 ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/local/lib/python3.12/inspect.py). Did you mean: 'formatargvalues'?
1.069 
1.069 During handling of the above exception, another exception occurred:
1.069 
1.069 Traceback (most recent call last):
1.069   File "/openedx/ecommerce/manage.py", line 11, in <module>
1.069     execute_from_command_line(sys.argv)
1.069   File "/openedx/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
1.069     utility.execute()
1.069   File "/openedx/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 395, in execute
1.070     django.setup()
1.070   File "/openedx/venv/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
1.070     apps.populate(settings.INSTALLED_APPS)
1.070   File "/openedx/venv/lib/python3.12/site-packages/django/apps/registry.py", line 114, in populate
1.071     app_config.import_models()
1.071   File "/openedx/venv/lib/python3.12/site-packages/django/apps/config.py", line 301, in import_models
1.071     self.models_module = import_module(models_module_name)
1.071                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.071   File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
1.071     return _bootstrap._gcd_import(name[level:], package, level)
1.071            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.071   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
1.071   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
1.071   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
1.071   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
1.071   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
1.071   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
1.071   File "/openedx/ecommerce/ecommerce/courses/models.py", line 20, in <module>
1.071     from ecommerce.extensions.catalogue.utils import generate_sku
1.071   File "/openedx/ecommerce/ecommerce/extensions/catalogue/utils.py", line 13, in <module>
1.071     from ecommerce.extensions.voucher.utils import create_vouchers
1.071   File "/openedx/ecommerce/ecommerce/extensions/voucher/utils.py", line 23, in <module>
1.072     from ecommerce.enterprise.benefits import BENEFIT_MAP as ENTERPRISE_BENEFIT_MAP
1.072   File "/openedx/ecommerce/ecommerce/enterprise/benefits.py", line 6, in <module>
1.072     from ecommerce.extensions.offer.mixins import AbsoluteBenefitMixin, BenefitWithoutRangeMixin, PercentageBenefitMixin
1.072   File "/openedx/ecommerce/ecommerce/extensions/offer/mixins.py", line 7, in <module>
1.072     Benefit = get_model('offer', 'Benefit')
1.072               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.072   File "/openedx/venv/lib/python3.12/site-packages/oscar/core/loading.py", line 256, in get_model
1.072     import_module('%s.%s' % (app_config.name, MODELS_MODULE_NAME))
1.072   File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
1.073     return _bootstrap._gcd_import(name[level:], package, level)
1.073            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.073   File "/openedx/ecommerce/ecommerce/extensions/offer/models.py", line 21, in <module>
1.073     from oscar.apps.offer.abstract_models import (
1.073   File "/openedx/venv/lib/python3.12/site-packages/oscar/apps/offer/abstract_models.py", line 26, in <module>
1.073     load_proxy, unit_price = get_classes('offer.utils', ['load_proxy', 'unit_price'])
1.073                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.073   File "/openedx/venv/lib/python3.12/site-packages/oscar/core/loading.py", line 48, in get_classes
1.074     return class_loader(module_label, classnames, module_prefix)
1.074            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.074   File "/openedx/venv/lib/python3.12/site-packages/oscar/core/loading.py", line 119, in default_class_loader
1.074     local_module = _import_module(local_module_label, classnames)
1.074                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.074   File "/openedx/venv/lib/python3.12/site-packages/oscar/core/loading.py", line 140, in _import_module
1.074     return __import__(module_label, fromlist=classnames)
1.074            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.074   File "/openedx/ecommerce/ecommerce/extensions/offer/utils.py", line 15, in <module>
1.074     from ecommerce_worker.email.v1.api import send_offer_assignment_email, send_offer_update_email
1.074   File "/openedx/venv/lib/python3.12/site-packages/ecommerce_worker/email/v1/api.py", line 7, in <module>
1.075     from .tasks import (
1.075   File "/openedx/venv/lib/python3.12/site-packages/ecommerce_worker/email/v1/tasks.py", line 6, in <module>
1.075     from celery import shared_task
1.075   File "/openedx/venv/lib/python3.12/site-packages/celery/__init__.py", line 19, in <module>
1.075     from . import local  # noqa
1.075     ^^^^^^^^^^^^^^^^^^^
1.075   File "/openedx/venv/lib/python3.12/site-packages/celery/local.py", line 17, in <module>
1.075     from .five import PY3, bytes_if_py2, items, string, string_t
1.075   File "/openedx/venv/lib/python3.12/site-packages/celery/five.py", line 7, in <module>
1.075     import vine.five
1.075   File "/openedx/venv/lib/python3.12/site-packages/vine/__init__.py", line 8, in <module>
1.075     from .abstract import Thenable
1.075   File "/openedx/venv/lib/python3.12/site-packages/vine/abstract.py", line 6, in <module>
1.075     from .five import with_metaclass, Callable
1.075   File "/openedx/venv/lib/python3.12/site-packages/vine/five.py", line 364, in <module>
1.076     from inspect import formatargspec, getargspec as _getargspec  # noqa
1.076     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.076 ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/local/lib/python3.12/inspect.py). Did you mean: 'formatargvalues'?
------
Dockerfile:98
--------------------
  96 |     
  97 |     RUN atlas pull --repository="openedx/openedx-translations" --revision="main"  translations/ecommerce/ecommerce/conf/locale:ecommerce/conf/locale
  98 | >>> RUN python manage.py compilemessages
  99 |     
 100 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c python manage.py compilemessages" did not complete successfully: exit code: 1

@Faraz32123
Copy link
Collaborator

Faraz32123 commented Mar 19, 2024

I have created a PR to resolve the errors in ecommerce dockerfile upgrade.

@DawoudSheraz
Copy link
Author

@Faraz32123 does this require any further action? Thanks

@Faraz32123
Copy link
Collaborator

closing this issue as its PR is merged.

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

No branches or pull requests

3 participants