Daniel Wallace

I began using learning python by solving problems on projecteuler.net, then automating the busy work I had while being a Linux Administrator for Rackspace.

I have also worked on SaltStack, as an open source contributor and employee.

Now I work for AutoDesk on the Plangrid Product.

Speaker home page

Plugins: using importlib to build self describing apis

Python & Libraries, Web, IoT, & Hardware, Advanced
8/17/2019 | 4:40 PM-5:10 PM | Fisher West

Description

Api's all have a defined structure, they sometimes almost look like a file tree of actions. Use that similarity + a plugin system to model and organize your api.

Abstract

Discuss some the basics of using importlib being able to point to a file and import it even if it isn't a .py file Being able to walk a file directory tree and import files in sys.modules.

Demonstrate how we are using importlib in some new api endpoints at plangrid to abstract and automate some of the more tedious stuff in Flask. Import modules using importlib and create new classes for each class that's name ends with Handler, and register them in the flask app. Import a whole directory and register all functions that begin with task_ as a celery task for the api to call.

Show a more robust system for building plugins using a hub demonstrate a way to just load everything in your codebase into one plugin system make everything that was loaded available in a singleton that can be passed and used anywhere.