From 6c29c63e93f91a5b939511521b42da15d13b131f Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 3 Jul 2024 17:07:46 +1000 Subject: [PATCH] Switch from appdirs to platformdirs appdirs has been officially deprecated upstream, the replacement module with more features is platformdirs. --- CHANGES | 2 +- docs/advanced/performance.rst | 4 ++-- pint/facets/plain/registry.py | 5 ++--- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 53e5a5fc5..5385c4775 100644 --- a/CHANGES +++ b/CHANGES @@ -4,7 +4,7 @@ Pint Changelog 0.25 (unreleased) ----------------- -- Nothing added yet. +- Switch from appdirs to platformdirs. 0.24.1 (2024-06-24) diff --git a/docs/advanced/performance.rst b/docs/advanced/performance.rst index d7b8a0cd5..998cac681 100644 --- a/docs/advanced/performance.rst +++ b/docs/advanced/performance.rst @@ -120,7 +120,7 @@ If you want to use the default cache folder provided by the OS, use **:auto:** >>> import pint >>> ureg = pint.UnitRegistry(cache_folder=":auto:") # doctest: +SKIP -Pint use an included version of appdirs_ to obtain the correct folder, +Pint use an external dependency of platformdirs_ to obtain the correct folder, for example in macOS is `/Users//Library/Caches/pint` In any case, you can check the location of the cache folder. @@ -146,5 +146,5 @@ In any case, you can check the location of the cache folder. .. _`brentq method`: http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.brentq.html -.. _appdirs: https://pypi.org/project/appdirs/ +.. _platformdirs: https://pypi.org/project/platformdirs .. _flexcache: https://github.com/hgrecco/flexcache/ diff --git a/pint/facets/plain/registry.py b/pint/facets/plain/registry.py index 09fd220ee..8ecb19fa7 100644 --- a/pint/facets/plain/registry.py +++ b/pint/facets/plain/registry.py @@ -49,7 +49,7 @@ # from ..._typing import Quantity, Unit -import appdirs +import platformdirs from ... import pint_eval from ..._typing import ( @@ -233,8 +233,7 @@ def __init__( self._init_dynamic_classes() if cache_folder == ":auto:": - cache_folder = appdirs.user_cache_dir(appname="pint", appauthor=False) - cache_folder = pathlib.Path(cache_folder) + cache_folder = platformdirs.user_cache_path(appname="pint", appauthor=False) from ... import delegates # TODO: change thiss diff --git a/requirements.txt b/requirements.txt index 0bc99005a..5cd99e53b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -appdirs>=1.4.4 +platformdirs>=2.1.0 typing_extensions flexcache>=0.3 flexparser>=0.3