Skip to content

Commit 46f7009

Browse files
Update Documentation for Pyface 8.0 release (#1238)
This PR includes general small improvements to the documentation, docstings and examples to improve the generated documentation for the website.
1 parent 0328089 commit 46f7009

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+583
-209
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This workflow targets stable released dependencies from EDM.
2+
# Note that some packages may not actually be installed from EDM but from
3+
# PyPI, see etstool.py implementations.
4+
5+
name: Build docs with EDM
6+
7+
on: [pull_request, workflow_dispatch]
8+
9+
env:
10+
INSTALL_EDM_VERSION: 3.5.0
11+
QT_MAC_WANTS_LAYER: 1
12+
13+
jobs:
14+
15+
# Build docs using EDM packages
16+
docs-with-edm:
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest]
20+
toolkit: ['pyside6']
21+
fail-fast: false
22+
timeout-minutes: 20 # should be plenty, it's usually < 5
23+
runs-on: ${{ matrix.os }}
24+
env:
25+
# Set root directory, mainly for Windows, so that the EDM Python
26+
# environment lives in the same drive as the cloned source. Otherwise
27+
# 'pip install' raises an error while trying to compute
28+
# relative path between the site-packages and the source directory.
29+
EDM_ROOT_DIRECTORY: ${{ github.workspace }}/.edm
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Install Qt dependencies
33+
uses: ./.github/actions/install-qt-support
34+
if: matrix.toolkit != 'wx'
35+
- name: Cache EDM packages
36+
uses: actions/cache@v3
37+
with:
38+
path: ~/.cache
39+
key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ hashFiles('etstool.py') }}
40+
- name: Setup EDM
41+
uses: enthought/setup-edm-action@v2
42+
with:
43+
edm-version: ${{ env.INSTALL_EDM_VERSION }}
44+
- name: Install click to the default EDM environment
45+
run: edm install -y wheel click coverage
46+
- name: Install test environment
47+
run: edm run -- python etstool.py install --toolkit=${{ matrix.toolkit }}
48+
- name: Build docs
49+
run: xvfb-run -a edm run -- python etstool.py docs --toolkit=${{ matrix.toolkit }}
50+
- name: Archive HTML docs
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: html-doc-bundle
54+
path: docs/build/html
55+
# don't need these kept for long
56+
retention-days: 7

.github/workflows/test-with-edm.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
test-with-edm:
1717
strategy:
1818
matrix:
19+
# Note: MacOS support is contingent on not hitting any issues with
20+
# unsupported CPU features such as AVX2 and so may be unstable.
1921
os: [ubuntu-latest, macos-latest, windows-latest]
2022
toolkit: ['pyside6']
2123
fail-fast: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
build/
1212
dist/
1313
docs/build/
14+
docs/source/api
1415

1516
# Auto-generated by setup.py
1617
pyface/_version.py

CHANGES.txt

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,154 @@
22
Pyface Changelog
33
================
44

