platformdirs

Determine platform-specific user directories for data, config, cache, and logs

Library
PyPI
v4.12.0
988 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
88 /100 Excellent
Development Activity 96
Maintenance 100
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 80
Code Quality 82
Innovation 60
Learning Curve 78

platformdirs (the maintained fork of the original appdirs) gives Python applications a single API for finding the correct OS-conventional directory for application data, configuration, cache, logs, and runtime files. It abstracts away the differences between macOS, Windows, Linux/Unix (including XDG Base Directory spec compliance), and Android, so applications don’t hardcode ~/.config or %APPDATA% paths themselves.

Beyond application-scoped directories, it also exposes standard user media folders (Documents, Downloads, Pictures, Desktop, and more) that aren’t tied to a specific app name. Every directory is available as both a string path and a pathlib.Path, via either a PlatformDirs object or standalone convenience functions.

What You Get

  • A PlatformDirs(appname, appauthor) class exposing user_data_dir, user_config_dir, user_cache_dir, user_state_dir, user_log_dir, and user_runtime_dir (plus site_* system-wide equivalents)
  • Both string-path (user_config_dir) and pathlib.Path (user_config_path) accessors for every directory kind
  • Standalone convenience functions (user_data_dir(), user_config_path(), etc.) for one-off lookups without instantiating a class
  • User media directory accessors — Documents, Downloads, Pictures, Videos, Music, Desktop, Templates, Fonts, and more — not scoped to an app name
  • Per-platform backends (unix.py, macos.py, windows.py, android.py) implementing XDG Base Directory spec on Linux, Apple conventions on macOS, and the Windows/Android equivalents

Common Use Cases

  • Storing a CLI tool’s config file in the OS-correct location instead of hardcoding ~/.config/myapp
  • Locating a safe, writable cache directory for downloaded assets or computed artifacts
  • Finding the right log directory per platform for a desktop or CLI application
  • Migrating from the unmaintained appdirs package to a drop-in, actively maintained replacement
  • Locating standard user folders (Downloads, Documents) for file-picker defaults in a cross-platform app

Under The Hood

Architecture: The public API in src/platformdirs/api.py defines an abstract base with all directory properties; unix.py, macos.py, windows.py, and android.py each provide a platform-specific subclass implementing those properties according to that OS’s conventions (XDG spec on Linux via _xdg.py, ~/Library/... on macOS, %APPDATA%/%LOCALAPPDATA% on Windows). __init__.py picks the correct backend at import time based on sys.platform and re-exports both the class and convenience functions.

Tech Stack: Pure Python with zero required runtime dependencies, supporting Python 3.9+. Packaged with a standard pyproject.toml/hatchling build, ships py.typed for full type-checker support, and publishes wheels plus an sdist to PyPI on every tagged release.

Code Quality: Each platform backend has a dedicated test module (tests/test_unix.py, test_macos.py, test_windows.py, test_android.py), plus test_api.py for the shared interface and test_comp_with_appdirs.py explicitly testing parity/behavioral differences against the legacy appdirs package it forked from. CI runs across all four backends and multiple Python versions via GitHub Actions.

API Design: The dual surface — a PlatformDirs class for apps that need many directories at once, plus flat convenience functions (user_data_dir(appname)) for one-off lookups — lets callers pick the ergonomics that fit their use case with zero required configuration beyond an app name.

Used by 13 apps in this directory

Python
100%
Apache 2.0

Agno

AI Development · Automation · Devops

42,358

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python 100%
Updated 4 days ago
Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
Python
68%
MIT

ArchiveBox

Bookmarks Archiving

28,636

Self-hosted web archiving that saves HTML, PDFs, screenshots, media, and code in open formats you own forever

View details
88
Repo Health
84
Technical
69
Dependency
Built with
Python 68%
HTML 25%
Updated 4 days ago
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,125

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
61
Dependency
Built with
Python 59%
Jupyter Notebook 21%
Updated 1 weeks ago
C++
68%
Apache 2.0

ClickHouse

Analytics · Data Engineering · Databases

50,116

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
64
Dependency
Built with
C++ 68%
Python 14%
Updated 4 days ago
C++
66%
MPL 2.0

Zen Browser

Browser

44,623

A Firefox-based browser that puts focus, privacy, and workflow front-and-centre without sacrificing compatibility

View details
88
Repo Health
81
Technical
80
Dependency
Built with
C++ 66%
JavaScript 15%
Fluent 14%
Updated 5 days ago
TypeScript
97%
Other

GrowthBook

Ab Testing Experimentation · Analytics · Developer Tools

8,446

Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.

View details
92
Repo Health
85
Technical
63
Dependency
Built with
TypeScript 97%
Updated 4 days ago
Python
100%
MIT

hyperresearch

AI Agents · Developer Tools · Knowledge Management

3,691

A tier-adaptive 16-step deep research pipeline for Claude Code that produces adversarially-audited reports with full source provenance, backed by a persistent, searchable vault.

View details
79
Repo Health
85
Technical
72
Dependency
Built with
Python 100%
Updated 1 weeks ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,319

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers