Skip to main content

Tools for using CoffeeScript with Python.

Project description


0. Setup

Supported Python versions: __2.7__ and __3.3+__

You need an installed coffee binary in your PATH. You can find installation instructions and further information at:


The easiest way is to use the [node package manager](

npm install coffee-script

To install __coffeetools__ just use [pip]( to get the latest [release]( from [PyPI](

pip install coffeetools

For basic usage there are no dependencies on other Python packages.

__Jinja__ and __IPython__ integration are [extra] features. They have the following requirements:

To install all extra dependencies:

pip install coffeetools[all]

1. Using CoffeeScript from Python

[1]: #markdown-header-1-using-coffeescript-from-python

from coffeetools import coffee

Evaluate CoffeeScript code and return the script’s output:

coffee(‘Some CoffeeScript’)

Compile CoffeeScript to JavaScript:

coffee.compile(‘Some CoffeeScript’)

Compile CoffeeScript to JavaScript without a top-level function():

coffee.compile(‘Some CoffeeScript’, bare=True)

2. Using CoffeeScript from Jinja2

[2]: #markdown-header-2-using-coffeescript-from-jinja2

More information coming soon…

3. Evaluate CoffeeScript in an IPython Notebook

[2]: #markdown-header-3-evaluate-coffeescript-in-an-ipython-notebook

%load_ext coffeescript

It is also safe to %reload_ext coffeescript

This registers the %%coffeescript cell magic function, which works like Ipython’s %%javascript magic, except that it takes CoffeeScript as input. It compiles the given code to JavaScript and uses IPython.display.display() with IPython.display.Javascript to run the code directly in the browser window:

%%coffeescript alert $(‘#notebook_name’).text()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for coffeetools, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size coffeetools-0.1.0.tar.gz (18.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page