5+
Release 8.0.0
6+
=============
7+
8+
Highlights of this release
9+
--------------------------
10+
11+
This is a major release which removes a number of things which have been
12+
deprecated for a number of years. The most significant change in this release
13+
is that the Qt toolkit backend has been moved from the ``pyface.ui.qt4``
14+
package to the ``pyface.ui.qt`` package. The "qt4" namespace had been an
15+
ongoing source of confusion as Qt5 and Qt6 became the most popular versions of
16+
Qt in use. Because this change has the potential to cause significant backwards
17+
compatibility issues, this release includes import hooks to continue to support
18+
imports from ``pyface.ui.qt4...`` which can be enabled by:
19+
20+
- using "qt4" for the `ETS_TOOLKIT` or `ETSConfig.toolkit` values.
21+
- setting the `ETS_QT4_IMPORT` environment variable to a non-empty value
22+
- explicitly adding the import hooks to `sys.meta_path`
23+
24+
In particular the environment variables allow users of ETS-based applications
25+
such as Mayavi to continue to use those applications with newer versions of
26+
Pyface until there is time to update their code to the new import locations.
27+
28+
Additionally this release uses the module-level ``__getattr__`` system
29+
introduced in Python 3.7 to delay imports from the ``api`` modules which have
30+
side-effects, particularly toolkit selection. This means that you can, for
31+
example, import ``pyface.api`` and toolkit selection will be deferred until
32+
you actually request a class or object which is toolkit-dependent. Part of
33+
this included adding formal interfaces for ``ActionManager`` and its subclasses
34+
35+
In addition this release:
36+
37+
- adds support for Python 3.11 and drops support for Python 3.6
38+
- adds support for PySide 6.4+ and the new enum system
39+
- removes code supporting PyQt4, and supports more modern imports from
40+
`pyface.qt`, such as `pyface.qt.QtWidgets`.
41+
- removes many things flagged as deprecated in Pyface 7
42+
- consistently add interface classes to ``api`` modules.
43+
- adds new Field subclasses, including an ImageField and LabelField
44+
- moves to a pyproject.toml-based packaging solution, removing setup.py
45+
46+
Detailed changes
47+
----------------
48+
49+
Thanks to:
50+
51+
* Mark Dickinson
52+
* Dominik Gresch
53+
* JaRoSchm
54+
* Rahul Poruri
55+
* Corran Webster
56+
57+
Features
58+
59+
* Refactor IField and add IImageField and ILabelField Field classes (#1234)
60+
* Move ``pyface.ui.qt4`` to ``pyface.ui.qt`` (#1223, #1228)
61+
* Delayed imports with side-effects in ``api`` modules; new interfaces for
62+
``ActionManager`` and its subclasses (#1229)
63+
64+
Enhancements
65+
66+
* Better handling of sizes for multiple (or no) screens (#1237)
67+
* More arguments for the ``confirm`` function (#1221)
68+
* Expose interfaces in ``api`` modules and other improvemnts to ``api`` modules
69+
(#1220, #1222, #1229)
70+
* remove deprecated modules and code (#1209, #1215)
71+
* PySide 6.5 support (#1238)
72+
* Python 3.11 and PySide 6.4 support (#1210)
73+
74+
Fixes
75+
76+
* Always use a no-delay timer for ``GUI`` ``invoke_later`` and
77+
``set_trait_later`` on Qt (#1226)
78+
* Work arounds for some end-of-process segfaults on PySide < 6.4.3 (#1214)
79+
* Use ``exec`` instead of ``exec_`` where possible (#1208)
80+
* Emit a warning rather than asserting in SplitTabWidget (#1192)
81+
* Remove required parent argument in Wx StatusBarManager (#1192)
82+
* Use integer division in DockSplitter.draw (#1190)
83+
84+
Documentation
85+
86+
* general updates and enhancements (#1238)
87+
* update copyright dates (#1191)
88+
89+
CI
90+
91+
* remove ``setup.py`` and use ``pyproject.toml`` (#1203, #1214)
92+
93+
Release 7.4.4
94+
=============
95+
96+
Highlights of this release
97+
--------------------------
98+
99+
This is a quick bugfix release that resolves some issues with the 7.4.3 release
100+
on CI for downstream projects. The issues were on testing code, and so
101+
shouldn't impact application code or behaviour.
102+
103+
Detailed changes
104+
----------------
105+
106+
Thanks to:
107+
108+
* Corran Webster
109+
110+
Fixes
111+
112+
* Don't raise ConditionTimeoutError if test doesn't time out (#1182)
113+
114+
CI
115+
116+
* get CI working again with ubuntu-current on GitHub (#1186)
117+
118+
Release 7.4.3
119+
=============
120+
121+
Highlights of this release
122+
--------------------------
123+
124+
This is a bugfix release that collects a number of additional issues discovered
125+
and fixed since the 7.4.2 release. Among the fixes, this pins PySide6 to less than
126+
6.4.0, as 6.4 has breaking changes in it.
127+
128+
Detailed changes
129+
----------------
130+
131+
Thanks to:
132+
133+
* Alex Chabot-Leclerc
134+
* Mark Dickinson
135+
* Eric Larson
136+
* Steven Kern
137+
* Corran Webster
138+
139+
Fixes
140+
141+
* Fix code editor gutter widget on recent Python versions (#1176)
142+
* fix issues with FileDialog and DirectoryDialog close method on Linux (#1175)
143+
* update setup.py metadata (#1173)
144+
* restrict to PySide versions before 6.4.0 (#1169)
145+
* don't do unneccessary evaluations of conditions in EventLoopHelper (#1168)
146+
* fix a deleted object error in PyQt5 (#1161)
147+
* better reporting of toolkit errors (#1157)
148+
149+
Documentation
150+
151+
* fix some Python 2 style print statements in documentation (#1157)
152+
5153
Release 7.4.2
6154
=============
7155

README.rst

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,92 @@ Pyface: Traits-capable Windowing Framework
33
==========================================
44

55
The Pyface project contains a toolkit-independent GUI abstraction layer,
6-
which is used to support the "visualization" features of the Traits package.
7-
Thus, you can write code in terms of the Traits API (views, items, editors,
8-
etc.), and let Pyface and your selected toolkit and back-end take care of
9-
the details of displaying them.
6+
which is used to support the "visualization" features of the Enthought Tool
7+
Suite libraries. Pyface contains Traits-aware wrappers of standard GUI
8+
elements such as Windows, Dialogs and Fields, together with the "Tasks"
9+
application framework which provides a rich GUI experience with dock panes,
10+
tabbed editors, and so forth. This permits you to write cross-platform
11+
interactive GUI code without needing to use the underlying GUI backend.
1012

1113
The following GUI backends are supported:
1214

1315
- PySide2 (stable) and PySide6 (experimental)
1416
- PyQt5 (stable) and PyQt6 (in development)
1517
- wxPython 4 (experimental)
1618

19+
Example
20+
-------
21+
22+
The following code creates a window with a simple Python shell:
23+
24+
.. code-block:: python
25+
26+
from pyface.api import ApplicationWindow, GUI, IPythonShell
27+
28+
class MainWindow(ApplicationWindow):
29+
""" The main application window. """
30+
31+
#: The PythonShell that forms the contents of the window
32+
shell = Instance(IPythonShell, allow_none=False)
33+
34+
def _create_contents(self, parent):
35+
""" Create the editor. """
36+
self.shell.create(parent)
37+
return self.shell.control
38+
39+
def destroy(self):
40+
self.shell.destroy()
41+
super().destroy()
42+
43+
def _shell_default(self):
44+
from pyface.api import PythonShell
45+
return PythonShell()
46+
47+
# Application entry point.
48+
if __name__ == "__main__":
49+
# Create the GUI.
50+
gui = GUI()
51+
52+
# Create and open the main window.
53+
window = MainWindow(title="Python Shell", size=(640, 480))
54+
window.open()
55+
56+
# Start the GUI event loop!
57+
gui.start_event_loop()
58+
59+
.. image:: https://raw.github.com/enthought/pyface/main/shell_window.png
60+
:alt: A Pyface GUI window containing a Python shell.
61+
1762
Installation
1863
------------
1964

20-
GUI backends are marked as optional dependencies of Pyface. Some features
21-
or infrastructures may also require additional dependencies.
65+
Pyface is a pure Python package. In most cases Pyface will be installable
66+
using a simple ``pip install`` command.
2267

23-
To install with PySide2 dependencies::
68+
To install with a backend, choose one of the following, as appropriate:
2469

25-
$ pip install pyface[pyside2]
70+
.. code-block:: console
2671
27-
To install with PySide6 dependencies (experimental)::
72+
$ pip install pyface[pyside2]
2873
2974
$ pip install pyface[pyside6]
3075
31-
To install with PyQt5 dependencies::
32-
3376
$ pip install pyface[pyqt5]
3477
35-
To install with wxPython4 dependencies (experimental)::
36-
3778
$ pip install pyface[wx]
3879
39-
``pillow`` is an optional dependency for the PILImage class::
80+
Some optional functionality uses ``pillow`` and ``numpy`` and these can be
81+
installed using optional dependencies:
82+
83+
.. code-block:: console
4084
4185
$ pip install pyface[pillow]
4286
43-
To install with additional test dependencies::
87+
$ pip install pyface[numpy]
88+
89+
For running tests a few more packages are required:
90+
91+
.. code-block:: console
4492
4593
$ pip install pyface[test]
4694
@@ -51,20 +99,6 @@ Documentation
5199

52100
* `API Documentation <http://docs.enthought.com/pyface/api/pyface.html>`_.
53101

54-
Prerequisites
55-
-------------
56-
57-
Pyface depends on:
58-
59-
* `Traits <https://github.com/enthought/traits>`_
60-
61-
* a GUI toolkit as described above
62-
63-
* Pygments for syntax highlighting in the Qt code editor widget.
64-
65-
* some widgets may have additional optional dependencies such as NumPy or
66-
Pillow.
67-
68102
.. end_of_long_description
69103
70104
Developing Pyface

docs/source/conf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
# All configuration values have a default value; values that are commented out
1212
# serve to show the default value.
1313

14-
import importlib.metadata
14+
try:
15+
from importlib.metadata import version as metadata_version
16+
except:
17+
from importlib_metadata import version as metadata_version
1518

1619
# General configuration
1720
# ---------------------
@@ -43,7 +46,7 @@
4346

4447
# The default replacements for |version| and |release|, also used in various
4548
# other places throughout the built documents.
46-
version = release = importlib.metadata.version("pyface")
49+
version = release = metadata_version("pyface")
4750

4851
# There are two options for replacing |today|: either, you set today to some
4952
# non-false value, then it is used:

0 commit comments

Comments
 (0)