We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode #435 Stop with .folders in my ~/

#435 Stop with .folders in my ~/

2025/6/9
logo of podcast Python Bytes

Python Bytes

AI Deep Dive AI Chapters Transcript
People
B
Brian Ocken
M
Michael Kennedy
Topics
Michael Kennedy: 我一直对应用程序在用户目录下创建大量以点开头的配置文件感到不满,因为这些文件不应该直接暴露给用户。我之前推荐使用 appdirs 来管理这些文件,但现在 appdirs 已经过时了。现在我推荐使用 platformdirs,它不仅修复了 appdirs 的问题,还增加了许多新功能,例如支持更多的目录类型和更好的类型提示。我已经在一些项目中使用 platformdirs 取得了很好的效果,它让我的应用程序更加整洁。 Brian Ocken: 我通常只考虑在 Linux 环境下将文件存储在 home 目录下,但实际上很多应用程序都会在 home 目录下创建不必要的配置文件。我打算在我的应用程序中使用 platformdirs,因为它能更好地管理应用程序的数据目录。

Deep Dive

Chapters
This chapter discusses the importance of using appropriate platform-specific directories for application data and the transition from the deprecated appdirs to the improved platformdirs package. It highlights platformdirs' advantages, including better compatibility, typing, and a richer directory set.
  • Transition from deprecated appdirs to platformdirs
  • platformdirs offers better compatibility with new Python releases
  • platformdirs provides first-class typing and a richer set of directories
  • platformdirs uses pathlib and has extensive test coverage

Shownotes Transcript

Topics covered in this episode:

- [**platformdirs**](https://pypi.org/project/platformdirs/?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.

Michael #1: platformdirs)

  • A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".

  • Why the community moved on from appdirs to platformdirs

  • At AppDirs:

  • Note: This project has been officially deprecated. You may want to check out pypi.org/project/platformdirs/) which is a more active fork of appdirs. Thanks to everyone who has used appdirs. Shout out to ActiveState for the time they gave their employees to work on this over the years.

  • Better than AppDirs:

  • Works today, works tomorrow – new Python releases sometimes change low-level APIs (win32com, pathlib, Apple sandbox rules). platformdirs tracks those changes so your code keeps running.

  • First-class typing – no more types-appdirs stubs; editors autocomplete paths as Path objects.

  • Richer directory set – if you need a user’s Downloads folder or a per-session runtime dir, there’s a helper for it.

  • Cleaner internals – rewritten to use pathlib, caching, and extensive test coverage; all platforms are exercised in CI.

  • Community stewardship – the project lives in the PyPA orbit and gets security/compatibility patches quickly.

Brian #2: poethepoet) - **“**Poe the Poet is a batteries included task runner that works well with poetry or with uv.”

Michael #3: Python Pandas Ditches NumPy for Speedier PyArrow)

  • Pandas 3.0 will significantly boost performance by replacing NumPy with PyArrow as its default engine, enabling faster loading and reading of columnar data.

  • Recently talked with Reuven Lerner about this on Talk Python too).

  • In the next version, v3.0, PyArrow will be a required dependency), with pyarrow.string being the default type inferred for string data.

  • PyArrow is 10 times faster.

  • PyArrow) offers columnar storage), which eliminates all that computational back and forth that comes with NumPy.

  • PyArrow paves the way for running Pandas, by default, on Copy on Write) mode, which improves memory and performance usage.

Brian #4: pointblank: )Data validation made beautiful and powerful)

  • “With its … chainable API, you can … validate your data against comprehensive quality checks …”

Extras

Brian:

Michael:

Joke: Does your dog bite)?