Commit graph

48 commits

Author SHA1 Message Date
dickmao
ed6482096e Add ob-ein tests
Also, speed up login and other cleanups
2019-02-19 10:06:15 -05:00
dickmao
428f0a1493 turn off --debug in jupyter 2019-01-22 08:15:36 -05:00
dickmao
f0984eab55 jupyterhub basic (PAM only)
`ein:login` or `ein:notebooklist-login` is the preferred way to access
jupyterhub, although `ein:jupyterhub-connect` is still autoloaded.
2018-12-04 18:31:44 -05:00
dickmao
6ca6752319 C-c C-q improved visual feedback
As `ein:notebok-kill-kernel-then-close-cmmand` must wait for the
server to delete the session, the buffer wouldn't disappear right
away, leaving the user nonplussed whether the `C-c C-q` took.  Display
a status message "Ending session" with a modest animation instead.

Also add a "Stop" test for notebooklist.  Sorry about breaking "Stop"
in ee3b0f0
2018-11-10 00:09:44 -05:00
dickmao
0490031ec8 Sane File Navigation
As emacs users we prefer and have the luxury of fuzzy file navigation
via ido and projectile.  From a notebook or notebooklist buffer, the commands

`C-c C-f` ein:file-open
`C-c C-o` ein:notebook-open

offer an ido alternative to point and click navigation.

To populate the ido lists, retrieving the content hierarchy is on by
default.  Two custom variables determine how wide and deep the content query
probes (currently at 2 levels deep and 6 directories wide).  Set both
to zero to turn off.

tkf half finished code to quickly go from local file buffers to notebook
mode via `C-c C-z` or `C-c C-o`.  This is now possible.  EIN will
start the server from a suitable parent directory of the visited file.

Enable ido completion for `notebooklist-login`.

Remove the albatross `ein-loaddefs.el` in favor of more standard
`ein-autoloads.el` that is not git tracked.

Convenience `make install` from git source (local alternative to
melpa).
2018-10-26 18:40:19 -04:00
dickmao
7a6d3c072b appveyor for msys2 2018-10-20 20:19:58 -04:00
dickmao
0345ed0b33 Try to address windows NT unseen. Add osx. Add ipython 7.0.1. 2018-10-20 00:12:34 -04:00
dickmao
085a188b20 Streamline login
Merge the login and open commands (open aliased to login).  Add login
tests described in #352.

Attempt to improve user experience by synchronously executing
`ein:jupyter-server-start`.  `ein:dev-prefer-deferred` custom variable
allows easy switch to compare sychronous versus old asynchronous behavior.
2018-10-17 16:52:10 -04:00
dickmao
257331f32c Revert "Normalize url-or-port"
This reverts commit 435d001b03.
2018-10-15 14:13:51 -04:00
dickmao
435d001b03 Normalize url-or-port
```
"http://localhost:8888"
"http://localhost:8888/"
"http://127.0.0.1:8888"
"http://127.0.0.1:8888/"
"8888"
8888
```

Ideally these should converge to the same thing.  Since many hash
tables are keyed off `url-or-port`, forgetting to
normalize `url-or-port` with `ein:url` leads to missed cache hits and
general malaise.  So we try to do that.

Address a FIXME: apply callbacks to `ein:notebook-list-login-and-open`.

Removed py3.5 from travis build matrix to reduce developer strain.
2018-10-14 20:36:49 -05:00
dickmao
c888508751 ein-jupyter must require ein-notebooklist but not conversely 2018-10-14 21:24:50 -04:00
dickmao
0c6e37c8e0 Normalize url-or-port
```
"http://localhost:8888"
"http://localhost:8888/"
"http://127.0.0.1:8888"
"http://127.0.0.1:8888/"
"8888"
8888
```

Ideally these should converge to the same thing.  Since many hash
tables are keyed off `url-or-port`, forgetting to
normalize `url-or-port` with `ein:url` leads to missed cache hits and
general malaise.  So we try to do that.

Address a FIXME: apply callbacks to `ein:notebook-list-login-and-open`.

Removed py3.5 from travis build matrix to reduce developer strain.
2018-10-13 13:09:53 -04:00
dickmao
11c2245c41 Asynchronize all server communication
Use deferred and callbacks instead of `:sync t` for tkf requests which
is known to have issues.  Query server attributes once on
notebooklist-open to avoid sequencing issue #176 (but allow Resync).
Under curl backend, a second request for the same "key" as a pending
request will abort the latter, which has resulted in a clobbered
curl-cookie-jar file, so merely warn and don't abort.

