Anthony Corletti cloud computing. startups. music. etc.
Posts with the tag python:

Passwordless Logins in Python

Many internet services use OAuth and email based protocols for sending login links and tokens.

I think it’s a pretty slick way to log users in and reduces overhead for them by adding yet another credential to their password managers.

I hadn’t found a python implementation I liked so I decided to implement a login credential issuer in pure python that I could use to send login links to users, similar to a slack-like login flow.

It didn’t take much code to implement! I’ll walk you through it.

Read more ...

Dispatch Tables in Python

Writing multiple if-else statement clauses as a switch-style case can be a hassle to maintain, especially if you’re working with dynamic switches.

With no specific case or switch implementation in python’s standard library, I’ve liked using dispatch tables.

A dispatch table can be defined as a mapping of pointers to functions.

Let’s review a simple example.

Read more ...

Partial Derivatives & Recursive Descent

Writing partial derivatives is a great way to understand some of the underlying features of machine learning and neural network libraries.

In this post I’ll explain how partial derivates are a necessary building block in understanding machine learning and neural networks, and how to write some python code to help bring partial derivates and recursive descent to life!

Read more ...

Breezy ML with StreamLit

Building lightweight ML applications with python, pandas, streamlit, and scikit-learn is a breeze.

Let’s run through a simple example app to illustrate this.

Read more ...

Clean Rest API Error Messages with Python

A great practice in software development is clear error message communication.

Something like "An error occurred. Please try again later.", simply will not do because it’s simply easier to be explicit.

Our goal here would be to ensure that a consistent interface is communicated to our client applications regardless of request.

Tools and frameworks like Ruby-on-Rails make this really easy with it’s ActiveRecord implementation (Active record is literally a design pattern btw).

You’ll find that in most “fully featured” frameworks with ORMs like Rails, Django, Sails, etc, there is some sort of implementation that enables a clean interface for transmitting error messages, but often we don’t want to carry the bloat of these frameworks along.

Enter: types.

Read more ...