Skip to content

Commit

Permalink
Switch from appdirs to platformdirs
Browse files Browse the repository at this point in the history
appdirs has been officially deprecated upstream, the replacement module
with more features is platformdirs.
  • Loading branch information
s-t-e-v-e-n-k committed Jul 20, 2024
1 parent 5f2a76a commit 844bba7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced/performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/<username>/Library/Caches/pint`

In any case, you can check the location of the cache folder.
Expand All @@ -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/
5 changes: 2 additions & 3 deletions pint/facets/plain/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

# from ..._typing import Quantity, Unit

import appdirs
import platformdirs

from ... import pint_eval
from ..._typing import (
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
appdirs>=1.4.4
platformdirs>=2.1.0
typing_extensions
flexcache>=0.3
flexparser>=0.3

0 comments on commit 844bba7

Please sign in to comment.