From 4b6ba085816db5e69e83b7be24c05408359c2707 Mon Sep 17 00:00:00 2001 From: tgwoodcock Date: Thu, 15 Sep 2022 16:43:41 +0200 Subject: [PATCH] Updated README, pyproject.toml, version 0.0.4dev Updated the README.md, pyproject.toml and src/hdf5view/__init__,py for the new version 0.0.4dev, which is now hosted on PyPI. --- README.md | 124 +++++++++++++++++++++++++++++---------- pyproject.toml | 12 ++-- src/hdf5view/__init__.py | 2 +- 3 files changed, 103 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 8b4a0e9..760f05e 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,91 @@ -# HDF5View +# hdf5view Simple Qt/Python based viewer for HDF5 files. Displays a file tree, data tables and attributes and can render greyscale images of any nodes which have two or more dimensions. Everything is loaded dynamically, so hopefully it should be able to handle HDF5 files of any size and structure. -## Installing +## 1. Installing -On linux (Ubuntu/Debian) I generally prefer installing the system packages of PyQt5 and/or PySide2 - in that case don't bother with uncommenting stuff in install_requires in setup.py: +#### Qt API Bindings + +One of [pyqt5](https://www.riverbankcomputing.com/software/pyqt/), [pyside2](https://pyside.org), [pyqt6](https://www.riverbankcomputing.com/software/pyqt/) or [pyside6](https://pyside.org) is required in order to be able to run hdf5view. Please install one of these e.g. with pip: ``` -sudo apt install python3-pyqt5 python3-h5py python3-pyqtgraph python3-qtpy +pip install pyqt5 ``` -To install system wide, download or clone the repo. Uncomment the preferred Qt bindings in setup.py (or install system packages...see below): +or on linux (Ubuntu/Debian), you can install a system package: ``` -cd hdf5view -sudo pip3 install . +sudo apt install python3-pyqt5 ``` -To uninstall: +[qtpy](https://github.com/spyder-ide/qtpy) is used as an abstraction layer for pyqt5/pyside2/pyqt6/pyside6. If you have any of these Qt API bindings installed, qtpy will take the first available one in the order shown in the previous sentence. hdf5view works with all of the bindings. If you have more than one of the bindings installed and want to specify which one should be used for hdf5view, you can do this by setting the `QT_API` environment variable before running hdf5view. + +For example: if you have pyqt5 and pyside2 installed and you want hdf5view to use PySide2, on Windows PowerShell: ``` -sudo pip3 uninstall hdf5view +$env:QT_API = 'pyside2' ``` -## Running +or on linux (Ubuntu/Debian) ``` -hdf5view +export QT_API=pyside2 ``` -or +before running HDF5View + + +#### Other Dependencies + +The other dependencies are [qtpy](https://github.com/spyder-ide/qtpy), [h5py](https://www.h5py.org/) and [pyqtgraph](https://www.pyqtgraph.org/). Currently installed versions of these dependencies will not be overwritten by installing hdf5view. If these are not already present on your system, they will be installed during the installation of hdf5view. + +If you prefer to install them in advance, you can use pip: ``` -hdf5view -f +pip install h5py, qtpy, pyqtgraph ``` -HDF5 files can also be dropped onto the application window once opened. +or on linux to install system packages: + +``` +sudo apt install python3-h5py python3-pyqtgraph python3-qtpy +``` + +Note: [pyqtgraph](https://www.pyqtgraph.org/) 0.12 supports all of pyqt5, pyside2, pyqt6 or pyside6. Older versions of pyqtgraph may not support all of them. + + +#### hdf5view + +To install the current release from PyPI system-wide on Windows: + +``` +pip install hdf5view +``` + +or on linux: + +``` +sudo pip3 install hdf5view +``` + +To install the current development version, download or clone the repo and install either system-wide on Windows: + +``` +cd hdf5view +pip install . +``` + +or on linux: -## Development +``` +cd hdf5view +sudo pip3 install . +``` -To setup a development environment use virtualenv: +You could also use the flag -e with the pip command to install in editable mode, then you can pull changes from the repo and they are automatically available on your system. + +To setup an isolated development environment using virtualenv: ``` python3 -m virtualenv -p python3 . @@ -48,33 +93,52 @@ source bin/activate pip install -e . ``` -## Choosing Qt API bindings +To uninstall hdf5view: -`qtpy` is used as an abstraction layer for PyQt5/PySide2. Currently, the default is to use PyQt5. This is because the version of pyqtgraph (0.10.0) I have wouldn't work with PySide2. +``` +pip uninstall hdf5view +``` -Environment variables are used to set the Qt API. PyQt5 is used by default unless you set the `QT_API` environment variable. To switch to using PySide2: +or: ``` -export QT_API=pyside2 -export PYQTGRAPH_QT_LIB=PySide2 +sudo pip3 uninstall hdf5view ``` -## Building resources - -Resources for the project are compiled using a resource compiler. You will need the pyqt5-dev-tools or pyside2-tools installed to recompile resources. +## 2. Running -Depending on the bindings choice (PyQt5 or PySide2) the resources can be built with the following command: +From the terminal: ``` -# PyQt5 -pyrcc5 hdf5view/resources/resources.qrc -o hdf5view/resources/resources.py +hdf5view +``` + +or -# PySide2 -pyside2-rcc hdf5view/resources/resources.qrc -o hdf5view/resources/resources.py ``` +hdf5view -f +``` + +HDF5 files can also be dropped onto the application window once opened. + +You can also create a desktop link to start the program for convenience. A Windows icon file hdf5view.ico is provided in the folder hdf5view/resources/images. + +## 3. Usage + +The structure of the HDF5 file can be navigated using the tree view on the left hand side. The central panel displays a table of the data at the node selected. If the node has more than two dimensions, a 2D slice of the data is displayed in the table. On the right hand side you can see and modify the slice shown; and see details of the node and any associated attributes. + +To display a greyscale image of the data at a particular node, click the image icon on the toolbar at the top of the window. This will open an Image tab at the current node. The image is initially take from the last two dimensions of the node. A scrollbar is provided, which currently can be used to scroll through the first dimension of the node. You can alternatively change the slice manually and the scrollbar will move accordingly. You can have several image tabs open at once. Image tabs remember the node and slice if you switch to a different tab and back. Switching to a different node results in the default behaviour that the image shown is the last two dimensions of the first index of the first dimension. + +## 4. Testing + +Currently there are no unit tests for this package. The gui has been tested with qtpy=2.2.0, pyqtgraph=0.12.4 and h5py=3.7.0 in combination with pyqt5=5.15.7, pyside2=5.15.2.1, pyqt6=6.3.1 and pyside6=6.3.2, and it works with all of the Qt API bindings. + +## 5. Issues + +If there are any issues, please feel free to use the [issues mechanism on github](https://github.com/marts/hdf5view/issues) to get in touch. ## TODO: * Add xy plots in pyqtgraph +* Add a more complex slice view/delegate * Add some 3D stuff -* Build a deb package diff --git a/pyproject.toml b/pyproject.toml index f68a54c..ce79870 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ authors = [ ] maintainers = [{name = "Thomas G. Woodcock"},] license = {file = "LICENSE"} + classifiers=[ 'Programming Language :: Python', 'Programming Language :: Python :: 3', @@ -18,7 +19,7 @@ classifiers=[ 'Environment :: X11 Applications :: Qt', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Science/Research', - 'License :: MIT', + 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Topic :: Software Development', @@ -28,10 +29,14 @@ keywords = ["research", "data", "management", "visualization", "hdf5", "viewer"] requires-python = ">=3.6" dependencies = [ "h5py", - "QtPy", + "qtpy", "pyqtgraph" ] -dynamic = ["version", "readme"] +dynamic = ["version"] + +[project.readme] +'file' = "README.md" +'content-type' = "text/markdown" [project.urls] 'Source' = 'https://github.com/marts/hdf5view/' @@ -42,7 +47,6 @@ hdf5view = "hdf5view.main:main" [tool.setuptools.dynamic] version = {attr = "hdf5view.__version__"} -readme = {file = ["README.md"]} [tool.setuptools.packages.find] where = ["src"] diff --git a/src/hdf5view/__init__.py b/src/hdf5view/__init__.py index 34d181c..ff3981c 100644 --- a/src/hdf5view/__init__.py +++ b/src/hdf5view/__init__.py @@ -1 +1 @@ -__version__ = '0.0.3dev0' +__version__ = '0.0.4dev0'