We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode #414 Because we are not monsters

#414 Because we are not monsters

2024/12/16
logo of podcast Python Bytes

Python Bytes

AI Deep Dive AI Chapters Transcript
People
B
Brian
Python 开发者和播客主持人,专注于测试和软件开发教育。
M
Michael
帮助医生和高收入专业人士管理财务的金融教育者和播客主持人。
Topics
Brian: Jeff Tripplet 创建了一个名为 `django-cli-no-admin` 的项目,旨在将冗长的 `django-admin` 命令简化为更简洁的 `django` 命令,提升开发效率。这简化了常见的 Django 命令行操作,例如创建项目和应用等。虽然 Django 本身不会默认采用这种简化方式,但该项目为开发者提供了一种更便捷的替代方案。 Michael: Django Unicorn 是一个用于 Django 的反应式组件框架,它结合了服务器端渲染和客户端交互的优势。开发者可以使用它在 Django 模板中添加交互功能,而无需学习新的模板语言或使用复杂的 JavaScript 构建工具。它简化了前后端交互流程,并提升了开发效率。Django Unicorn 提供了诸如表单验证、重定向、脏状态检测、局部更新和轮询等功能,使开发者能够更轻松地构建动态和交互式 Web 应用。 Michael: Django Unicorn 旨在简化 Django 应用中的前端交互开发。它允许开发者在 Django 模板中直接使用类似 React 的组件化方式,而无需编写大量的 JavaScript 代码或使用复杂的构建工具。通过在模板中添加特殊的属性,开发者可以轻松地实现数据绑定、事件处理和 AJAX 请求等功能。这使得开发者可以专注于 Django 后端逻辑的开发,而无需深入了解前端技术细节。 Brian: Ned Batchelder 的文章探讨了多种测试字符串中是否只包含 0 或 1 的方法,并展示了如何使用 pytest 进行测试,文章中也介绍了 `cleandoc`、`partition` 等 Python 工具的使用方法。

Deep Dive

Chapters
Jeff Triplett created django-cli-no-admin to shorten the django-admin command to just django. This improvement enhances developer speed and comfort. The goal is for Django to eventually adopt this as the default.
  • Created django-cli-no-admin to shorten 'django-admin' command.
  • Improves developer speed and comfort.
  • Aims for Django to adopt it as the default.

Shownotes Transcript

Topics covered in this episode:

- **[New project to shorten django-admin to django because we are not monsters](https://micro.webology.dev/2024/12/14/new-project-to.html?featured_on=pythonbytes))**

Watch on YouTube)

About the show

Sponsored by us! Support our work through:

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live) to be part of the audience. Usually Monday at 10am PT. Older video versions available there too.

Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list), we'll never share it.

Brian #1: New project to shorten django-admin to django because we are not monsters)

  • Jeff Tripplet has created django-cli-no-admin) to shorten django-admin to just django.

  • “One of the biggest mysteries in Django is why I have to run django-admin from my terminal instead of just running django. Confusingly, django-admin has nothing to do with Django’s admin app.”

  • Instead of typing things like: django-admin startproject mysite projectname

  • We can type the shorter: django startproject mysite projectname

  • I love this kind of developer speedup / comfort improvements

  • And yes, Jeff wants Django to eventually include this as the default way to run the command line utilities.

Michael #2: django-unicorn): The magical reactive component framework for Django sparkles

  • Add modern site functionality: Quickly add in simple interactions to regular Django templates without learning a new templating language.

  • Skip the JavaScript build tools

  • No API required: Skip creating a bunch of serializers and just use Django.

Brian #3: Testing some tidbits)

  • Ned Batchelder

  • Different ways to test to see if a string has only 0 or 1 in it.

  • And also, a way to check all the different ways to make sure they work.

  • Fun post, and I learned about

  • cleandoc - a way to strip leading blank space and maintain code block indentation

  • I usually use textwrap.dedent()

  • partition - splitting strings based on a substring

  • Using | to pass imports to eval() - I don't use eval much.

  • However, no pytest!

  • Here’s a way to check all this with pytest:

  • Testing some tidbits with pytest)

Michael #4: The State of Python 2024 article)

  • Python usage with other languages drops as general adoption grows

  • 41% of Python developers have under 2 years of experience

  • Python learning expands through diverse channels

  • The Python 2 vs. 3 divide is in the distant past

  • Flask, Django, and FastAPI remain top Python web frameworks

  • Most Python web apps run on hyperscale clouds

  • Containers over VMs over hardware

  • uv takes Python packaging by storm

Extras

Brian:

Michael:

Joke: