Live Chat

We'll need to share your messages (and your email address if you're logged in) with our live chat provider, Drift. Here's their privacy policy.

If you don't want to do this, you can email us instead at contact@anvil.works.

Blog

Stories from the Workshop #2: Lightning AI
1st of July, 2019

Listen to this audio episode:

Download MP3 Subscribe via iTunes

Colette Nataf, founder of Lightning AI

How does a data scientist without web development experience launch a startup? I spoke to Colette Nataf, founder of Lightning AI.

Colette took a roundabout route into entrepreneurship, starting out as a mathematician, then a marketer and a data scientist. But the hardest step of launching a product turned out not to be finding customers, or even the complex statistics of automatic A/B testing – it was getting it onto the web!

Stories from the Workshop: The Anvil podcast

People use Anvil for amazing things. We’re constantly surprised by the variety, and the more we talk to people using Anvil, the more we learn! So we’ve decided to start recording some conversations with Anvil users: We’re calling them Stories from the Workshop.

Subscribe via iTunes, TuneIn, or via our RSS feed.

Raspberry Pi 4: Finally Fast Enough for a Web IDE
24th June 2019

The $35 Computer is All Grown Up

I woke up this morning to a delightful surprise – the Raspberry Pi 4 has launched, nearly a year ahead of schedule! It’s a massive upgrade on previous versions of the Pi, with a much beefier ARM processor – from the relatively simple in-order A53 on 40nm silicon, to the superscalar A72 at 28nm, giving 2x-4x speedups, depending on the benchmark. Raspberry Pi are claiming “desktop-like” performance, so I had to find out – is it fast enough to use as a web development platform?

These days, a lot of popular development tools are built on web technology. Anvil is no exception – it’s an environment for developing full-stack web apps with nothing but Python, and it’s all in the browser. It’s got a drag-and-drop UI designer, a Python code editor with code completion… it’s a great test for whether the Pi is ready to use as a dev platform.

We’re based in Cambridge, home of Raspberry Pi, so I cycled by their shop on my way to work and tried it out. I am pleased to report that the Anvil code editor runs delightfully on the Pi, even with only 1GB of RAM. I, um, may have got a bit excited…


Building a live data logger and viewer

Of course, I had to buy onetwo, and see what I could do with them. It’s a pretty muggy day for England, so I bought a SenseHAT and decided to graph the humidity in our office.

Here’s my app, developed entirely on the Pi. I built the UI in Python with Anvil, and the data is being recorded into Anvil’s Data Tables by an Uplink script. Take a look:

Here’s the source code for that web app:

Open source code

And here’s the script I’m running on the Pi to record the data:

import anvil.server
from anvil.tables import app_tables
from sense_hat import SenseHat
from datetime import datetime
import time

sense = SenseHat()

anvil.server.connect("[INSERT UPLINK KEY HERE]")

while True:
    app_tables.light_levels.add_row(
        when=datetime.now(),
        pressure=sense.get_pressure(),
        humidity=sense.get_humidity()
    )
    time.sleep(1)

Want your own? Of course you do! Go buy a Raspberry Pi 4!

New: Easier Integration with Microsoft Services
13th June 2019

Connecting Anvil apps to Azure AD

Anvil now has built-in integration with Microsoft Azure Active Directory, for all Business Plan users.

You can allow users to sign into your app with their work, school or personal Microsoft account with a single line of code:

anvil.microsoft.auth.login()

If you’re using Anvil’s Users Service for login, you can just check a box - no new code required!

Sign-in methods supported by the Users Service: Email&Password, Google, Facebook, Microsoft Azure, Local Active Directory, Client Certificates (PKI).

You can link your Anvil app more tightly with your Azure or Office 365 subscription, by connecting it with your Azure Active Directory tenant. This lets you build apps that use the Microsoft Graph APIs to interact with Office 365 and other Microsoft services.

You can also restrict your app to only accept, for example, users from your organisation.

Restrict which accounts can log in

If your organization uses Azure Active Directory to manage user accounts, it’s really easy to limit your app to users within your organization:

Radio button list from Azure AD Portal showing the account types you can restrict auth to (your org, all orgs, all MS accounts).

Here’s a step-by-step guide to setting up the Azure Portal to talk to Anvil.

Access Microsoft APIs from Anvil

Microsoft has a whole universe of APIs, allowing you to do anything from automating emails in Outlook to driving Excel spreadsheets.

You can get an access token like so:

token = anvil.microsoft.auth.get_user_access_token()

and use it in an HTTP request to access a Microsoft API:

me = anvil.http.request('https://graph.microsoft.com/v1.0/me',
                        headers={'Authorization': 'Bearer ' + token}, json=True)
print(me)

That’s a request to get everything Microsoft knows about me - not much, fortunately!

{'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users/$entity',
 'businessPhones': [],
 'displayName': 'anviltest123@gmail.com',
 'givenName': 'anviltest123@gmail.com',
 'id': 'eeecf79b-ae39-48d3-8c6b-670f8d6a8f59',
 'jobTitle': None,
 'mail': None,
 'mobilePhone': None,
 'officeLocation': None,
 'preferredLanguage': None,
 'surname': 'anviltest123',
 'userPrincipalName': 'anviltest123_gmail.com#EXT#@anvil123.onmicrosoft.com'}

Read the tutorial to learn more

To learn exactly how to use Anvil’s Microsoft integration, follow the tutorial:

  Read the tutorial


Python in the browser: How does it work?
4th June 2019

What powers Anvil?

Our mission is to bring sanity to web app development. Anvil lets you build web apps with nothing but Python – and this means running Python in the browser as well as on the server.

This lets us replace the many technologies of the Web stack with something more coherent:

Two diagrams of the web stack, how it is now with a disjointed set of technologies, and how it is in Anvil with everything in Python and connected by function calls

There are several implementations of Python that run in the web browser, and Yasoob invited me to survey some of them for Python Tips.

I compare Skulpt, Brython, PyIodide, Transcrypt, PyPy.js and Batavia. I then talk about why we chose Skulpt to build Anvil – and why it’s not enough simply to replace Javascript with Python.

For the full story, read the article on the Python Tips blog:

Read the article
Want to know more?

Running Python in the browser is only part of what makes Anvil so powerful. To see the rest – including drag-and-drop user interfaces, built-in databases, and tight integration between client and server code – check out our introductory tutorial:

Introduction to Anvil

Stories from the Workshop #1: Telemix
20th of May, 2019

Listen to this audio episode:

Download MP3 Subscribe via iTunes
Introducing our new audio series

People use Anvil for amazing things. We’re constantly surprised by the variety, and the more we talk to people using Anvil, the more we learn! So we’ve decided to start recording some conversations with Anvil users: We’re calling them Stories from the Workshop.

In this series, we’ll be hearing everyone from data scientists to startup founders, and – in this case – telecomms experts.

Episode 1: David Wylie, Founder of Telemix

Have you ever wondered how TV phone-in numbers actually work? Or how ingenious telephone fraud really is? We asked David Wylie. David has worked in telecoms for his entire career, from the early days of digital telephony, through mobile phone ringtones, premium SMS, and more. He founded and runs Telemix, a number broker and hosted telephony supplier.

Meredydd sat down with David to hear some stories from a career in telecoms, learn how Telemix helps governments protect against international dialling fraud, and talk about how Telemix uses Anvil to build and deploy their applications.

Learn More

Get the best out of Anvil with our free email course.