Skip to content

move git command into server extension #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bjuergens opened this issue Apr 13, 2018 · 4 comments
Open

move git command into server extension #7

bjuergens opened this issue Apr 13, 2018 · 4 comments

Comments

@bjuergens
Copy link
Collaborator

Issue: currently the git-commands are run in the kernel.

Solution: run the git-command in the serverside extension and use REST to communicate with the frontend (kinda like nbdime does)

@bjuergens
Copy link
Collaborator Author

this requires a significant design decision. I see multiple options:

Smart frontend, dumb backend

the serverside-extention is just a wrapper around elemental git functions (or maybe not even that, maybe it just forwards all parameters to git without any parsing at all)

this is the current state

dumb frontend, smart backend

the frontend extensions just displays, what the serverside extension needs. maybe the html is even generated on the server. the frontend extension could just look like this:

  1. get list of commands from server
  2. register commands with juypter
  3. when a command is executed, display the dialog, from the list in 1.
  4. send the user-input to the endpoint defined in 1.

pro:

  • adding/changing commands, doesn't require changes in the frontend
  • less JS, more python

con:

  • input validation while typing requires extra work (the python-backend would have to sent a js-snippet, that runs the validition)

neutral:

  • input validation happens in backend --> slower response time, but only need to validate once.

hybrid

each command is defined in javascript and has a corresponding endpoint on the server.

pro

  • input validation happens while the user is typing
  • most flexibility: Can make use of all feature of jupyter-frontend, jupyter-backend and browser

con:

  • input validation has to happen again on the server (not just because of trust, but also because race-condition)
  • frontend and backend could diverge; it requires extra care to keep them in sync at all time

@bjuergens
Copy link
Collaborator Author

additional option:

backend is rest-api for git, frontend is the actual extension.
then the api endpoint would be something like POST /git/add.

the frontend (JS) would take care of everything else

@bjuergens
Copy link
Collaborator Author

ok, this is what will happen:

  1. create REST-Wrapper for git
  2. all custom stuff happens in the browser
  3. some sort of auth makes sure, the serverside-extension is not access by another user

@bjuergens
Copy link
Collaborator Author

there are already several implementations of rest apis for git. We should think about using one of those for our server extension (maybe this one?).

On the other hand I don't like the idea of adding unneeded dependencies, espially from the moloch that is npm. But then again I don't want to keep track of all subtle parameters, that git knows, so it would be nice when some other organisation takes care of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant