Commit graph

45 commits

Author SHA1 Message Date
dickmao
8a545c508b close notebook on delete 2020-01-10 23:58:51 -05:00
dickmao
f7180405d6 makes test 2020-01-02 20:09:42 -05:00
dickmao
e12a33588d replace ein:aif with aif 2019-11-24 00:17:52 -05:00
dickmao
d0d13c8277 get 25.1 to compile 2019-11-13 17:46:50 -05:00
dickmao
d6d97d135c Shutting down
On my linux machine and travis, I'm noticing the undocumented
`api/shutdown` does not reliably kill the server.

I tried my best with appveyor but couldn't coerce it back to the
working state 13 days ago.
2019-08-07 17:01:11 -04:00
John Miller
ce419a12a5
Appveyor iterating (WIP) (#573)
* ob-ein: Bring back old functionality.

Bring back some old features to babel edit buffers while trying to respect
recent addition of polymode support.

* Override polymode if the user really wants.

Polymode is really for notebook buffers in any case, but this will override
whatever completion backmode a user has configured for python-mode.

* Install cask using python2.

For now python2 is the easiest option for testing on Windows since cask does
not properly support python3 when in Windows.

* Let's throw in the ert-runner, see what happens.

* Can I use my fork of cask?

Work around smartrep weirdness, try to live without command line wildcard
expansion.

* Get the url for the fork right.

* Experiment with python37, use test_script.

* Unstick appveyor, I hope.

* Fix parsing error.

* test_script is not executing. Why?

* Add ert testing.

But why are the test_script commands not executing?

* tasks: Automate building and testing using invoke.

Invoke leverages Python, which I hope will allow us to abstract out differences
in platforms when it comes to building and testing ein.

* Use invoke on appveyor.

* appveyor: Use the environment python.

So we can test versions other than python 2.7.

* Parsing error.

Is
https://packaging.python.org/guides/supporting-windows-using-appveyor/#setting-up
lying to me?

* Quote commands, just in case.

* Get python onto the path.

* Appveyor is catching up to travis.

* Parsing error.

* Update pip, try to get quoted syntax right.

* Still not liking my pip call.

Last try, next step we go to a requirements.txt file.

* Go to using a requirements file for pip.

* ecukes needs bash to work.

* Cleaning up and fiddling.

Seems like the emacs-jupyter guy has his act together - maybe we can take some
inspiration for our appveyor config.

* Syntax error in environment.

* More syntax errros.

* Maybe we need quoting.

* I give up.

* Formatting and cleanup.

* Add customization, yet another syntax error.

New customizable variable `ob-ein-babel-edit-polymode-ignore' to override
keybinding for \C-c\C-c in an org source code edit buffer.

* John learned some Powershell today.

* Fix the executable path.

Sometimes there is more than one curl installed on the system, make sure we can
account for that in testing.

* Handle updating the path inside invoke.

* Report which curl we are using before starting functional tests.

* Enable RDP so we can see error logs.

* Keep the build alive even when it finishes.

* Fix #568.

Apparently we need to specify the user agent when on windows, otherwise tornado
will start throwing 403 responses. Currently using Mozilla/4.0 as the agent, but
might be a good idea to make this value customizable.

* Clean up emacs config.

* Why is appveyor dropping the xsrf token?

* xsrf cookie found, what does the header look like?

* Try different user-agent header, reenable rdp.

* JSON encoding issues on Python side, it appears. Let's try an older Python.

Login works, contents query to get notebooklist works (i.e. GET on
/contents/api), but creating a notebook (i.e. POST on /contents/api) fails with
invalid JSON. ein and emacs-request appear to be generating the proper json, but
jupyter notebook does not see the same thing that is being written. Could be
bytes vs. text issue with modern v3.x python, so let us see how this all works
with Python 2.7.

* Python27 does not have pathlib out of the box.

* Make amends with Python27

* Back to python37.

Tornado/notebook still isn't reading the POST'ed json correctly.

* Do we need to specify content type?

* Must be selective in specifying application/json content.

* Re-enable rdp.

* Let's try a different curl.

* Ensure most recent curl is on path

* Try a different path.

* Try to warn user if suspicious curl detected.

* Remove debugging statements.

* EVM depends on trusty for 26.x

See issue #125 (https://github.com/rejeep/evm/issues/125). Let's hope I got the
travis.yml syntax right.

* Minimal support for ecukes from invoke.

* Cleaner server shutdowns, better ecukes support from invoke.

Use the /api/shutdown REST API call now to shutdown running server. Also support
more command line options for ecukes from invoke.

* Almost full support of ecukes using invoke.

But! Also disabling integration testing for the time being until I understand
why ecukes fails even though everything else is working.

* Just do integration and functional testing on appveyor.

Better than nothing while I work out what is breaking the integration tests.
2019-07-28 18:20:13 -06:00
dickmao
452d0e01b4 tkf/emacs-request 0.3.1 defaults encoding to utf-8
ein seems to have preferred the old default encoding of `binary` versus
`utf-8`.  Explicity set encoding back to `binary` but this
necessitates our using the latest emacs-request.

Fixes #566
2019-07-02 00:12:52 -04:00
dickmao
f4d301d8c9 Cleanup save-before-quit logic, and polymode kill buffer bugfix
Before: Exit emacs with modified notebooks.  Be asked "You have
unsaved notebooks.  Discard changes?"  Respond no, and manually figure
out which notebooks haven't been saved.

After: Exit emacs with modified notebooks.  Be asked "Save A?".
Respond yes.  Quit without further ado.

Also, bugfix killing of buffers in polymode.  Must kill host buffer,
not indirect buffers.
2019-05-07 09:54:20 -04:00
dickmao
fbda27ba7f Surface curl errors
In light of #425 and #456, provide more guidance on curl errors.

Also, clean up eldoc stub.  Leveraging elpy's eldoc perfection seems
the only sensible choice, however.
2019-01-21 13:42:35 -05:00
dickmao
bead667ee0 Clean up multilang
Do not assume python... leverage ESS to improve R interaction.
Fix both undo and fontify in the presence of toggling cells (`C-c
C-t`)
Fix and test switching kernels
2018-12-08 21:25:48 -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
20cf261a8e fixes #399 2018-11-09 14:50:16 -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
6e3a062e98 travis is a harsh taskmaster 2018-10-17 17:45:19 -04:00
John Miller
7bc6e88e5c ein-query: More debug messages, try harder not to get stuck.
Logging to see what the heck is going on, and something of a failsafe to
continue execution in the case things get really stuck.
2018-10-12 15:31:33 -05:00
John Miller
0212845c6d ein-query: Fix syntax error in loop.
Also tuning as stress testing is showing some problems with my intial solution.
2018-10-12 14:03:22 -05:00
John Miller
b36f33e76c ein-query: Fix #345.
This should keep too many calls to `request' from occurring at the same time.
Not sure I like blocking while waiting for previous calls to terminate, but for
the moment this seems the easiest solution without going the full deferred route
on `ein:query-singleton-ajax' and wrapping calls with semaphore checks via
concurrent.
2018-10-12 11:34:44 -05: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
Tomasz Mieszkowski
f29f0a3293 Don't strip existing headers in ein:query-prepare-header
This change fixes the issue where notebook being saved is sent to Jupyter with
`Content-Type: application/x-www-form-urlencoded`, because the default value of
this header (`application/json`) gets wiped out in `ein:query-prepare-header`.

The above issue becomes more apparent when notebook contains non-ascii
characters - in such case Jupyter logs a warning: `Invalid x-www-form-urlencoded
body: 'latin-1' codec can't encode characters in position XXX: ordinal not in
range(256)`.
2018-06-24 17:54:20 +02:00
John Miller
4f5f29d351 ein-jupyterhub: Fix websocket connects.
Made sure to add the right cookies to the websocket request. Websockets
authenticate and everything is peachy now.
2017-07-25 16:57:32 -05:00
John Miller
9a1579d5f6 ein-jupyterhub: Support contents api
When running against jupyterhub master (which will someday be v0.8) can know log
in and make calls to the contents api.

Everything is working except for opening websocket connections.
2017-07-25 15:36:07 -05:00
John Miller
e2078e8951 ein-jupyterhub: Code to authroize a user with jupyterhub.
`ein:jupyterhub-connect' will take a url for the jupyterhub server, a user, and
a password and then get and store the authorization token for that user.

Big things on the way!
2017-07-21 12:36:07 -05:00
John Miller
21925e8122 ein-jupyterhub: Early success getting version and authentication token
Some initial success querying jupyterhub for the version and getting an
authentication token for a user.
2017-07-20 18:25:40 -05:00
John Miller
d3a40af574 Add auto-complete as a required dependency.
It seems that in some instances EIN is failing to install on emacs installations
that do not have auto-complete, so for the moment I am making auto-complete a
required package.

If this causes you a problem please log an issue on the project issues page
(https://github.com/millejoh/emacs-ipython-notebook/issues) and let me know
what is happening on your system.
2017-06-16 13:17:11 -05:00
John Miller
ed9c0cf606 Fix for issue #162.
Add X-XSRFTOKEN header when cookie is present. See notes for notebook
[v4.3.1](https://blog.jupyter.org/2016/12/21/jupyter-notebook-4-3-1/).
2017-01-03 20:11:28 -06:00
John Miller
90c7e4501f Try to fix blocking call warning
According to the internet this is because we need a `with-local-quit` at
the right time and place.
2016-10-09 12:45:32 -05:00
John Miller
9182acc258 NBFormat v4 Tweaks, fixing rename-notebook
Renaming notebooks should work a bit better now, tweaked code for saving
nbformat v4 to correctly include execution_count parameter even if cell
has not been executed.

Cleaned up some silliness in ein:query-singleton-ajax.
2014-11-11 11:33:14 -06:00
John Miller
849adda708 Support for nbformat v4
BEWARE! This is a large commit and the code here is still mostly
untested. Back up your notebooks before giving this changeset a try with
the current IPython-dev version.

Given that, ein is now able to open and save basic notebooks saved in
nbformat 4. Still haven't tested more complex notebooks with embedded
images.
2014-11-07 19:28:09 -06:00
gcr
1914e68b89 Encode URL before opening it
This fixes the bug where EIN cannot open notebooks with spaces in them.

I'm not sure if this is correct!
2014-05-23 15:24:48 -04:00
Takafumi Arakaki
7901e90db7 Default ein:query-timeout is nil if curl is used
this is to address #114
2013-06-11 16:51:06 +02:00
Takafumi Arakaki
8409fa14ad Fix timeout handling in ein:query-singleton-ajax 2012-12-29 19:36:53 +01:00
Takafumi Arakaki
84ea2748fb Remove unused functions from ein-query.el 2012-12-29 19:32:43 +01:00
Takafumi Arakaki
e58ce1413e Use request-cookie-string 2012-12-29 19:30:00 +01:00
Takafumi Arakaki
9e3be6c954 Rewrite ein:query-singleton-ajax using request 2012-12-29 18:55:06 +01:00
Takafumi Arakaki
1f29b6d91e Workaround url.el bug for proper message after login 2012-12-17 19:26:13 +01:00
Takafumi Arakaki
041873b18f Better POST handling when DATA is given to ein:query-ajax 2012-12-17 17:39:46 +01:00
Takafumi Arakaki
a4c7e6d00d Add ein:query-get-cookie 2012-12-17 17:39:46 +01:00
Takafumi Arakaki
0576e54486 Log url-http-method when querying 2012-12-04 11:04:46 +01:00
Takafumi Arakaki
fc386d3647 Better error logging in ein:query-ajax--parse-data 2012-09-19 01:24:03 +02:00
Takafumi Arakaki
25f67b9874 Refactor ein-query.el: better debugging message 2012-09-18 22:46:10 +02:00
Takafumi Arakaki
ca8c1678fe (require 'ein-utils) -> (require 'ein-core) 2012-08-28 15:26:32 +02:00
Takafumi Arakaki
7ca779e836 Move ein:with-live-buffer to ein-utils.el 2012-08-19 12:44:00 +02:00
Takafumi Arakaki
71ec80da82 Rename: ein:query... -> ein:%query-ajax-canceled%
%s/\_<ein:\(query-ajax-canceled\)\_>/ein:%\1%/g
2012-08-18 23:00:51 +02:00
Takafumi Arakaki
b044aca6b7 Rename: ein:query... -> ein:%query-ajax-timer%
%s/\_<ein:\(query-ajax-timer\)\_>/ein:%\1%/g
2012-08-18 23:00:24 +02:00
Takafumi Arakaki
d1031fd61e mv *ein*.el ein.py lisp/
fixes #6
2012-07-02 16:47:20 +02:00
Renamed from ein-query.el (Browse further)