From 844bba7fac7e02209e6f7a1364a9f335b331c271 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 | 1 + docs/advanced/performance.rst | 4 ++-- pint/facets/plain/registry.py | 5 ++--- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index bfe99d479..4c8a444ff 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ Pint Changelog - Added mu and mc as alternatives for SI micro prefix - Added ℓ as alternative for liter - Support permille units and `‰` symbol (PR #2033, Issue #1963) +- 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 c5c0be783..b0b52f99d 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