StackOverflow changes from 2013 to 2017

| Comments

Here is an update for StackOverflow statistics for the users with a reputation more than 300. The last measure was made in January 2013.

I almost stopped to answer from the beginning of 2014. At that time I had a reputation around 1600, now it’s 2630.

The number of users growed more than 3 times, but the distribution by reputation is mostly the same.

EuroPython 2017

| Comments

This year, as in previous, I missed the conference. This time I even bought the ticket, but had to return it. The refund process works well, but takes time. Fortunately, there are the live streams from all days, the only problem is to find a time to watch them.

How to install pillow, psycopg, pylibmc packages in python:alpine image

| Comments

Here is the examples how to install some packages in python:alpine image. Some dependencies should be installed permanently and some only for package build and removed after.

pillow

RUN apk add --no-cache jpeg-dev zlib-dev

psycopg

RUN apk add --no-cache postgresql-dev

pylibmc

RUN apk add --no-cache libmemcached-dev zlib-dev 

Then to install:


RUN apk add --no-cache --virtual .build-deps build-base linux-headers \
    
    && pip3 install pip --upgrade \
    
    && pip3 install <packages list> \
    
    && apk del .build-deps

Mailgun for emails in docker

| Comments

Usually, even a small web application should send some emails: errors, registration, restore password, invitations, etc.

There are 3 solutions:

  • use an existing account, like gmail: the main problem - you don’t know how many emails you can send before being marked as spam
  • use own mail server: need to install, configure and support
  • use email service, like sendgrid, mailgun: easy to configure, provide statistics and logs, can use default http port.

For some my small projects i choosed mailgun, it provides 10000 emails in month for free, for my needs it’s more than enough and after that it’s also not expensive. For django there is a email backend django-mailgun and it takes two minutes to switch to it.

Interesting articles

| Comments

Several interesting articles I found recently. Some of them I think from Dan Bader twitter.

Django vs Flask - a detailed comparison Django vs Flask.

In most cases I preferer Django.

  • It has better documentation
  • There are better apps in core, with Flask you need to search for an app, compare alternatives and sometimes they are not updated for a long time
  • You can choose which core apps to use
  • I think it’s better developed and supported

How the heck does async/await work in Python 3.5? - a long read about async in python

Using Docker for Flask Application Development (not just Production!) - i use it the same way, the only problem I have with Python development in Docker is debugging in Intellij Idea. There is a remote interpreter, but it does not work well for me, will try it again with the latest version.

Flask-RESTful migration to Flask-RESTPlus

| Comments

In a simple application with a several endpoints, it’s ok to use the default Flask routes.

@app.route('/api/v1.0/users', methods=['GET'])
def get_users():
    return jsonify({'objects': users})

But when an application becomes bigger, it can be useful to use a some REST framework or split it on the smaller apps. The REST framework is used to:

  • enforce best practices
  • simplify: versioning, serialization, documentation, authenication
  • provide browsable API

1/5 »