• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Straightforward concurrency for Python

Vanilla Welcome to Vanilla!

If Go and ZeroMQ had a baby, and that baby grew up and started dating PyPy, and they had a baby, it might look like Vanilla.

Overview

Vanilla allows you to build concurrent software in Python. Vanilla programs are structured around independent coroutines (greenlets) which communicate with each other via Pipes. Pipes are similar to channels in Go programming.

There's no callback crazyness and no monkey patching. Vanilla strives to be as explict and straightforward as possible.

Documentation

Read the Docs

Here's how it looks:

You spawn coroutines:

h = vanilla.Hub()

def beat(message):
    while True:
        print(message)
        h.sleep(1000)

h.spawn(beat, 'Tick')
h.spawn_later(500, beat, 'Tock')
# Tick / Tock / Tick / Tock

Coroutines communicate via Pipes:

h = vanilla.Hub()
sender, recver = h.pipe()
h.spawn(sender.send, 'Hello World')
recver.recv()
# 'Hello World'

Pipe-fu; inspired by reactive functional patterns, Pipes can be chained:

h = vanilla.Hub()
p = h.pipe().map(lambda x: x*2)
h.spawn(p.send, 4)
p.recv()
# 8

In Vanilla, everything is a Pipe. Here's how TCP looks:

h = vanilla.Hub()

server = h.tcp.listen(port=9000)
# server is a Recver which dispenses new TCP connections

conn = server.recv()
# conn is a Pipe you can recv and send on

message = conn.recv()
conn.send("Echo: " + message)

Installation

Vanilla works with Python 2.6 - 2.9 and PyPy.

pip install vanilla

Status

Build StatusCoverage Status

More Repositories

1

python-consul

Python client for Consul (http://www.consul.io/)
Python
462
star
2

python-snowflake

A Python generator for the Twitter Snowflake scheme
Python
66
star
3

stacks

clip clip, pew pew
Rust
65
star
4

python-tradier

Python client for the Tradier API - https://developer.tradier.com/
Python
37
star
5

half.sh

a dashboard for shell scripts
Python
22
star
6

levee

Levee is a tool to succinctly and quickly create high performance network appliances with Lua
C
10
star
7

vanilla.consul

Vanilla (https://github.com/cablehead/vanilla) Python client for Consul (http://www.consul.io/)
Python
8
star
8

python-fity3

Fity3 is a Twitter snowflake like scheme generator that fits in 53 bits
Python
7
star
9

nu_plugin_from_sse

Nushell plugin to parse a stream of HTTP server sent events
Rust
6
star
10

http-sh

http -> shell -> http
Rust
4
star
11

noplate

A small experiment for designers who want to make a quick static html site, with simple template reuse, without having to run a full blown server side scripting solution.
JavaScript
3
star
12

dot

Vim Script
3
star
13

txt-sh

A Rust CLI tool for text processing, substituting command patterns (e.g., `$()` and `>()`) with shell command outputs in input text or files.
Rust
3
star
14

vanilla.bean

Obligatory Sinatra style (but concurrent!) micro-web framework for Vanilla.
Python
2
star
15

gpt.sh

various commands to create, modify, and navigate chat threads with OpenAI's GPT
Shell
2
star
16

stache

An intelligent cache
2
star
17

docker-init

Simplified init for bootstrapping a docker container
Python
2
star
18

test-git-hook

1
star
19

foundationdb-experiments

Tooling around with foundationdb
Python
1
star
20

backbone-sortable-list

JavaScript
1
star
21

beats

command line client for the Beats Music service
JavaScript
1
star
22

vagga-alpine-openresty

Config to build an alpine openresty image with vagga
1
star
23

cablehead.github.com

1
star
24

scru128-cli

scru128-cli
Rust
1
star
25

stutter

CLI to read from stdout, and write a stuttering stream to stdout.
Rust
1
star
26

xs

crossing the streams
Rust
1
star
27

vagga-alpine

Container recipes for Vagga; targeting alpine (http://vagga.readthedocs.org/en/latest/)
1
star
28

monglue

Minimal MongoDB document manager and toolkit
Python
1
star
29

xcat

like xargs, but for stdin
Rust
1
star
30

bork

Simplistic AWS Deployment
Python
1
star
31

nu_plugin_http

Rust
1
star
32

gpt2099

TypeScript
1
star
33

luajit-bundle

An experiment at packaging the ability to compile luajit applications to standalone system binaries
Lua
1
star