From 0b0ae61cebe6c470dcc2edbb84fe717c664fc223 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 29 Jul 2024 02:13:26 +1000 Subject: [PATCH] build: switch from appdirs to platformdirs appdirs has been officially deprecated upstream, the replacement module with more features is platformdirs. Closes #2028 --- 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 6c3c827ae..4b4884d54 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 325f2c315..c8ce3f2f0 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 ( @@ -238,8 +238,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 dc7cf4651..c62365819 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -appdirs>=1.4.4 +platformdirs>=2.1.0 typing_extensions>=4.0.0 flexcache>=0.3 flexparser>=0.3