etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
577 stars 193 forks source link

Default location for compiled MIBs should use $XDG_CACHE_HOME #368

Open srenfo opened 4 years ago

srenfo commented 4 years ago

The XDG specs define a more appropriate location for compiled MIBs than the current default of ~/.pysnmp/mibs/:

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

On Linux this usually just means that

~/.pysnmp/mibs/

becomes

~/.cache/pysnmp/mibs/

Many other tools like pip, pre-commit or black already use that location.

For Python the appdirs library handles the default and Mac OS X/Windows compatibility.

>>> from appdirs import user_cache_dir
>>> user_cache_dir("pysnmp")
'/home/user/.cache/pysnmp'

I'm willing to try my hand at a PR if you tell me whether this is worthwhile.

lextm commented 6 months ago

Just noticed that you intended to send a pull request.

If you send to https://github.com/lextudio/pysnmp, my team is willing to review and accept it.