Python 3.7 now available on Scalingo

August 09, 2019 - 5 min read
Python 3.7 now available on Scalingo

Now that our recent work on stacks has been completed we have some great news for the Python developers out there: Python 3.7 support is now publicly available on Scalingo! From now on, you can execute a Python 3.7 application in an instant.

Enabling Python 3.7 for Your App

Getting your application executed by the powerful Python 3.7 is as simple as specifying it in your Pipfile file:

python_version = "3.7"

If you already have an application running, just update your existing Pipfile file with a newer version. Then, git commit and git push this change.

Note that your app must use the stack `scalingo-18`. If your app was created after August 6th 2019 it's already using this new stack. Otherwise you may want to specify the stack with `scalingo --app my-app stacks-set scalingo-18`. Learn more about stacks in our [documentation center](

What's New in Python 3.7

This new release of Python features some significant updates to the language. Here are some of the most important ones.

async/await: Concurrency on Steroids

Python received some great new features in asyncio, its concurrency library. It also introduced two new keywords async and await which makes it easier to run functions asynchronously.

You first need to declare a coroutine using async keyword. Then, calling such coroutine is done by prefixing the call with await.

Here is an example of how to run concurrently two tasks:

import asyncio

async def my_coroutine():
  await asyncio.sleep(2)

async def main():
  task1 = asyncio.create_task(my_coroutine())
  task2 = asyncio.create_task(my_coroutine())

  await task1
  await task2

The new context variables feature is also here to improve concurrency in Python. This concept is similar to thread-local storage, but it also allows to correctly keep track of values per asynchronous task.

import contextvars
import asyncio

counter = contextvars.ContextVar("counter", default="0")

async def set_one():

async def print_counter():
  print(counter.get()) # Set the value of counter to 1 in a given context # Prints "0" as it is executed in a different context

breakpoint: Ease the Developer's Life

Python 3.7 introduces the new breakpoint which only aims to simplify the developer's life. Simply calling breakpoint() opens the debugger at the call site.

It may look like a small changes, but after a few days of using it, you will be convinced of the usefulness of this update!

Data Classes

Python 3.7 introduces a new dataclass decorator which aims at simplifying the writing of data class. A data class describes its attributes using class variable annotations. All the magic methods are then automatically generated:

class Point:
    x: float
    y: float
    z: float = 0.0

p = Point(1.5, 2.5)
print(p)   # produces "Point(x=1.5, y=2.5, z=0.0)"

Performance Improvements

Another great improvement of this release is about performance. The Python team worked hard to improve overall performances of Python program in various area. These improvements range from reducing the startup time of Python (10% reduction on Linux!) to rewriting many methods with performance in mind. The overhead of calling a single method has been reduced by up to 20% thanks to some byte code changes, and calling a method is probably something you do in your Python program!

Much More Things

Much more new wonderful things were released in this version such as the order of dictionaries which is now preserved, better handling of the DeprecationWarning, and a new development runtime mode… Read the full blog post and changelog for a comprehensive list of novelties.

Photo by Markéta Marcellová on Unsplash

Share the article
Étienne Michon
Étienne Michon
Étienne Michon is one of the first employee at Scalingo. With a PhD in computer science Étienne takes care of Research and Development at Scalingo. He also regularly contributes to this blog with technical articles.
#Python - #buildpack

Try Scalingo for free

30 days free trial / No credit card required / Hosted in Europe