Python 3.7 Release, Security Gotchas, and New Web Frameworks
Overview of Python Developments
This episode of Python Bytes covers a diverse array of topics ranging from essential library management to the highly anticipated release of Python 3.7. Guest Nina Zakarenko joins Michael Kennedy and Brian Akin to discuss the evolving landscape of Python tooling and web development.
Packaging and Documentation
• The hosts discuss the challenges of maintaining documentation on PyPI. They recommend using REST View to preview long descriptions locally before publishing.
• A clever "hack" for updating documentation without triggering unnecessary package re-installs is the use of post-version numbers (e.g., 0.3.2.post1).
• They highlight the official Python Package Authority guide for properly using Test PyPI to verify builds before deployment.
Flask and Emerging Web Technologies
• The discussion spotlights the Flask Mega Tutorial by Miguel Grinberg as an essential resource for newcomers to bridge the gap between learning Python and building production-ready web applications.
• The team introduces Vibora, a high-performance, async-first web framework. Inspired by Flask, it leverages UVLoop to achieve impressive performance metrics, handling significantly higher requests per second in benchmarks.
Security Best Practices
• The hosts dive into an article by Anthony Shaw detailing common security pitfalls in Python:
"10 Common Security Gotches in Python and How to Avoid Them"
• Key takeaways include avoiding Pickle for serialization, preventing SQL Injection and Process Injection attacks, and being cautious about disabling assert statements in production environments, which can silently neutralize security checks.
Developer Workflow Tools
Pre-commit Hooks
• Using pre-commit tools allows teams to enforce coding standards automatically. The guests discuss leveraging these hooks to prevent common mistakes, such as accidentally committing debugger statements (PDB) or failing to adhere to team-wide linting and line-length rules.
Python 3.7 Features
• The release of Python 3.7 brings native support for the breakpoint() function, which provides a more robust and flexible way to interface with debuggers like IPDB compared to manual trace calls.