#227 No more awaiting, async comes to SQLAlchemy
Python Bytes - A podcast by Michael Kennedy and Brian Okken - Lunedì
Categorie:
Watch the live stream: Watch on YouTube About the show Sponsored by us! Special guest: Micaela Reyes Brian #1: Number One, that's "retract plank," not "remove plank." Yanking vs removing versions on PyPI https://twitter.com/nedbat/status/1376901333958201352?s=20 https://pypi.org/help/#yanked see also https://doughellmann.com/posts/so-youve-released-a-broken-package-to-pypi-what-do-you-do-now/ Michael #2: SQLAlchemy 1.4.0 Released Exciting: 1st release to properly support an async API Has a new select() + execute() rather than session.query() API Intended to unify Core and ORM. See new vs. old API compared. Requires aiosqlite for async API + SQLite: conn_str = 'sqlite+aiosqlite:///filename' Micaela #3: django-tenants by Tom Turner Multi-tenancy Implementation for Django (typically for SaaS websites e.g. Shopify) currently on v3.2.1 (Aug 2020) release Requirements: Django 2 and PostgreSQL It was largely based on django-tenant-schemas library Data Architecture: shared database, separate schema for each tenant Domain setup / URL routing for root and per tenant: Examples: http://my-domain.com:8000/ http://tenant.my-domain.com:8000/ http://tenant2.my-domain.com:8000/ Possible Use-cases: a hospital with different branches restaurant franchise with different branches Possible Limitations: You can’t use the normal migration commands (python manage.py migrate_schemas instead of python manage.py migrate) Reports - when you need to create a report regarding all the clients/tenants, tenant data will be on separate schemas see also: How to get Django Tenants up and Running Brian #5: pre-commit ci pre-commit is “a framework for managing and maintaining multi-language pre-commit hooks.” Hooks can be run during commits, but also hooked other events, such as merge, push, after switching branches, etc. Even if you run pre-commit yourself, it’d be nice to make sure all hooks are run by people submitting pull requests. pre-commit ci *is a service that “enforces that these issues are discovered (which is opt-in for each developer's workflow via *pre-commit) but also fixes the issues automatically, letting developers focus their time on more valuable problems.” Michael #4: Snyk (Python) Package Advisor via David Smit Provides package health score, built up from Popularity Maintenance Security Community Code of conduct and related metrics Number of releases, commits, maintainers, age, etc. Lots of nice graphs and ways you can contribute Micaela #6: PyWebIO by Wang Weimin Allows you build simple web applications or browser-based GUI applications without the need to write HTML and JavaScript. Has input and output modules Based on tornado Possible Use-cases: Hobby projects - for people who know how to write Python code but want to do away with JavaScript Could be a good teaching tool - ex. if you’re teaching kids or beginners and you want to make them appreciate the concept of input and output Possible Limitation: once you need to style your HTML, it might be a bit difficult to do so since it’s tightly coupled with the Python code Extras Michael absolufy-imports by Marco Gorelli Anthony Shaw actually made a Beanie Baby in the terminal within a day of the last episode! PHP supply chain hack Brian packages: pytest-yuk, pytest-srcpaths, pytest-check Micaela Last day of March membership drive for the PSF https://twitter.com/ThePSF/status/1377000184375296003 Joke: Commenting your code