Skip to content

Conversation

@rtibbles
Copy link
Member

Summary

I realized after reviewing #13463 that our Python webpack JSON tool in kolibri-tools is not Python 3.13 compatible.
This updates this tooling to be Python 3.13 compatible by default, and then require backports on older Python versions.

References

Fixes #13548

Reviewer guidance

Create a Python 3.13 venv, make sure the yarn run devserver works on it.
Ensure the build still works on CI (in Python 3.6)!

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... DEV: tools Internal tooling for development SIZE: small labels Jul 16, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 16, 2025

@nucleogenesis nucleogenesis self-assigned this Jul 17, 2025
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

I got this error when installing dev requirements:

Collecting nodeenv==1.3.3 (from -r requirements/dev.txt (line 11))
  Using cached nodeenv-1.3.3.tar.gz (34 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [39 lines of output]
      /tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py:552: SyntaxWarning: invalid escape sequence '\.'
        node_ver = opt.node.replace('.', '\.')
      /tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py:553: SyntaxWarning: invalid escape sequence '\.'
        rexp_string = "%s-v%s[^/]*/(README\.md|CHANGELOG\.md|LICENSE)"\
      /tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py:937: SyntaxWarning: invalid escape sequence '\d'
        VERSION_RE = re.compile('\d+\.\d+\.\d+')
      /tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py:1113: SyntaxWarning: invalid escape sequence '\S'
        ACTIVATE_BAT = """\
      /tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py:1159: SyntaxWarning: invalid escape sequence '\S'
        ACTIVATE_PS1 = """\
      /tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py:1206: SyntaxWarning: invalid escape sequence '\.'
        ACTIVATE_SH = """
      /tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py:1334: SyntaxWarning: invalid escape sequence '\.'
        ACTIVATE_FISH = """
      Traceback (most recent call last):
        File "/run/media/jacob/LE/krakens/kolibri/.test-vent/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
          ~~~~^^
        File "/run/media/jacob/LE/krakens/kolibri/.test-vent/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/run/media/jacob/LE/krakens/kolibri/.test-vent/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-1_g0pgbo/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-1_g0pgbo/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/tmp/pip-build-env-1_g0pgbo/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 512, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-1_g0pgbo/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 11, in <module>
        File "/tmp/pip-install-a8w9zjyz/nodeenv_3237549d30fc4587a082b6a9497ca5f8/nodeenv.py", line 24, in <module>
          import pipes
      ModuleNotFoundError: No module named 'pipes'

Updating the version for nodeenv in the dev reqs to 1.9.1 fixes the issue.

Note that I got that particular version number by doing pip install nodeenv in the 3.13 venv and seeing what it found.


Once I was able to install the dev requirements, Kolibri's dev server started up no problem

@rtibbles
Copy link
Member Author

Updated - noting that I just loosened the version for nodeenv, as the most recent version (in spite of maintaining 2.7 support) does not support 3.6.

Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Re-ran and smoke tested with success 👍

@rtibbles rtibbles merged commit ab776a1 into learningequality:develop Jul 24, 2025
51 checks passed
@rtibbles rtibbles deleted the build_back_compat_better branch July 24, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV: backend Python, databases, networking, filesystem... DEV: tools Internal tooling for development SIZE: small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependency on pkg_resources means build doesn't work on python 3.13

2 participants