Skip to content

Instantly share code, notes, and snippets.

@pyhedgehog
Last active January 9, 2017 08:29
Show Gist options
  • Save pyhedgehog/3cbf3f852579ac55f325bbc3e755ffb2 to your computer and use it in GitHub Desktop.
Save pyhedgehog/3cbf3f852579ac55f325bbc3e755ffb2 to your computer and use it in GitHub Desktop.
Several python hooks questions

As I understand current implementation of auto-install (for NodeJS hooks):

  1. hook.io spawns hpm-server
  2. hook.io spawns hook using microcule
  3. For NodeJS hooks microcule spawns it using run-service
  4. run-service catches every error and pass it's JSON representation to stderr (among other JSON messages)
  5. microcule processes MODULE_NOT_FOUND errors...
  6. Somehow (hook.io/lib/resources/packages.js or hook.io/lib/resources/hook/stderr/index.js) it passes call to POST http://localhost:8888/npm/install of hpm-server
  7. hpm-server calls hpm.npm.spawn
  8. hpm.npm.spawn starts install-package-npm
  9. install-package-npm calls hpm.npm.install which calls npm.commands.install (uses npm as a package)

There should be several changes for python package auto-install:

  1. Catch of ImportError exception.
  2. Implement passing and handling /pip/install and /pip3/install URLs.
  3. Implement hpm.pip.install by spawning pip install -t <dir> <pkg>... or pip3 ....
  4. Where should new packages be installed? /usr/lib/python2.7/dist-packages?

Additional thoughts about python/python3 implementation at all:

  1. Exception JSON-ing already implemented in hook.io-sdk-python.
  2. There are WSGI standard in python for any web implementations. Sample wrapper for hooks already implemented.
  3. There are implementation of logging.
  4. Usually list of dependencies stored in requirements.txt file that can be used as pip install -r requirements.txt.
  5. hook.io-sdk-python API not yet stabilized (I have plan to rewrite it to be more pythonic).

So you need to clarify following questions:

  1. Should we change python hook processing (which is currently ugly and un-pythonic).
  2. If yes - what should we add?
   a. Only add exceptions JSON-ing
   b. (a)+logging init
   c. (b)+WSGI wrapper
   d. (c)+SDK
  1. Should hook.io-sdk-python be transferred to bigcompany authority?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment