Skip to content

fix: replace deprecated vendored appdirs with platformdirs#447

Open
fuleinist wants to merge 1 commit into
joerick:mainfrom
fuleinist:fix/replace-deprecated-appdirs
Open

fix: replace deprecated vendored appdirs with platformdirs#447
fuleinist wants to merge 1 commit into
joerick:mainfrom
fuleinist:fix/replace-deprecated-appdirs

Conversation

@fuleinist

Copy link
Copy Markdown

Summary

The vendored appdirs module (ActiveState/appdirs) has been officially deprecated. This PR replaces it with the maintained platformdirs package (platformdirs/platformdirs), which is the recommended replacement per the appdirs project's own README.

Changes

  • Removed pyinstrument/vendor/appdirs.py (vendored copy, 605 lines)
  • Replaced appdirs.user_data_dir() call with platformdirs.user_data_dir() in pyinstrument/__main__.py
  • Added platformdirs to install_requires in setup.py

Verification

  • platformdirs.user_data_dir("pyinstrument", "com.github.joerick") returns the correct path (~/.local/share/pyinstrument on Linux, ~/Library/Application Support/pyinstrument on macOS, C:\Users\<user>\AppData\Local\com.github.joerick\pyinstrument on Windows)
  • All 56 existing unit tests pass (5 skipped due to optional dependencies)
  • The report_dir() function works correctly end-to-end

API compatibility

platformdirs.user_data_dir(appname, appauthor) matches the appdirs.user_data_dir(appname, appauthor) signature exactly, so this is a drop-in replacement with no behavioral change for end users.

Fixes #279

The vendored appdirs module (ActiveState/appdirs) has been officially
deprecated. This commit replaces it with the maintained platformdirs
package (platformdirs/platformdirs), which is the recommended
replacement.

Changes:
- Remove vendored pyinstrument/vendor/appdirs.py
- Replace appdirs.user_data_dir() call with platformdirs.user_data_dir()
- Add platformdirs to install_requires in setup.py

Closes joerick#279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replace deprecated appdirs with platformdirs

1 participant