From 847a7c4f21de4cd22017dda4bc6e665e322a8c77 Mon Sep 17 00:00:00 2001 From: Menno Smits Date: Tue, 8 Nov 2011 22:13:56 +0000 Subject: [PATCH] doc updates to cover interact and livetest changes --- NEWS | 4 ++++ README | 12 +++++++++++ doc/src/index.rst | 51 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7af7774..ba0d20d 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,10 @@ Renaming of folders was an obvious omission! Minor Features -------------- * interact.py can now read livetest.py INI files (#66) +* interact.py can now embed shells from ipython 0.10 and 0.11 (#98) +* interact.py and livetest.py are now inside the imapclient package so + they can be used even when IMAClient has been installed from PyPI + (#82) * Added "debug" propety and setting of a log file (#90) * "normalise_times" attribute allows caller to select whether datetimes returned by fetch() are native or not (#96) (Thanks Andrew diff --git a/README b/README index 5f922c2..3673f6e 100644 --- a/README +++ b/README @@ -110,6 +110,12 @@ steps required to set up an IMAPClient instance. The IPython shell is used if it is installed. Otherwise the code.interact() function from the standard library is used. +The interact functionality can also be accessed like this: + + python -m imapclient.interact ... + +This works when IMAPClient has been installed from PyPI. + livetest.py ----------- @@ -131,6 +137,12 @@ to run successfully against a particular IMAP server. Reports of successful runs are also welcome. Please include the type and version of the IMAP server. +The livetest functionality can also be accessed like this: + + python -m imapclient.livetest ... + +This works when IMAPClient has been installed from PyPI. + Unit Tests ---------- diff --git a/doc/src/index.rst b/doc/src/index.rst index 7054e2c..b893dcb 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -152,4 +152,53 @@ IMAPClient instance. .. autoclass:: imapclient.IMAPClient :members: - +Interactive Sessions +-------------------- +When developing program using IMAPClient is it sometimes useful to +have an interactive shell to play with. IMAPClient ships with a module +that lets you fire up an interactive shell with an IMAPClient instance +connected to an IMAP server. + +Start a session like this:: + + python -m imapclient.interact -H -u ... + +Various options are available to specify the IMAP server details. See +the help (--help) for more details. You'll be prompted for a username +and password if one isn't provided on the command line. + +If installed, IPython will be used as the embedded shell. Otherwise +the basic built-in Python shell will be used. + +Here's an example session:: + + $ python -m imapclient.interact -H -u ... + Connecting... + Connected. + + IMAPClient instance is "c" + In [1]: c.select_folder('inbox') + Out[1]: + {'EXISTS': 2, + 'FLAGS': ('\\Answered', + '\\Flagged', + '\\Deleted', + '\\Seen', + '\\Draft'), + 'PERMANENTFLAGS': ('\\Answered', + '\\Flagged', + '\\Deleted', + '\\Seen', + '\\Draft'), + 'READ-WRITE': True, + 'RECENT': 0, + 'UIDNEXT': 1339, + 'UIDVALIDITY': 1239278212} + + In [2]: c.search() + Out[2]: [1123, 1233] + + In [3]: c.logout() + Out[3]: 'Logging out' + +Note that the connected IMAPClient instance is available as the variable "c". -- 2.43.0