Skip to content

Commit

Permalink
build: 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.

Closes #2028
  • Loading branch information
s-t-e-v-e-n-k authored Jul 28, 2024
1 parent 67303b8 commit 0b0ae61
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 @@ -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

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>=4.0.0
flexcache>=0.3
flexparser>=0.3

0 comments on commit 0b0ae61

Please sign in to comment.