Contribute Media
A thank you to everyone who makes this possible: Read More

Plugins: using importlib to build self describing apis

Description

This talk was presented at PyBay2019 - 4th annual Bay Area Regional Python conference. See pybay.com for more details about PyBay and click SHOW MORE for more information about this talk.

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.

About the speaker 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.

Sponsor Acknowledgement This and other PyBay2019 videos are via the help of our media partner AlphaVoice (https://www.alphavoice.io/)!

#pybay #pybay2019 #python #python3 #gdb

Details

Improve this page