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 - Page 3

Anvil News - September
26th of September 2018

Meetups, Security, Data Grids, and More

Do you attend a coding, Python or data-science meetup? Would you like Anvil to come and present there? We’re presenting at meetups across the UK, and events all over the world (including remote presentations). If you want us to stop by your event or user group, send an email to events@anvil.works and let us know!

Meanwhile, here’s what’s new in Anvil this month:

Data Grids

Of course, this month’s big news is the release of Data Grids. It’s our most-requested feature, and a massive help to anyone working with tabular data. Check out our announcement and the Getting Started tutorial.

Enforcing secure passwords for your users

Password security is more important than ever. That’s why we’ve just introduced the “Require Secure Passwords” option in Anvil’s user authentication service.

When you select “Require Secure Passwords”, Anvil prevents your users from re-using a password that’s too short, or has already been leaked in a data breach. We can check for data breaches without revealing passwords to anyone, thanks to the k-anonymity feature from Have I Been Pwned. You can learn more about how it works in this blog post from Cloudflare.

“Require Secure Passwords” is enabled by default for all new apps, and you should turn it on for your existing apps too!

Tooltips

Another much-requested feature: Now, almost every component has a tooltip property. Set it to display some extra text when you hover your mouse over the component!

On-Site Installation

Did you know that you can install Anvil on your own servers? You can now get an on-site trial instance running in 10 minutes or less, easier than ever before! To learn more about running Anvil on your corporate network, or on your own cloud servers, contact us at enterprise@anvil.works.


That’s it for this month. If you’ve got any questions, come and ask us on the Anvil user forum.

Happy coding!

Announcing Data Grids
12th of September 2018

Create interactive tables with minimal effort

If you’re writing a web app, chances are you’ll have data in tables. And at some point you’ll probably want to show your users a table of data they can page through.

Doing that in Anvil just got even easier. By popular demand, and without further ado:

Introducing the DataGrid component

Data Grids are an easy way to show data that naturally fits into rows and columns. With built-in support for paging, they can handle large numbers of rows while remaining performant.

Data Grids can be populated from any source. It’s easy to link them up to your Data Tables:

self.repeating_panel_1.items = app_tables.employees.search()

or you could set up some tabulated data yourself:

    self.repeating_panel_1.items = [
      {'ingredient': 'Flour', 'weight': 225, 'cost': 150},
      {'ingredient': 'Milk', 'weight': 150, 'cost': 100},
      {'ingredient': 'Eggs', 'weight': 175, 'cost': 80},
      {'ingredient': 'Butter', 'weight': 175, 'cost': 250},
      {'ingredient': 'Maple Syrup', 'weight': 250, 'cost': 300},
    ]

All of this is covered in our first Data Grid tutorial: Getting Started with Data Grids.


You can also get more advanced. For example, you can nest components inside rows of a data grid to group related data together (as described in our tutorial, Paginated Grouping with Data Grids):


You can create custom widgets that control the behaviour of the Data Grid itself. You can read how to create a search box, an add button, or a page number selector:

Data Grids are only limited by your imagination. Anything you can put together out of Anvil components, you can add to a Data Grid row. And because this is Anvil, you can write Python code to assemble Data Grids and make them behave however you like.

In the example above, we’ve built a full CRUD app in a single component! We’ve got data from a Data Table, displayed in a Data Grid, with a search box, page size selector, and widgets to add, edit, and delete rows.

Click the link to open it in the Anvil editor and have a play:

  Clone Example App


To find out more, take a look at our Data Grid tutorials:

  Read the tutorials

Anvil News - August
22nd of August 2018

SQL, T-Shirts, Embedding and more…

Are you going to PyCon UK in Cardiff next month? We’ll be there, showing people how to build full-stack web apps with nothing but Python, at our stall in the Great Hall. As always, we’ll give out a nifty Anvil T-shirt to anyone who builds an app with Anvil during the conference.

This time around, we used SciPy and Anvil to work out how many T-shirts we need to bring. The answer involved a little stats, a little SciPy, and a whole lot of Python, so I wrote it up as a blog post. Check it out: How Many T-shirts Do I Need for a Developer Conference?

Meanwhile, here’s what’s new in Anvil this month:

1. Get the Best out of Material Design

We’ve published a guide to making your apps look their best with Anvil’s Material Design theme. Change your colour palette, build a sidebar menu, or use custom CSS to control your app’s appearance.

Click here to read the guide

2. Direct SQL access to data tables

Anvil’s internal database is powered by Postgres. Now, if you’re a Dedicated Server user, you can connect directly to it and write queries with SQL! Look for the check-box in the Data Table configuration:

3. Embed your Anvil apps in other websites

We’ve made it easier to embed Anvil apps in other websites. When you open the Publish dialog, you now get a checkbox for “Embed this app in” a web page”. Enable it, then copy and paste the HTML snippet into any website to include your Anvil app there!

4. The Free Plan is bigger and better!

It’s great to see what hobby users, prototypers, educators and students have been doing with Anvil. We’ve made Anvil even better for them, by enabling more of our advanced features - like the Uplink and the Users service - on the Free plan. Check it out!

(You’ll still need to upgrade for a full Python server environment, to remove the Anvil banners, or to use your own domain name, though.)

5. Other Updates

As always, we’re making Anvil better all the time. Here are a few things you might have missed:

  • We’ve added a few more example apps to our examples page - including the time we built prototypes of two Silicon Valley startups in a couple of hours each!

  • We’ve made it easier to lay things out in our drag-and-drop designer. Look out for the dotted lines to see which container you’re dropping a container in.

  • If you’re storing encrypted App Secrets in your Anvil app, you can now enter longer, multi-line strings. (Great for private SSH keys!)

  • The modules for our Google and Facebook integrations have moved - they’re now anvil.google and anvil.facebook. Don’t worry, your existing apps still work!

  • Your apps now load a little faster :)

