labscript-suite / labscript-utils

Shared modules used by the 𝘭𝘒𝘣𝘴𝘀𝘳π˜ͺ𝘱𝘡 𝘴𝘢π˜ͺ𝘡𝘦. Includes a graphical exception handler, debug tools, configuration management, cross platform filepath conversions, unit conversions and custom GUI widgets.
http://labscriptsuite.org
Other
2 stars 45 forks source link

Include labscript-suite.pth in editable wheels #91

Closed chrisjbillington closed 1 year ago

chrisjbillington commented 1 year ago

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.

Fixes #90

chrisjbillington commented 1 year ago

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: labscriptsuite@googlegroups.com
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 labscript-suite.pth in the list of files in the package after installation of the wheel.

chrisjbillington commented 1 year ago

desktop-app only relies on flat layouts in the sense that, the changes I made the other day to make it work with editable wheels only implemented the way setuptools does editable wheels for flat layouts. Other than that there's no reliance on flat layouts that I'm aware of. I'll make it work with both when I'm feeling enthusiastic! Gotta fix desktop-app's build on GitHub actions anyway.

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.