Skip to content

Instantly share code, notes, and snippets.

@rmcgibbo
rmcgibbo / proposal.md
Last active July 3, 2017 13:24
IPython Tab Completion

Proposal

Abstract

The IPython tab completion machinery is messy, complicated, and difficult to extend. The IPython pull request 2701, for instance, envisioned a feature -- tab completion based on function-specific annotations -- which, because of the current sub-optimal completion API, required a quite a bit of hacking into the core completer logic to execute. This proposal envisions a refactoring of the IPython tab completion machinery -- largely IPython/core/completer.py, IPython/core/completerlib.py, and a little bit of IPython/core/interactiveshell.py -- in a way that simplifies and unifies the codebase while providing a powerful and flexible public-facing API, enabling its extensibility in 3rd party projects.

History of the Tab Completion Machinery

  • Started closely tied to GNU readline, and to the stdlib's rlcompleter.py module
  • Hacked to be able to work with non-readline frontends, like the notebook and qtconsole.
@bj0
bj0 / jinja2.ipynb
Created April 9, 2013 05:55
IPython Custom Cell Magic for Rendering Jinja2 Templates
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sudeepdas
sudeepdas / MLENS_1MILLION.ipynb.json
Created April 22, 2013 16:48
MOVIE RECOMMENDER Buiiding a python based recommendation system by wrangling the movieLens database with Pandas. MovieLens data is available at http://www.grouplens.org/node/73
{
"metadata": {
"name": "MLENS_1MILLION"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@jstcki
jstcki / README.md
Last active December 16, 2015 17:08
Indented tree layout
1. pip install -r reqs.pip
2. server.py
3. open client.html in browser
4. redis-cli publish push '123456'
5. check browser console
@jasonrudolph
jasonrudolph / gist:6057563
Last active February 20, 2025 11:03
GitHub Search API: Get the number of stars for a repository

James Sugrue [asked][1], "@GitHubAPI is there a way to find the number of stars for a given repository?"

Example

$ curl -ni "https://api.github.com/search/repositories?q=more+useful+keyboard" -H 'Accept: application/vnd.github.preview'
{
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active January 3, 2025 03:54
5 entertaining things you can find with the GitHub Search API
@minrk
minrk / nbstripout
Last active March 12, 2025 18:41
git pre-commit hook for stripping output from IPython notebooks
#!/usr/bin/env python
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS.
This does mostly the same thing as the `Clear All Output` command in the notebook UI.
LICENSE: Public Domain
@sloria
sloria / bobp-python.md
Last active April 27, 2025 07:06
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@dan-blanchard
dan-blanchard / .1.miniconda.md
Last active December 11, 2019 22:38
Quicker Travis builds that rely on numpy and scipy using Miniconda

For ETS's SKLL project, we found out the hard way that Travis-CI's support for numpy and scipy is pretty abysmal. There are pre-installed versions of numpy for some versions of Python, but those are seriously out of date, and scipy is not there are at all. The two most popular approaches for working around this are to (1) build everything from scratch, or (2) use apt-get to install more recent (but still out of date) versions of numpy and scipy. Both of these approaches lead to longer build times, and with the second approach, you still don't have the most recent versions of anything. To circumvent these issues, we've switched to using Miniconda (Anaconda's lightweight cousin) to install everything.

A template for installing a simple Python package that relies on numpy and scipy using Miniconda is provided below. Since it's a common s