Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions mu/wheels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import subprocess
import tempfile
import zipfile
import pkg_resources

from .. import __version__ as mu_version

Expand Down Expand Up @@ -40,9 +41,6 @@ class WheelsBuildError(WheelsError):
("pgzero", ("pgzero>=1.2.1",)),
# Lock Werkzeug to < 3.0.0: import flask fails, otherwise.
("flask", ("flask==2.0.3", "Werkzeug<3.0.0")),
# The version of ipykernel here should match to the version used by
# qtconsole at the version specified in setup.py
("ipykernel", ("ipykernel>=5.5.6",)),
]


Expand Down Expand Up @@ -90,7 +88,33 @@ def remove_dist_files(dirpath, logger):
os.remove(rm_filepath)


def get_mu_package_version(package_name):
"""Get the version of a package in Python environment running Mu."""
try:
version = pkg_resources.get_distribution(package_name).version
return version
except pkg_resources.DistributionNotFound:
logger.error(
"Package {} not found in Mu environment".format(package_name)
)
raise


def pip_download(dirpath, logger, additional_flags=[]):
"""Download wheels for the packages to be installed in the user venv."""
# ipykernel needs to be added to the user venv to launch the iPython REPL
# from within that environment.
# The ipykernel version must match the version installed in the Mu
# environment or the user venv kernel might fail (Kernel died, restarting).
ipykernel_version = get_mu_package_version("ipykernel")
logger.info("Detecting Mu ipykernel version: {}".format(ipykernel_version))
mode_packages.append(
(
"ipykernel",
("ipykernel=={}".format(ipykernel_version),),
)
)

for name, pip_identifiers, *extra_flags in mode_packages:
logger.info(
"Running pip download for %s / %s / %s / %s",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
"PyQtChart==5.15.6"
+ '; sys_platform != "linux" '
+ 'or ("arm" not in platform_machine and "aarch" not in platform_machine)',
# FIXME: Needed for qtconsole, this is the latest wheel in armv7l for
# Needed for qtconsole, this is the latest wheel in armv7l for
# Python 3.7 (Buster), otherwise it tries to build from source and fails.
"pyzmq<=26.0.3",
# We are using an internal method of jupyter_client, that changed in v7
# We are using an internal method of jupyter_client that changed in v7
# QtKernelManager._launch_kernel() returning a KernelProvisionerBase
# https://github.com/jupyter/jupyter_client/commit/516d9df270b2e4603ee0ecd986554cb5fe1c2940
"jupyter-client<7",
Expand Down
Loading