background preloader

Python

Facebook Twitter

Welcome to the Pants build system. — pants 0.1 documentation. Hickford/MechanicalSoup. Sorting — Problem Solving with Algorithms and Data Structures. Sorting is the process of placing elements from a collection in some kind of order.

Sorting — Problem Solving with Algorithms and Data Structures

For example, a list of words could be sorted alphabetically or by length. A list of cities could be sorted by population, by area, or by zip code. We have already seen a number of algorithms that were able to benefit from having a sorted list (recall the final anagram example and the binary search). There are many, many sorting algorithms that have been developed and analyzed. This suggests that sorting is an important area of study in computer science. Before getting into specific algorithms, we should think about the operations that can be used to analyze a sorting process. The Bubble Sort. Csvkit 0.7.3 (beta) — csvkit 0.7.3 (beta) documentation.

Django

Python web scraping resource. On requests, python, lxml, scrape, proxies, web crawler, download images If you need to extract data from a web page, then the chances are you looked for their API.

Python web scraping resource

Unfortunately this isn't always available and you sometimes have to fall back to web scraping. In this article I'm going to cover a lot of the things that apply to all web scraping projects and how to overcome some common gotchas. Profiling python with cProfile. A couple of days ago, I had an assignment for an Information Retrieval class that basically involved: Indexing a large corpus (Reuters from nltk) Searching it using boolean queries (eg. bill AND gates) For the second part of the of the assignment, performance was pretty important.

Profiling python with cProfile

Since we would want to return results for the user’s queries quickly. This blogpost is basically about how I used python’s cProfile to identify and fix bottlenecks/slow parts in my code. Most of these bottlenecks would have been hard to identify without the profiler. IPython: The Complete Beginners Guide. The IPython project began in 2001 as Fernando Pérez’s side project to make a better interactive Python interpreter. In the subsequent 11 years it has grown into what’s widely considered one of the most important tools in the modern scientific Python computing stack. While it does not provide any computational or data analytic tools by itself, IPython is designed from the ground up to maximize your productivity in both interactive computing and software development.

It encourages an execute-explore workflow instead of the typical edit-compile-run workflow of many other programming languages. It also provides very tight integration with the operating system’s shell and file system. Since much of data analysis coding involves exploration, trial and error, and iteration, IPython will, in almost all cases, help you get the job done faster. Since IPython has interactivity at its core, some of the features in this article are difficult to fully illustrate without a live console. Introspection. 30 Python Language Features and Tricks You May Not Know About. 1 Introduction Since I started learning Python, I decided to maintain an often visited list of "tricks".

30 Python Language Features and Tricks You May Not Know About

Any time I saw a piece of code (in an example, on Stack Overflow, in open source software, etc.) that made me think "Cool! I didn't know you could do that! " Django Integration — Fabric 1.8.1 documentation. These functions streamline the process of initializing Django’s settings module environment variable.

Django Integration — Fabric 1.8.1 documentation

Once this is done, your fabfile may import from your Django project, or Django itself, without requiring the use of manage.py plugins or having to set the environment variable yourself every time you use your fabfile. Currently, these functions only allow Fabric to interact with local-to-your-fabfile Django installations. This is not as limiting as it sounds; for example, you can use Fabric as a remote “build” tool as well as using it locally. Imagine the following fabfile: At a glance — Scrapy 0.22.1 documentation. Scrapy is an application framework for crawling web sites and extracting structured data which can be used for a wide range of useful applications, like data mining, information processing or historical archival.

at a glance — Scrapy 0.22.1 documentation

Even though Scrapy was originally designed for screen scraping (more precisely, web scraping), it can also be used to extract data using APIs (such as Amazon Associates Web Services) or as a general purpose web crawler. The purpose of this document is to introduce you to the concepts behind Scrapy so you can get an idea of how it works and decide if Scrapy is what you need. When you’re ready to start a project, you can start with the tutorial. Hhatto/autopep8. Pycoder's Weekly - Top Python Projects of 2013. Testing & Debugging.

Pycoder's Weekly - Top Python Projects of 2013

Tgalal/yowsup. Katee/quietnet. Madisonmay/CommonRegex. Sleepy.Mongoose: A MongoDB HTTP Interface. The first half of the MongoDB book is due this week, so I wrote a REST interface for Mongo (I’m a prolific procrastinator).

Sleepy.Mongoose: A MongoDB HTTP Interface

Anyway, it’s called Sleepy.Mongoose and it’s available at Installing Sleepy.Mongoose Install MongoDB.Install the Python driver: Download Sleepy.Mongoose.From the mongoose directory, run: You’ll see something that looks like: ================================= | MongoDB REST Server | ================================= listening for connections on. Hidden features of Python. Graphite - Scalable Realtime Graphing - Graphite.

Graphite 0.9.10 has been released and is now available.

Graphite - Scalable Realtime Graphing - Graphite

The packages for Whisper, Carbon, and Graphite-web are available via several sources: This release contains a fabulous amount of incremental improvement over 0.9.9. Some highlights include: Fixes to several annoying Composer and Dashboard UI bugsImport of Saved Graphs into DashboardsFixes to cache-full behavior for carbon-cache and carbon senders (relay and aggregator)Many new useful render functions and graph optionsImprovements to the rendering engine and fixes to many rendering bugsSupport for rendering graphs as annotated SVGBetter organized and more flexible Graphite-web config layout (local_settings.py) Python Programming Language Advantages - Mike Levin.

NOTE: Download Levinux (~20MB) and run Python, vim and git on Linux Server with from your Mac, Windows or Linux desktop with a double-click (no install) in just a few minutes!

Python Programming Language Advantages - Mike Levin

Fall in love too. This article is not about Python vs. other languages, so much as it is about those peculiarities of Python that made it endearing to me—a non-professional programmer whose achievements at work came directly from being able to program. I code almost every day at my job… but not as my job. If that sounds anything like you, then Python may be for you. And yes, ultimately I do believe it’s better than getting started with JavaScript—though I really do appreciate and struggle with the counter-argument. Python Data Analysis Library — pandas: Python Data Analysis Library. PyPy - Welcome to PyPy. The os.path module. This module contains functions that deal with long filenames (path names) in various ways.

To use this module, import the os module, and access this module as os.path. Refine, reuse and request data. Beautiful Soup: We called him Tortoise because he taught us. Eventlet Networking Library. CherryPy — A Minimalist Python Web Framework. Cherrypy / CherryPy. Invent Your Own Computer Games with Python. AJAX. Stoat — Stoat 0.4.0 documentation. Stoat is a sleek, lightweight, pluggable CMS app for Django, built to work with Grappelli. Stoat is like flatpages on steroids. No, scratch that, Stoat isn’t that bulky. Celery: Distributed Task Queue. Gunicorn ‐ Python WSGI HTTP Server for UNIX. ‎learnpythonthehardway.org/book/

Django Packages

Pragmatic startup. F*ck me. Had enough of these m*thf**kin snakes. I need a Royale with Cheese As a newbie learning to code, the first question that you are faced with is: which programming language to choose? Flask. Typogrify examples. Untypogrified. Tcorbettclark / rest-api-blueprint / wiki / AutomaticTesting. A REST API can be tested using Gherkin BDD syntax, a neat way of expressing and automatically confirming the desired behaviour. The behave tool works really well, particularly when combined with jpath, purl, requests, and Jina2.

During ad hoc interactive testing and experimenting the httpie tool is usually easier than curl. Like many aspects of this whole blueprint project, the automatic testing of a REST API can easily be pulled out and used in isolation. Simple API Key Generation in Python. Summary. Heynemann/pyccuracy.