Sponsored by Datadog: pythonbytes.fm/datadog
Michael #1: Data driven journalism via cjworkbench
- via Michael Paholski
- The data journalism platform with built in training
- Think spreadsheet + ETL automation
- Designed around modular tools for data processing -- table in, table out -- with no code required
- Features include:
- Modules to scrape, clean, analyze and visualize data
- An integrated data journalism training program
- Connect to Google Drive, Twitter, and API endpoints.
- Every action is recorded, so all workflows are repeatable and transparent
- All data is live and versioned, and you can monitor for changes.
- Write custom modules in Python and add them to the module library
Brian #2: remi: A Platform-independent Python GUI library for your applications.
- Python REMote Interface library.
- “Remi is a GUI library for Python applications which transpiles an application's interface into HTML to be rendered in a web browser. This removes platform-specific dependencies and lets you easily develop cross-platform applications in Python!”
- No dependencies.
pip install git+https://github.com/dddomodossola/remi.git doesn’t install anything else.
- Yes. Another GUI in a web page, but for quick and dirty internal tools, this will be very usable.
- Basic app:
import remi.gui as gui
from remi import start, App
def __init__(self, *args):
container = gui.VBox(width=120, height=100)
self.lbl = gui.Label('Hello world!')
self.bt = gui.Button('Press me!')
def on_button_pressed(self, widget):
Michael #3: Typer
- Build great CLIs. Easy to code.
- Based on Python type hints.
- Typer is FastAPI's little sibling. And it's intended to be the FastAPI of CLIs.
- Just declare once the types of parameters (arguments and options) as function parameters.
- You do that with standard modern Python types.
- You don't have to learn a new syntax, the methods or classes of a specific library, etc.
- Based on Click
- Example (min version)
def main(name: str):
if __name__ == "__main__":
Brian #4: Effectively using Matplotlib
- Chris Moffitt
- “… I think I was a little premature in dismissing matplotlib. To be honest, I did not quite understand it and how to use it effectively in my workflow.”
- That very much sums up my relationship with matplotlib. But I’m ready to take another serious look at it.
- one reason for complexity is 2 interfaces
- MATLAB like state-based interface
- object based interface (use this)
- Learn the basic matplotlib terminology, specifically what is a
Figure and an
- Always use the object-oriented interface. Get in the habit of using it from the start of your analysis.
- Start your visualizations with basic pandas plotting.
- Use seaborn for the more complex statistical visualizations.
- Use matplotlib to customize the pandas or seaborn visualization.
- Runs through an example
- Describes figures and plots
- Includes a handy reference for customizing a plot.
- Related: StackOverflow answer that shows how to generate and embed a matplotlib image into a flask app without saving it to a file.
- Style it with pylustrator.readthedocs.io :)
Michael #5: Django Simple Task
django-simple-task runs background tasks in Django 3 without requiring other services and workers.
- It runs them in the same event loop as your ASGI application.
- Here’s a simple overview of how it works:
- On application start, a queue is created and a number of workers starts to listen to the queue
defer is called, a task(function or coroutine function) is added to the queue
- When a worker gets a task, it runs it or delegates it to a threadpool
- On application shutdown, it waits for tasks to finish before exiting ASGI server
- It is required to run Django with ASGI server.
from django_simple_task import defer
async def task2():
return HttpResponse(b"My View")
Brian #6: PyPI Stats at pypistats.org
- Simple interface. Pop in a package name and get the download stats.
- Example use: Why is my open source project now getting PRs and issues?
- I’ve got a few packages on PyPI, not updated much.
- cards and submark are mostly for demo purposes for teaching testing.
- pytest-check is a pytest plugin that allows multiple failures per test.
- I only hear about issues and PRs on one of these. So let’s look at traffic.
- cards: downloads day: 2 week: 24 month: 339
- submark: day: 5 week: 9 month: 61
- pytest-check: day: 976 week: 4,524 month: 19,636
- That totally explains why I need to start actually supporting pytest-check. Cool.
- Note: it’s still small.
Language essays comic