Giter VIP home page Giter VIP logo

jeev's Introduction

Jeev

Jeev is a python alternative to Github's famous Hubot, using Python+Gevent instead of Node+CoffeeScript.

Motivation

I got tired of Hubot's callback spaghetti, and decided to write an alternative to work with my company's slack channel. This project is a work in progress, and is roughly documented.

Installing Jeev

You will need Python 2.7, and setuptools. If you want, you can install Jeev in a virtual environment.

Install jeev (and his built in modules) with pip:

$ pip install jeev jeev-modules

This will install jeev, and his dependencies. It will also give you the jeev command which can be used to create an initial jeev configuration, and run the bot. Let's create an instance of jeev in the folder "myjeev":

$ jeev init myjeev

If you want to use jeev with heroku, or just have your Jeev instance inside of a git repository, the newly created directory has everything you need: the configuration file, a few sample modules, a .gitignore file (so that you can safely add everything to git).

$ cd myjeev
$ git init
$ git add .
$ git commit -m "Jeev's initial commit."

Now you can run Jeev by simply calling:

$ jeev run

This will start Jeev using the console adapter that will read messages from stdin, and print out Jeev's responses to stdout.

$ jeev run
>>> Jeev Console Adapater
>>> Switch channel using \c channel_name
>>> Switch user using \u user_name
>>> Jeev will respond to the user name Jeev
[user@test] >

License

The MIT License (MIT)

Copyright (c) 2014 Jacob Heinz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

jeev's People

Contributors

blitz2145 avatar chrisportela avatar jhgg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jeev's Issues

SSL error when reconnecting

I figured this would be the best place to keep this.

I've made changes so that Jeev tries to reconnect after a websocket connection is closed (When it gets a ConnectionAlreadyClosed(?) exception from the websocket client slack uses), but it seems to have gotten an SSL error now on the reconnect.

ERROR:jeev.adapter.slack:WebSocket connection closed.
Traceback (most recent call last):
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/jeev-0.3.0b0-py2.7.egg/jeev/adapter/slack.py", line 340, in _run
    self._do_slack_connection()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/jeev-0.3.0b0-py2.7.egg/jeev/adapter/slack.py", line 355, in _do_slack_connection
    frame = self._server.websocket.recv()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 348, in recv
    opcode, data = self.recv_data()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 365, in recv_data
    opcode, frame = self.recv_data_frame(control_frame)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 378, in recv_data_frame
    frame = self.recv_frame()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 410, in recv_frame
    return self.frame_buffer.recv_frame()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_abnf.py", line 300, in recv_frame
    self.recv_header()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_abnf.py", line 249, in recv_header
    header = self.recv_strict(2)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_abnf.py", line 334, in recv_strict
    bytes = self.recv(min(16384, shortage))
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 476, in _recv
    return recv(self.sock, bufsize)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_socket.py", line 77, in recv
    bytes = sock.recv(bufsize)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/_ssl2.py", line 204, in recv
    return self.read(buflen)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/_ssl2.py", line 109, in read
    return self._sslobj.read(len)
SSLError: [Errno 2] _ssl.c:1429: The operation did not complete (read)
<Greenlet at 0x7f0f3c580730: <bound method SlackAdapter._run of <jeev.adapter.slack.SlackAdapter object at 0x7f0f3d0c8c90>>> failed with SSLError

Finish writing documentation

Need to finish writing documentation for:

  • Modules
  • Your First Module
  • Web Module
  • Module best practices
  • Adapters
  • Deployment

Module command documentation parsing inside docstr + help command

Need to have a way to reveal to the user the list of commands.

I was thinking that handlers with a docstr, should be parsed and added to a list. I.e.

@module.respond("what is the weather in (.*)")
def weather(message, where):
    "what is the weather in {location} - Gets the weather in location"
    ... code here ...

Module option config

Want to expose an interface such that we can do:

import module

# A required option.
module.opt(
    "option_name", 
    description="This is the description for option_name")

# An optional option, with a default of 5, and will be cast to an int when read.
module.opt(
    "max_number_of_something",
    description="The max number of something",
    default=5,
    cast=int)

@module.opt_validator('max_number_of_something')
def less_than_100(value):
    if value > 100:
        raise module.ConfigError("Must be less than 100!!")

When the module is loaded, it will check for the presence of option_name in the config (and the ENVIRON), and throw an error if it's not.

Then I can expose a function like jeev chkconfig --module mod_name that will do a check to see if everything is set properly.

I can also expose a function jeev modopts mod_name that will print a list of the module options (what they're set to, and what's missing).

This should help module devs be explicit about their dependencies, and let users debug what's missing really easily.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.