Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from appdirs to platformdirs #2028

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading