Description
Currently, the package hardcodes its data directory to the root of the user's home directory:
DPATH = os.path.join(os.path.expanduser("~"), ".arc-data")
While this works, it clutters the user's home directory and ignores operating system standards for storing application data (e.g., the XDG Base Directory Specification on Linux, AppData on Windows, and Library/Application Support on macOS).
Proposed Solution
It would be great if the package could adopt cross-platform directory standards. There are two common ways to handle this in Python:
1. Use the platformdirs library
platformdirs is a tiny, widely adopted standard for this (and is used by tools like pip, black, and pylint).
from platformdirs import user_data_dir
import os
# Resolves to ~/.local/share/arc on Linux, AppData\Local\arc on Windows, etc.
DPATH = user_data_dir("arc")
os.makedirs(DPATH, exist_ok=True)
2. Add an environment variable override
If adding a dependency isn't an option, allowing users to override the path via an environment variable (while falling back to XDG_DATA_HOME on Linux) would be a great lightweight alternative:
import os
def get_data_dir():
# 1. Allow explicit override
if override := os.environ.get("ARC_DATA_DIR"):
return override
# 2. Respect XDG on Linux/macOS if set
if xdg_data := os.environ.get("XDG_DATA_HOME"):
return os.path.join(xdg_data, "arc")
# 3. Fallback to current behavior
return os.path.join(os.path.expanduser("~"), ".arc-data")
DPATH = get_data_dir()
Let me know if you would be open to one of these approaches and I'll make a PR
Description
Currently, the package hardcodes its data directory to the root of the user's home directory:
While this works, it clutters the user's home directory and ignores operating system standards for storing application data (e.g., the XDG Base Directory Specification on Linux,
AppDataon Windows, andLibrary/Application Supporton macOS).Proposed Solution
It would be great if the package could adopt cross-platform directory standards. There are two common ways to handle this in Python:
1. Use the
platformdirslibraryplatformdirsis a tiny, widely adopted standard for this (and is used by tools likepip,black, andpylint).2. Add an environment variable override
If adding a dependency isn't an option, allowing users to override the path via an environment variable (while falling back to
XDG_DATA_HOMEon Linux) would be a great lightweight alternative:Let me know if you would be open to one of these approaches and I'll make a PR