File | Date | Author | Commit |
---|---|---|---|
pydeal | 2022-12-04 |
![]() |
[60c5ec] Apparently for some reason default kernel is no... |
.hgignore | 2021-03-05 |
![]() |
[613cd4] Add hgignore |
.hgtags | 2022-12-04 |
![]() |
[f8c5b3] Added tag 0.2.3 for changeset 60c5ec657885 |
LICENSE.txt | 2020-09-16 |
![]() |
[9574a0] Add license (MIT License) |
MANIFEST.in | 2020-09-19 |
![]() |
[2a795d] Fiddling around to get packaging working (add s... |
README.md | 2021-05-02 |
![]() |
[cf3f72] Fix thinko in readme |
formatting_guidelines.md | 2022-07-07 |
![]() |
[9bb85a] Fix some typos in formatting guidelines |
run_pydeal.py | 2022-09-04 |
![]() |
[3ae876] Fix version number |
setup.py | 2022-12-04 |
![]() |
[44a6cd] Bump version number |
Pydeal is an MIT-licensed GUI shell for Python (or, more precisely, for an IPython kernel). It is inspired by DreamPie, which has been a great tool for many years but which is not compatible with Python 3. Pydeal was created to bring DreamPie's combination of features to the world of Python 3. The name "Pydeal" is a play on the word "ideal"; an ideal is like a dream towards which we aim, so as DreamPie is a dream, Pydeal is an ideal.
The goals of Pydeal are, in rough order of priority.
Pydeal currently works but some features may have a bit of roughness around the edges. Like any ideal, in practical reality it can only be approximated but never truly achieved.
Right now Pydeal is only installable from the author's own conda channel. It can be installed into a conda environment with:
conda install -c brenbarn -c conda-forge pydeal
Once you have installed it and activated the environment where it is, you should be able to run it with simply pydeal
.
You can try using pydeal without installing it via conda (e.g., by installing its dependencies manually or via some other package manager) but right now conda is the only supported install mechanism. Nonetheless, if you have any useful reports on what did or didn't work please share them.
Pydeal requires Python 3 or higher. Its direct dependencies are:
Note that QScintilla2 is available via conda-forge
but not from the Anaconda defaults
channel. Thus you must add conda-forge
as a channel to your conda environment in order to use Pydeal.
The central feature of Pydeal is a two-pane interface. In the Input Pane you type a chunk of Python code. You can run your code with Ctrl+Enter or by hitting the Execute button; you will see the code displayed in the Log Pane. While your code is running, the Execute button is grayed out to indicate that Python is busy (although this will be very brief for simple code snippets). When your code is finished running, its output will be displayed in the Log Pane along with the code itself. You can get a lot done with just this basic functionality, but Pydeal also provides various other handy gadgets, described below.
Hit F9 (or look under the Tools menu) to open the Settings dialog, where you can tweak various aspects of Pydeal's behavior. Most of the settings are fairly self-explanatory.
You can save the history of your session inputs and outputs using CTRL+S or the option from the History menu, and reload a saved session later using CTRL+O or the corresponding menu option. Note that loading a session does not run the code in the saved session. It only loads the saved code and output into the history. If you want to re-run the code you'll have to do it yourself (perhaps using the "copy code to editor" functionality described below). Saving sessions in this way is meant as a way to preserve your "scratch work" rather than as a mechanism for producing a "clean" output file.
The sessions are saved in Jupyter notebook format, so you should also be able to read them with Jupyter. However, Pydeal uses only a subset of the Jupyter format (basically, only the code and plain-text output), so loading notebooks created with Jupyter may not work or may not do what you expect. Similarly, beware of loading an externally-created notebook file and then saving it; Pydeal may throw away any data it doesn't recognize. In short, saving in Jupyter format allows some useful interoperability but only in one direction: reading Pydeal-saved files in Jupyter is a supported use case, but the reverse is not guaranteed, nor is any sort of back-and-forth or round-tripping of notebook files between Pydeal and other software.
Press TAB in the editor window to display possible completions at your cursor position. Pydeal uses the underlying IPython completion abilities, which generally allow completing global names, attributes, dictionary keys, etc. Note that the first time you use autocomplete there may be a noticeable delay as the autocompletion "warms up"; subsequent completions should be faster.
It can be annoying when executing a code chunk generates a huge burst of output, scrolling the screen far away from the code. Pydeal automatically folds long output chunks; the threshold at which it folds is configurable in the Settings dialog. Hit the "Unfold" button to unfold a long chunk to view the output it all its glory. You can right-click an output chunk and chosoe "Fold" from the context menu to manually fold any chunk of output.
In the editor window or a code chunk in the log, hit CTRL+H to display the documentation for whatever is under your cursor. Documentation will be displayed in a separate panel; you can hit Hit CTRL+SHIFT+H to close this panel. Likewise, hit CTRL+G to display the source code of whatever is under the cursor (if available) and CTRL+SHIFT+G to close the source code panel.
Hit CTRL+Up/Down to navigate through past code chunks you've entered.
You can hit CTRL+N to toggle display of a small number in each cell. The number can be useful because it corresponds to a secret variable (created by the Jupyter kernel) that holds the result of each interactive computation; the variable is an underscore followed by the cell number. For instance, if in a cell you type 2+2
, the result 4
will be displayed. Suppose the cell number is 8. Then there will a variable _8
that holds the value 4
. So you can use the cell numbers to see what number to use to retrieve the results of previous calculations.
If you move your cursor to a code chunk in the log, you can hit Enter to copy that code to the editor.
In the editor, hit CTRL+T to open a new tab. You can have as many editor tabs as you want. This is handy if you are writing a bit of code, but need to pause and try out something else before continuing; you can create a new tab for your "sidetrack" and return to the original tab when done. Hit CTRL+W to close a tab.
Hit CTRL+F to open the Search Pane. You can enter a search query and hit Find Up (or CTRL+F) or Find Down (CTRL+SHIFT+F) to search up and down in the Log Pane. Checkboxes in the Search Pane allow you to use regular expression and/or case-sensitive searches. (The search feature is still a bit rough and may have some glitches.)
The Editor Pane is the central widget of Pydeal. The other panels (documentation, source, search) can be opened, closed, or dragged and dropped into different layouts to suit your preference. The Log Panel can also be moved around, but can't be closed, since Pydeal isn't very useful without it. When you close Pydeal, it will remember your layout for next time.
If your code is stuck while executing, you can hit CTRL+Q to interrupt it (although whether this will work depends on what code is running).
If you want to clear your session, you can hit CTRL+F6 to restart the kernel. Note that this will clear all variables, imported modules, etc.
Unlike DreamPie, Pydeal relies on the Jupyter kernel system to communicate with a Python process. This means that you can use Pydeal to run a version of Python different from the one Pydeal is itself is running on. For instance, you can run Pydeal with Python 3.7, but use a Python 3.5 kernel so that the code chunks you execute run on Python 3.5.
To choose a different kernel, use the Change Kernel command in the Kernel menu. You will see choices for any installed Jupyter kernels. These are the same kernels that used by the Jupyter Notebook, so kernels you have set up for the notebook should be visible here.
In addition, if in the Settings dialog you tell Pydeal the path to your conda
executable, it will try to find any existing conda environments and create "fake" kernels for them. This lets you run code within any conda environment without having to manually "install" its Jupyter kernel in Jupyter's kernel registry. However, the kernel must still exist in the sense that ipykernel
must be installed in the target environment. (Environments where ipykernel
isn't installed will not be shown in the list of available "fake" kernels.)
(Note that using conda environments as kernels is not guaranteed to work in all cases due to limitations of conda and jupyter. Experience indicates it will usually work, but can fail in some situations if you're using libraries that depend on external non-Python libraries, such as GDAL, Qt, etc.)
You can change back and forth between different kernels at will, but each time you do so you will be making a fresh start with a new kernel. This means changing the kernel is like restarting the kernel, and will clear any variables, imported modules, etc. You can only run one kernel at a time within a single Pydeal session.