Fix #176
2018-10-07 00:40:48 -04:00
dickmao
ad8408dfb7 Implement undo
`M-x customize-group RET ein`
Toggle `Ein:Worksheet Enable Undo`
Save for Future Sessions
Restart emacs or kill/restart notebook

Fixes #338
2018-10-02 10:00:25 -04:00
dickmao
ec28cbe708 revive tkf tests
`make test-unit`
`make test-int` (formerly `cask exec ert-runner`)
An intermittent travis-melpa issue is solved by gonewest818.
2018-09-27 00:52:00 -04:00
Adrian Kretz
4bc4e54999 Fix token authentication 2018-05-15 02:24:03 +02:00
Edward Banner
3564ef3196 Add no-popup to lexical-let
I don't know enough about lexical-let to know why this works.
2018-03-29 11:15:35 -07:00
Edward Banner
e17819f918 Add no-popup option to ein:jupyter-server-start 2018-03-26 19:54:34 -07:00
Edward Banner
dee66e2e00 Search backward instead of forward for connection info 2018-02-21 16:13:11 -08:00
John Miller
1bd6155005 Fix for #253.
Use `executable-find' to expand jupyter server command.
2017-11-28 07:16:20 -06:00
Moogen Tian
71536bd748 ein-jupyter: Avoid always locating jupyter server startup command
Instead of always prompting the user for the path to the jupyter
executable, it will try to use the value of `*ein:last-jupyter-command*' or
the value of the customizable variable `ein:jupyter-default-server-command'
when the `ein:jupyter-server-start` command is called without C-u prefix arg.
2017-11-16 15:31:41 +08:00
John Miller
a03eee4cd7 ein-jupyter: More timeout adjustments. 2017-11-04 11:27:31 -05:00
John Miller
08a021781f ein-jupyter: We really need accept-process-output on Windows. 2017-10-23 19:40:06 -05:00
John Miller
0a3e602eb5 ein-jupyter: Tweak deferred:wait factor when starting jupyter.
Not at all sure why, but succesfully starting jupyter and detecting login token
info is sensitive to this factor. On Windows, a call to accept-process-output
prior to the deferred chain also works, but unfortunately seems to cause issues
on some Linux installations.

For the moment a factor of 10 seems to work, but we will see what feedback from
the community is. This may need to be a customizable variable.
2017-10-22 13:58:28 -05:00
Benda Xu
ab3cea045f lisp/ein-jupyter.el: pull more frequent for server start output. 2017-10-21 22:37:59 +09:00
Benda Xu
56d3a0157f Donot block for process. from the accept-process-output document:
Optional argument PROCESS means do not return until output has been
  received from PROCESS.

If jupyter notebook is fast enough and made all the outputs, at the
time of invoking accept-process-output will block until timeout.

Revert "ein-jupyter: Try waiting for process output before logging in."

This reverts commit 9cae1ba153.
2017-10-21 22:31:19 +09:00
John Miller
c0eabfe2ad ein-notebooklist: Fix possible bug specifying notebook urls
Don't think we were handling https:// url's correctly.

Also some code cleanup in ein-connect; fix longstanding bug in ein:load-files,
and tweak default timeout for starting a jupyter session from within emacs.
2017-10-03 10:04:41 -05:00
John Miller
9cae1ba153 ein-jupyter: Try waiting for process output before logging in.
Wait using `accept-process-output` before trying to look for auth tokens and
logging into the jupyter server.
2017-10-02 10:16:50 -05:00
John Miller
1ab98b0c9d ein-jupyter: More stable ein:jupyter-server-start
Trying to increase reliability of starting a juptyer server from Emacs. Deferred
is cool, but a pain to understand for this old brain.

Fix some typos in ein-ob and be smarter selecting completion backend when
connecting a python buffer to a jupyter notebook.
2017-09-22 14:31:14 -05:00
John Miller
3fc8d55722 ob-ein: Connect edit buffer to running notebook.
Instead of just enabling auto complete why not just connect to the notebook ala
`ein:connect-to-notebook`?

Update dependencies documented in README.rst

Force version check when starting the jupyter server - ein seems to be easily
confused in this regard.
2017-09-20 14:40:27 -05:00
John Miller
15ad1c49c7 ein-notebooklist: Order notebook list by file type.
Order entries in notebooklist by file type (i.e. file extension). Add function
'ein:jupyter-server-stop to 'kill-emacs-hook.

Fixed link in documentation.
2017-09-12 16:22:19 -05:00
John Miller
213cea559e ein-jupyter: Add timeout to ein:jupyter-server-start
Add configurable timeout (see `ein:jupyter-server-run-timeout`) that will
hopefully abort calls to `ein:jupyter-server-run` that hang; this is to help
with issues like those reported in #176.

Also update documentation, dependencies in preparation for 0.13.0 release.
2017-09-03 10:29:54 -05:00
John Miller
c78711a7c4 Back to eieio
It seems there are enough people out there still on Emacs 24 to warrant undoing
some of my recent moves away from eieio to cl-generic. For the near future I
will try to keep any changes that are incompatible with Emacs 24 to a
development branch. There is still probably plenty of opportunity to make the
code more future-proof for an eventual move away from eieio (I'm looking at you
oref and sref...)
2017-07-12 14:38:04 -05:00
John Miller
d9c81f3d90 ein:jupyter: More robust server launching, try for emacs24 compat.
Starting ipython/jupyter notebook servers from EIN should now be more robust.
Will try to detect correct url/port whether or not token authentication is
enabled, and if not will try to alert the user.

Also using `start-process` to run the notebook server - I think this will allow
compatibility with emacs24.
2017-06-06 15:25:44 -05:00
John Miller
0196407b42 ein-core: More stable ipython version checking.
Try to be more graceful when a null sneaks in for the server version. Also
experiment using deferred:$ in `ein:jupyter-server-start'.
2017-06-02 07:24:08 -05:00
John Miller
e3eca1115d ein-notebooklist: Avoid auth issues when changing host url.
When calling `ein:notebooklist-change-url-port' first make call to
notebooklist-open to ensure cookies are properly created/refreshed before trying
to save notebook and restart kernels.

Note this uses a bit of magic from deferred, which was already being used in
ein-jedi.el, but somehow never made it into the list of required pacakges. We
are now correcting that oversite.

Extend the timeout when querying the ipython/jupyter version. Also try to detect
when timeouts occur and in such cases temporarily assume a version (4 for the
moment).
2017-05-30 14:05:02 -05:00
John Miller
39f5d329f1 Functional tests start jupyter using ein:jupyter-server-start
This reduces some of the complexity in testein.py, but unfortunately running
tests is still unreliable. Running batchwise tests don't work at all in Windows,
and running from inside emacs tests often need to be run multiple times before
they pass.

The worst offender is the delete notebook test, which will pass on usually only
1 out of 3 tries.

Testing seems to have revealed a couple bugs, so win??
2017-04-07 08:18:41 -05:00
John Miller
0ea4a9adef Cleaning up compile warnings.
Slowly move towards cl-generic instead of EIEIO.

Got rid of json encoding defadvices. So far so good.
2017-03-16 16:16:16 -05:00
John Miller
7cff07321a Whitespace cleanup. 2017-03-04 20:57:37 -06:00
John Miller
6b7e251658 Allow user to specify additional arguments to start the jupyter server.
See customizable variable `ein:jupyter-server-args'.
2017-02-20 18:07:17 -06:00
John Miller
9e1341a704 Better documentation for a better user experience.
And better jupyter server launching...
2017-02-16 16:57:37 -06:00
John Miller
06fbab9058 Preparing for a version bump. 2017-02-16 09:19:40 -06:00
John Miller
58d8142d0a Numerous documentation updates.
Get rid of ein-sections: you are not yet ready for the world young man!
2017-02-16 09:01:14 -06:00
John Miller
900d7b4375 Add some customiable variables for controlling ein:jupyter-server-start 2017-02-16 08:11:58 -06:00
John Miller
4061a58c94 John discovers M-x update-directory-autoloads
Hope this does what I mean it to do..
2017-02-15 18:58:30 -06:00
John Miller
41f1513ac7 Forgot to specify autoload for the server commands. 2017-02-15 15:06:38 -06:00
John Miller
191d27c3ac Make stopping a jupyter server more user-friendly.
When calling `ein:jupyter-server-stop` ask to user if they are sure and also
give them the option to save any unsaved notebooks before killing the server.

Before closing the server also close any open notebook buffers.
2017-02-15 15:02:07 -06:00
John Miller
05bd6c010b Support for starting and stopping the notebook server from emacs.
For the moment we only support current version of jupyter (i.e. 4.3.1 or
greater).

The special commands are `ein:jupyter-server-start` to start a notebook server
and `ein:jupyter-server-stop` to, clearly, stop a notebook server.

On starting a server EIN will try to determine the url and token for accessing
the notebook server, login and open the notebook list automatically.
2017-02-15 14:18:16 -06:00