RSSAmplifier

Blog

stevenloria.com

stevenloria.comRSS feed ↗16 posts

Latest posts

Building a Dashboard for a Python Package

I made a simple dashboard for visualizing marshmallow PyPI downloads. Why While maintaining marshmallow, I found myself running one-off queries against PyPI's BigQuery dataset to answer some recurring questions: How many marshmallow users are using Python 2 vs Python 3? Can we drop support for a minor Python version without …

Dynamic Schemas in marshmallow

marshmallow 3 will have a Schema.from_dict method that generates a Schema class from a dictionary of fields. from marshmallow import Schema , fields GistSchema = Schema . from_dict ( { "id" : fields . Str ( dump_only = True ), "content" : fields . Str ( required = True ), } ) Here's a rundown of a few use cases this API enables. Schemas generated at …

Introducing local-repl: Supercharged Node.js REPLs

Today I released local-repl 4 , a CLI for running project-specific Node.js REPLs. The basic idea local-repl saves you from typing out imports every time you open a new Node.js REPL. You specify the modules and objects that you want to automatically import in either package.json or .replrc …

Responsive Typography Using Modern CSS

Choosing type sizes for a website can be daunting. Heading and paragraph sizes have drastic consequences over the layout and legibility of a page. Thankfully, we have modular scales to guide us. A modular scale is a sequence of numbers that relate to one another in a meaningful way. Tim …

Recent Releases

Some notes on some recent releases: TextBlob 0.11.0 Changelog This mainly fixes compatibility with NLTK 3.1 and above. Older versions of NLTK are no longer supported. As an added bonus, the averaged perceptron tagger described in this post is now the default part-of-speech tagger in both NLTK …

marshmallow 2.0 Released

One alpha, five betas, and two release candidates after marshmallow's last 1.x release, marshmallow 2.0 is published to the PyPI. What is marshmallow? Marshmallow is a Python library for Validating input data against a schema, Deserializing data to application objects (e.g., ORM objects), and Serializing application objects …

Three Command-line Tools for Productive Python Development

Below are three tools that I started using recently that I have since found indispensable when developing with Python. I. Bootstrap your project with cookiecutter I am a big fan of project templates. They enable you to reuse best practices and patterns whenever you start a new project. Audrey Roy's …

The M's, V's, and C's: Keep 'em light and fluffy

The MVC design pattern gives us general guidelines on where components of an application should go. Web frameworks attempt to enforce MVC by giving us cookiecutter classes and interfaces for each of the three layers. But as an application gets larger, it becomes more difficult to decide where certain components …

Tutorial: What is WordNet? A Conceptual Introduction Using Python

In short, WordNet is a database of English words that are linked together by their semantic relationships. It is like a supercharged dictionary/thesaurus with a graph structure. TextBlob 0.7 ( changelog ) now integrates NLTK's WordNet interface, making it very simple to interact with WordNet. This tutorial is a gentle …

Tutorial: State-of-the-art Part-of-Speech Tagging in TextBlob

Following the tradition of writing a short tutorial with each new TextBlob release (0.6.3, changelog ), here's an introduction to TextBlob's first outside code contribution from Matthew Honnibal, a.k.a. syllog1sm : a part-of-speech tagger based on the Averaged Perceptron algorithm which is faster and more accurate than NLTK …

Tutorial: Finding Important Words in Text Using TF-IDF

Another TextBlob release (0.6.1, changelog ), another quick tutorial. This one's on using the TF-IDF algorithm to find the most important words in a text document. It's simpler than you think. What is TF-IDF? TF-IDF stands for "Term Frequency, Inverse Document Frequency." It's a way to score the importance …

Tutorial: Simple Text Classification with Python and TextBlob

Yesterday, TextBlob 0.6.0 was released ( changelog ), which introduces Naive Bayes classification. This tutorial shows how to use TextBlob to create your own text classification systems. The tutorial assumes that you have TextBlob >= 0.6.0 and nltk >= 2.0 TextBlob >= 8.0 installed. If you don't yet have …

Hosting Static Flask Sites on Github Pages

This past weekend, I released KillTheYak.com , a website with guides for installing and using various tools. It's a static site powered by Flask and hosted for free (as in beer) on Github Pages . Static Flask sites are a big win because: They're fast. If you need your site to …

Lazily-evaluated Property Pattern in Python

Lazy evaluation is a useful pattern that can improve your code's efficiency in many situations. One example of this is instance attributes that take long to compute: This approach may cause initialization to take unnecessarily long, especially when you don't always need to access Person#relatives . A better strategy would …

Startup Skepticism

From Alex Payne's Letter To A Young Programmer Considering A Startup : A startup is just a means to an end. Consider the end, and don’t seek to revel in the means. What do you care about? Who do you want to help? Does a startup make meeting your goals …

Python Best Practice Patterns by Vladimir Keleshev (Notes)

These are my notes from Vladimir Keleshev's talk entitled "Python Best Practice Patterns", given on May 2, 2013 at the Python Meetup in Denmark. The original video is here (about 38 minutes long). Note: Some of the code examples have been has been modified from the original presentation based on …