Skip to content

adding support for pyqtgraph editable install#2892

Closed
spchamp wants to merge 5 commits intopyqtgraph:masterfrom
fxtatools:patch/editable
Closed

adding support for pyqtgraph editable install#2892
spchamp wants to merge 5 commits intopyqtgraph:masterfrom
fxtatools:patch/editable

Conversation

@spchamp
Copy link
Copy Markdown
Contributor

@spchamp spchamp commented Dec 2, 2023

This change adds build-system metadata to pyproject.toml and ensures the dir for setup.py is in sys.path.

The sys.path modification is to ensure the project ./tools/ modules can be imported in setup.py during editable install.

With this tweak to the project metadata, it should be possible to install pyqtgraph with an editable install, using setuptools

mkdir newproject; cd newproject
python3 -m venv --prompt newproject env
source env/bin/activate
pip install -e ../pyqtgraph/ --config-settings editable_mode=compat

Previous to this change, while it was possible to run pip install -e ../pyqtgraph but that might not have resulted in the modules actually being installed and available under the user environment.

Files that need updates

Confirm the following files have been either updated or there has been a determination that no update is needed.

  • [n/a] README.md
  • setup.py
  • [n/a ] tox.ini
  • [?] .github/workflows/main.yml and associated requirements.txt and conda environemt.yml files
  • pyproject.toml
  • [n/a] binder/requirements.txt

I don't think this would affect the workflow builds. Hoping it would test out though lol

This change adds build-system metadata to pyproject.toml and
ensures the dir for setup.py is in sys.path.

The sys.path modification is to ensure the project ./tools/
modules can be imported in setup.py during editable install.

With this tweak to the project metadata, it should be
possible to install pyqtgraph with an editable install,
using setuptools

```
mkdir newproject; cd newproject
python3 -m venv --prompt newproject env
source env/bin/activate
pip install -e ../pyqtgraph/ --config-settings editable_mode=compat
```
@spchamp
Copy link
Copy Markdown
Contributor Author

spchamp commented Dec 2, 2023

Did this change break the rtd build?

Noticed the following in the build log for Read the Docs:

PyQtGraph requires one of PyQt5, PyQt6, PySide2 or PySide6; none of these packages could be imported."

Of course PyQt6 is listed in doc/requirements.txt and it was installed under that step:

python -m pip install --exists-action=w --no-cache-dir -r doc/requirements.txt
[...]
Successfully installed PyQt6-6.6.0 [...]

Maybe this change produced some kind of a side effect for how the rtd build resolves the imports for the docs build?

I'll try to see if I can figure this out with a glance at doc/source/conf.py

After sending a push request for the previous change in this
patch branch, I noticed the following in the build log for Read the Docs:

> PyQtGraph requires one of PyQt5, PyQt6, PySide2 or PySide6; none of these packages could be imported.

Of course PyQt6 is listed in doc/requirements.txt and it was installed under that step:

> python -m pip install --exists-action=w --no-cache-dir -r doc/requirements.txt
> [...]
> Successfully installed PyQt6-6.6.0 [...]

Maybe this change produced some kind of a side effect for how the rtd
build resolves the imports for the docs build?

So here is a first guess, to try to unbreak it if the change
would break the docs build. Appending to sys.path instead of
adding the project root path to the front of sys.path
@spchamp
Copy link
Copy Markdown
Contributor Author

spchamp commented Dec 2, 2023

Huh. If this change is breaking the read the docs build, my second guess is that it's because of sys.path lol 🤷 will take a look at the build scripting

It installs completely, when not using the editable option -e <sourcedir>

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Dec 2, 2023 via email

@spchamp
Copy link
Copy Markdown
Contributor Author

spchamp commented Dec 2, 2023

thx! Apologies for the chatter, lol.

I think the RTD build is using Python 3.12. So, I've installed Python 3.12. I've tested the build with sphinx there, the docs built OK ... with pyside6 installed.

After uninstalling pyside6 in 3.12 and running the tests with just pyqt6 installed, saw the same error as with the rtd build:

E Exception: PyQtGraph requires one of PyQt5, PyQt6, PySide2 or PySide6; none of these packages could be imported.

So, good to know!

With the dependency `PyQt6==6.6.0` pip may install a
PyQt6-Qt6 version greater than the PyQt6 version, e.g
6.6.1.

This version mismatch may result in an errors after
loading the PyQt6 libraries, such as seen when running
the pyqtgraph tests with Python 3.12

> E   Exception: PyQtGraph requires one of PyQt5, PyQt6, PySide2 or PySide6; none of these packages could be imported.

After adding a dependency line to ensure a version parity for
the pyqt6 and pyqt6-qt6 installations with pip, then installing
with `pip -r doc/requirements.txt` the pyqtgraph tests and the docs
build should run successfully with PyQt6 in Python 3.12
@spchamp
Copy link
Copy Markdown
Contributor Author

spchamp commented Dec 2, 2023

added a patch for PyQt6 version parity in doc/requirements.txt

PyQt6==6.6.0
PyQt6-Qt6==6.6.0

fwiw the tests all run successfully under Python 3.12 and the docs build

updating pyqt6, pyqt6-qt6 version deps for the test-pip gh
workflow and in tox.ini

This may serve to address the error seen under the rtd docs
build, such that might also show up in the test-pip build:

> Exception: PyQtGraph requires one of PyQt5, PyQt6, PySide2 or PySide6; none of these packages could be imported.

Ensuring an exact version match for pyqt6 and pyqt6-qt6
depdencies in test-pip and in tox.ini
updating pyqt6, pyqt6-qt6 version deps for the test-pip gh
workflow for Python 3.11
@spchamp
Copy link
Copy Markdown
Contributor Author

spchamp commented Dec 2, 2023

fwiw I've folded a couple more patches into this pull request, to ensure version alignment for the pyqt6 parts in the CI builds

- python-version: "3.10"
qt-lib: "pyqt"
qt-version: "PyQt6~=6.2.0 PyQt6-Qt6~=6.2.0"
qt-version: "PyQt6==6.2.0 PyQt6-Qt6==6.2.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why this change, I'm fairly certain that ~= is what I want in this case, I want to get the latest patch version of PyQt6 6.2

@@ -1,4 +1,5 @@
PyQt6==6.6.0
PyQt6-Qt6==6.6.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got fixed in another PR already, go ahead and remove this 👍🏻

pyqt6_62: pyqt6~=6.2.0
pyqt6_62: PyQt6-Qt6~=6.2.0
pyqt6_62: pyqt6==6.2.0
pyqt6_62: PyQt6-Qt6==6.2.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again, why is there the == and not ~= here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This ensures that the same version is drawn in for both

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Dec 9, 2023

hi @spchamp

Thanks for the PR, I didn't realize that some modules might not be captured via editable installs in the current form. I have no problem merging the changes to pyproject.toml and setup.py, but I think the other changes for ~= to == are unrelated and undo the intentional behavior of installing the latest patch version of 6.2.

@j9ac9k j9ac9k mentioned this pull request Feb 14, 2024
@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Feb 14, 2024

Was superseded by #2935 I cherry picked the first two commits here, thanks for the PR @spchamp

@j9ac9k j9ac9k closed this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants