beeware/toga

Audit for a possible convergence on using `platformdirs` for app paths

开放

#4,666 创建于 2026年8月18日

 (5 条评论) (0 个反应) (0 位负责人)Python (624 个派生)batch import
enhancementgood first issue

仓库指标

星标
 (3,615 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

What is the problem or limitation you are having?

#4645 introduced the use of platformdirs as the basis for accessing app and user paths on Linux-based apps (including Linux deployments of Textual-based apps). This allows us to lean on platformdirs as an implementation of XDG and other platform-specific mechanisms for finding app-related paths.

platformdirs also has support for macOS, Windows and Android. We should be making better use of the platformdirs implementation, rather than duplicating the implementation.

Describe the solution you'd like

We should use platformdirs as the basis for macOS (Cocoa) and Windows (Winforms) implementation of app paths.

The complication is that these backends already have existing implementations for platform paths, and there are known discrepancies between the paths returned by platformdirs, and the paths returned by the existing backend implementations.

On each backend, and each of the paths supported by platformdirs, we need to know:

  1. The path/path scheme that platformdirs returns
  2. The path/path scheme currently returned by the Toga backend
  3. Which is correct based on platform standards? If it's a matter of "taste" rather than a strict platform standard, that should be made clear in the analysis
  4. Is there a plausible migration scheme from Toga's current path usage to a platformdirs-based implementation?

The ultimate "completion" of this task is not any code - it is purely a design decision on how to proceed further - this will be either:

  1. Abandon the idea
  2. Progress forward, with a clear plan for migration or backwards incompatibilities that will be accepted.

Describe alternatives you've considered

Status quo - keep a duplication of platform dirs.

Additional context

Platformdirs also contains support for Android, but using pyjnius, so it isn't compatible with Toga. It doesn't have support for iOS.

Ideally, we'd get Toga-compatible support upstream in platformdirs, and use that as the basis for migrating the iOS and Android backends to use platformdirs.

贡献者指南