Happy coding!

Using SciPy to Work Out How Many T-Shirts I Need for a Conference
8th of August 2018

How many T-Shirts do I take to PyCon?

When you’re marketing to developers, you go where the developers are. We make a platform for building full-stack web apps with nothing but Python, so we go to developer conferences – particularly Python ones.

Like many sponsors, we give out nifty Anvil-branded T-shirts. But there’s a twist: in order to earn a T-shirt, you’ve got to build something with Anvil. So far, it’s gone pretty well - here’s what it looked like at EuroPython last week:

Now we’re home, and preparing for PyCon UK in September, it’s time to order more shirts. The trouble is, developers come in all shapes and sizes, and the first time we ordered we were way off the mark. (Apologies to the huge number of people who wanted a Women’s Small!)

This time, we can be smarter. We’re a bootstrapped company, so we can’t just blow VC cash on unnecessary mountains of shirts – but we do want every Anvil user to go home with a T-shirt.

How can we use this data to work out how many shirts we need?

Option 1: Exact numbers.

“If last conference used 13 Men’s Medium shirts, we should bring exactly 13 to the next conference.”

This is obviously a bad idea. If even one more medium-sized man writes an app with Anvil, we’re going to run out of shirts. And feel pretty stupid about it, too.

Option 2: Double up

OK, fine, so let’s order 200% of what we expect to need. This will cause us to order 4 rather than 2 Women’s XS (probably sensible)…and 54 rather than 27 Men’s Large (not so much!). That 54th Men’s Large shirt is much less likely to be claimed than the 4th Women’s XS shirt is. It’s the law of large numbers: Larger samples average out more reliably.

Wait. I’m sure there’s a more helpful way of thinking about this than waving my hands and saying “law of large numbers”. Can we capture this insight in a statistical model?

Option 3: Be a bit smarter

Let’s imagine that every person who comes to the conference is a dice-roll. Some percentage of the time, they build an Anvil app and claim their T-shirt. What size they want is also a dice-roll: X% of the time they want a women’s Medium; Y% of the time they want a men’s Small; and so on. We can estimate how big X and Y are, because we know how many shirts we gave out at PyCon US and EuroPython, and we know how many attendees were at those conferences.

Next month, we’re sponsoring PyCon UK, with 700 attendees. How many men’s Medium-size shirts will we need? We can simulate it by rolling that die 700 times, and counting how many times it comes up “men’s Medium”.

Of course, each time we do that “roll 700 dice” procedure, we could get a different total count. This total follows a binomial distribution:

Here I’ve plotted two binomial distributions, using Anvil’s plotting tools. On the left, we’re expecting to give away about 2 shirts, but we could easily need twice that number. On the right, we’re expecting 35, but we’re unlikely to need more than 40 – we’re much more certain with larger numbers. This is the insight we had before – but now we’ve got a model, we can quantify it!

We can wrangle binomial distributions easily with SciPy. We’ll use SciPy’s ppf function to get the 95th centile of this distribution: If our model is correct, there’s a 95% probability we won’t need more shirts than this.

Let’s compute that number:

  from scipy.stats import binom
  # From 1500 attendees, we gave away 13 men’s Medium shirts
  p_mens_medium = 13 / 1500
  # For 700 attendees, there’s a 95% chance we will need no
  # more than this many men's Medium shirts:
  n_shirts_p95 = binom.ppf(0.95, 700, p_mens_medium)
  print(n_shirts_p95)
=> 10.0

So we need to take 10 men’s Medium-size shirts to Cardiff!

Building a T-shirt calculator

Now we have some Python code, we can put a web interface on it really quickly with Anvil. I built a T-shirt calculator that can do this calculation for many sizes of shirt at once. You can use it below, or open the source code in Anvil to see how it works:

Open source code

Feel free to use and share this app. And if you’re going to a developer conference soon, perhaps we’ll see you there!

Anvil News - July
24th of July 2018

It was great meeting everyone at EuroPython! Next up: PyCon UK in Cardiff. Join us there, where we’ll be showing everyone how to build full-stack web apps with nothing but Python!

Meanwhile, here’s what’s new this month:

1. Single Sign-On with Microsoft

Does your organisation use Office 365? Now your users can log into your apps with their Microsoft accounts! Microsoft login (or, to give it its official name, Azure Active Directory) is available for all our Business plan customers.

Click here to read more.

2. Building Email-Driven Apps with Anvil

We’ve already made it easy to build web-based apps. Now it’s just as easy to send and receive email from your code, with our new Email Service.

Check out the code samples, or watch our demo video to see me build an email-receiving app in just a couple of minutes.

3. New Documentation Search

We’ve made it easier than ever to search the Anvil documentation. Next time you’re in the Anvil editor, check out the search box in the toolbar. You can search our tutorials, reference documentation, and selected posts from the Community Forum.

(Speaking of the Community Forum, we’d love to hear your feedback. Come join us there!)

4. Other updates

As always, we’re improving Anvil all the time. Here are a few highlights:

  • Validating user input just got a lot easier, with our new form validation library. Check it out!

  • We’ve introduced a new domain for your apps: Now, by default, your apps are available at <something>.anvil.app. (Don’t worry, the old <something>.anvilapp.net links still work!)

  • We had an idea for improving the saving mechanism, so if you’re on a flaky internet connection saving should feel instant.

Happy building!

Meredydd

Learn More

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