-
Notifications
You must be signed in to change notification settings - Fork 54
Include labscript-suite.pth in editable wheels #91
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
Conversation
This ensures user directories are added to the Python import path in editable installs that are performed via the new PEP660 mechanism used by default in newer versions of pip and setuptools. The existing custom `develop` command is retained for compatibility with older setuptools and pip, which use `python setup.py develop` to create editable installs. It can be removed once it is safe to assume PEP660 functionality is available and default on all supported pip and setuptools versions sometime in the future.
Testing appreciated, here's how it looks for me: (.venv) [bilbo:labscript]$ pip install --no-build-isolation --no-deps -e labscript-utils
Obtaining file:///home/bilbo/venvs/labscript/labscript-utils
Checking if build backend supports build_editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: labscript-utils
Building editable for labscript-utils (pyproject.toml) ... done
Created wheel for labscript-utils: filename=labscript_utils-3.2.0.dev49+g4fff9ad-0.editable-py3-none-any.whl size=5041 sha256=376f5289ce73f486671a3a205f9a99fdd1d41f0fc3742622b13ef46705c5bc7f
Stored in directory: /tmp/pip-ephem-wheel-cache-2c7wkd3q/wheels/e4/a4/47/eab5f0b28ef97c422b8019d3e00f1b287143ce4449e1b9619e
Successfully built labscript-utils
Installing collected packages: labscript-utils
Successfully installed labscript-utils-3.2.0.dev49+g4fff9ad (.venv) [bilbo:labscript]$ pip show -f labscript-utils
Name: labscript-utils
Version: 3.2.0.dev49+g4fff9ad
Summary: Shared utilities for the labscript suite
Home-page: http://labscriptsuite.org
Author: The labscript suite community
Author-email: [email protected]
License: BSD
Location: /home/bilbo/venvs/labscript/.venv/lib/python3.10/site-packages
Requires: h5py, importlib-metadata, numpy, packaging, pyqtgraph, qtutils, scipy, setuptools-scm, zprocess
Required-by: blacs, labscript, labscript-devices, labscript-suite, lyse, runmanager, runviewer
Files:
../../../bin/labscript-profile-create
__editable__.labscript_utils-3.2.0.dev49+g4fff9ad.pth
__editable___labscript_utils_3_2_0_dev49_g4fff9ad_finder.py
__pycache__/__editable___labscript_utils_3_2_0_dev49_g4fff9ad_finder.cpython-310.pyc
labscript-suite.pth
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/INSTALLER
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/LICENSE.txt
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/METADATA
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/RECORD
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/REQUESTED
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/WHEEL
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/direct_url.json
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/entry_points.txt
labscript_utils-3.2.0.dev49+g4fff9ad.dist-info/top_level.txt Crucially, including |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is both simple and elegant. Thanks for sorting this out. The python build system is a real labyrinth. I've tested with python=3.9.15, setuptools=65.5.0 as well as python=3.8.11, setuptools=58.0.4 and everything seems to be in order.
As for deprecation nonsense, I did not realize desktop-app relied on a flat installs. Agreed generalizing is not that high of a priority. Specifying packages by hand would work, but is tedious. A more general method that appears to work and doesn't modify any structure is
--- a/setup.cfg
+++ b/setup.cfg
@@ -23,7 +23,7 @@ classifiers =
[options]
zip_safe = False
include_package_data = True
-packages = labscript_utils, labscript_profile
+packages = find_namespace:
python_requires = >=3.6
install_requires =
importlib_metadata>=1.0
@@ -36,6 +36,9 @@ install_requires =
setuptools_scm>=4.1.0
zprocess>=2.18.0
+[options.packages.find]
+include = labscript_*
+
[options.extras_require]
docs =
PyQt5
I'll leave it to you to include or not, but this is definitely ready to merge.
Thanks for testing! Just realised I should make the overridden method return the wheel filename, since the base method does, and then I'll merge. |
Matching the behaviour of the base method, although nothing seems to be relying on it.
Include labscript-suite.pth in editable wheels
This ensures user directories are added to the Python import path in editable installs that are performed via the new PEP660 mechanism used by default in newer versions of pip and setuptools.
The existing custom
develop
command is retained for compatibility with older setuptools and pip, which usepython setup.py develop
to create editable installs. It can be removed once it is safe to assume PEP660 functionality is available and default on all supported pip and setuptools versions sometime in the future.Fixes #90