__init__.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. """
  2. Utilities for determining application-specific dirs. See <https://github.com/platformdirs/platformdirs> for details and
  3. usage.
  4. """
  5. from __future__ import annotations
  6. import os
  7. import sys
  8. from typing import TYPE_CHECKING
  9. from .api import PlatformDirsABC
  10. from .version import __version__
  11. from .version import __version_tuple__ as __version_info__
  12. if TYPE_CHECKING:
  13. from pathlib import Path
  14. if sys.version_info >= (3, 8): # pragma: no cover (py38+)
  15. from typing import Literal
  16. else: # pragma: no cover (py38+)
  17. from typing_extensions import Literal
  18. def _set_platform_dir_class() -> type[PlatformDirsABC]:
  19. if sys.platform == "win32":
  20. from platformdirs.windows import Windows as Result
  21. elif sys.platform == "darwin":
  22. from platformdirs.macos import MacOS as Result
  23. else:
  24. from platformdirs.unix import Unix as Result
  25. if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
  26. if os.getenv("SHELL") or os.getenv("PREFIX"):
  27. return Result
  28. from platformdirs.android import _android_folder
  29. if _android_folder() is not None:
  30. from platformdirs.android import Android
  31. return Android # return to avoid redefinition of result
  32. return Result
  33. PlatformDirs = _set_platform_dir_class() #: Currently active platform
  34. AppDirs = PlatformDirs #: Backwards compatibility with appdirs
  35. def user_data_dir(
  36. appname: str | None = None,
  37. appauthor: str | None | Literal[False] = None,
  38. version: str | None = None,
  39. roaming: bool = False, # noqa: FBT001, FBT002
  40. ensure_exists: bool = False, # noqa: FBT001, FBT002
  41. ) -> str:
  42. """
  43. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  44. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  45. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  46. :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
  47. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  48. :returns: data directory tied to the user
  49. """
  50. return PlatformDirs(
  51. appname=appname,
  52. appauthor=appauthor,
  53. version=version,
  54. roaming=roaming,
  55. ensure_exists=ensure_exists,
  56. ).user_data_dir
  57. def site_data_dir(
  58. appname: str | None = None,
  59. appauthor: str | None | Literal[False] = None,
  60. version: str | None = None,
  61. multipath: bool = False, # noqa: FBT001, FBT002
  62. ensure_exists: bool = False, # noqa: FBT001, FBT002
  63. ) -> str:
  64. """
  65. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  66. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  67. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  68. :param multipath: See `roaming <platformdirs.api.PlatformDirsABC.multipath>`.
  69. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  70. :returns: data directory shared by users
  71. """
  72. return PlatformDirs(
  73. appname=appname,
  74. appauthor=appauthor,
  75. version=version,
  76. multipath=multipath,
  77. ensure_exists=ensure_exists,
  78. ).site_data_dir
  79. def user_config_dir(
  80. appname: str | None = None,
  81. appauthor: str | None | Literal[False] = None,
  82. version: str | None = None,
  83. roaming: bool = False, # noqa: FBT001, FBT002
  84. ensure_exists: bool = False, # noqa: FBT001, FBT002
  85. ) -> str:
  86. """
  87. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  88. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  89. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  90. :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
  91. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  92. :returns: config directory tied to the user
  93. """
  94. return PlatformDirs(
  95. appname=appname,
  96. appauthor=appauthor,
  97. version=version,
  98. roaming=roaming,
  99. ensure_exists=ensure_exists,
  100. ).user_config_dir
  101. def site_config_dir(
  102. appname: str | None = None,
  103. appauthor: str | None | Literal[False] = None,
  104. version: str | None = None,
  105. multipath: bool = False, # noqa: FBT001, FBT002
  106. ensure_exists: bool = False, # noqa: FBT001, FBT002
  107. ) -> str:
  108. """
  109. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  110. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  111. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  112. :param multipath: See `roaming <platformdirs.api.PlatformDirsABC.multipath>`.
  113. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  114. :returns: config directory shared by the users
  115. """
  116. return PlatformDirs(
  117. appname=appname,
  118. appauthor=appauthor,
  119. version=version,
  120. multipath=multipath,
  121. ensure_exists=ensure_exists,
  122. ).site_config_dir
  123. def user_cache_dir(
  124. appname: str | None = None,
  125. appauthor: str | None | Literal[False] = None,
  126. version: str | None = None,
  127. opinion: bool = True, # noqa: FBT001, FBT002
  128. ensure_exists: bool = False, # noqa: FBT001, FBT002
  129. ) -> str:
  130. """
  131. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  132. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  133. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  134. :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
  135. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  136. :returns: cache directory tied to the user
  137. """
  138. return PlatformDirs(
  139. appname=appname,
  140. appauthor=appauthor,
  141. version=version,
  142. opinion=opinion,
  143. ensure_exists=ensure_exists,
  144. ).user_cache_dir
  145. def site_cache_dir(
  146. appname: str | None = None,
  147. appauthor: str | None | Literal[False] = None,
  148. version: str | None = None,
  149. opinion: bool = True, # noqa: FBT001, FBT002
  150. ensure_exists: bool = False, # noqa: FBT001, FBT002
  151. ) -> str:
  152. """
  153. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  154. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  155. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  156. :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
  157. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  158. :returns: cache directory tied to the user
  159. """
  160. return PlatformDirs(
  161. appname=appname,
  162. appauthor=appauthor,
  163. version=version,
  164. opinion=opinion,
  165. ensure_exists=ensure_exists,
  166. ).site_cache_dir
  167. def user_state_dir(
  168. appname: str | None = None,
  169. appauthor: str | None | Literal[False] = None,
  170. version: str | None = None,
  171. roaming: bool = False, # noqa: FBT001, FBT002
  172. ensure_exists: bool = False, # noqa: FBT001, FBT002
  173. ) -> str:
  174. """
  175. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  176. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  177. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  178. :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
  179. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  180. :returns: state directory tied to the user
  181. """
  182. return PlatformDirs(
  183. appname=appname,
  184. appauthor=appauthor,
  185. version=version,
  186. roaming=roaming,
  187. ensure_exists=ensure_exists,
  188. ).user_state_dir
  189. def user_log_dir(
  190. appname: str | None = None,
  191. appauthor: str | None | Literal[False] = None,
  192. version: str | None = None,
  193. opinion: bool = True, # noqa: FBT001, FBT002
  194. ensure_exists: bool = False, # noqa: FBT001, FBT002
  195. ) -> str:
  196. """
  197. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  198. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  199. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  200. :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
  201. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  202. :returns: log directory tied to the user
  203. """
  204. return PlatformDirs(
  205. appname=appname,
  206. appauthor=appauthor,
  207. version=version,
  208. opinion=opinion,
  209. ensure_exists=ensure_exists,
  210. ).user_log_dir
  211. def user_documents_dir() -> str:
  212. """:returns: documents directory tied to the user"""
  213. return PlatformDirs().user_documents_dir
  214. def user_downloads_dir() -> str:
  215. """:returns: downloads directory tied to the user"""
  216. return PlatformDirs().user_downloads_dir
  217. def user_pictures_dir() -> str:
  218. """:returns: pictures directory tied to the user"""
  219. return PlatformDirs().user_pictures_dir
  220. def user_videos_dir() -> str:
  221. """:returns: videos directory tied to the user"""
  222. return PlatformDirs().user_videos_dir
  223. def user_music_dir() -> str:
  224. """:returns: music directory tied to the user"""
  225. return PlatformDirs().user_music_dir
  226. def user_desktop_dir() -> str:
  227. """:returns: desktop directory tied to the user"""
  228. return PlatformDirs().user_desktop_dir
  229. def user_runtime_dir(
  230. appname: str | None = None,
  231. appauthor: str | None | Literal[False] = None,
  232. version: str | None = None,
  233. opinion: bool = True, # noqa: FBT001, FBT002
  234. ensure_exists: bool = False, # noqa: FBT001, FBT002
  235. ) -> str:
  236. """
  237. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  238. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  239. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  240. :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
  241. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  242. :returns: runtime directory tied to the user
  243. """
  244. return PlatformDirs(
  245. appname=appname,
  246. appauthor=appauthor,
  247. version=version,
  248. opinion=opinion,
  249. ensure_exists=ensure_exists,
  250. ).user_runtime_dir
  251. def site_runtime_dir(
  252. appname: str | None = None,
  253. appauthor: str | None | Literal[False] = None,
  254. version: str | None = None,
  255. opinion: bool = True, # noqa: FBT001, FBT002
  256. ensure_exists: bool = False, # noqa: FBT001, FBT002
  257. ) -> str:
  258. """
  259. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  260. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  261. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  262. :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
  263. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  264. :returns: runtime directory shared by users
  265. """
  266. return PlatformDirs(
  267. appname=appname,
  268. appauthor=appauthor,
  269. version=version,
  270. opinion=opinion,
  271. ensure_exists=ensure_exists,
  272. ).site_runtime_dir
  273. def user_data_path(
  274. appname: str | None = None,
  275. appauthor: str | None | Literal[False] = None,
  276. version: str | None = None,
  277. roaming: bool = False, # noqa: FBT001, FBT002
  278. ensure_exists: bool = False, # noqa: FBT001, FBT002
  279. ) -> Path:
  280. """
  281. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  282. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  283. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  284. :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
  285. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  286. :returns: data path tied to the user
  287. """
  288. return PlatformDirs(
  289. appname=appname,
  290. appauthor=appauthor,
  291. version=version,
  292. roaming=roaming,
  293. ensure_exists=ensure_exists,
  294. ).user_data_path
  295. def site_data_path(
  296. appname: str | None = None,
  297. appauthor: str | None | Literal[False] = None,
  298. version: str | None = None,
  299. multipath: bool = False, # noqa: FBT001, FBT002
  300. ensure_exists: bool = False, # noqa: FBT001, FBT002
  301. ) -> Path:
  302. """
  303. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  304. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  305. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  306. :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
  307. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  308. :returns: data path shared by users
  309. """
  310. return PlatformDirs(
  311. appname=appname,
  312. appauthor=appauthor,
  313. version=version,
  314. multipath=multipath,
  315. ensure_exists=ensure_exists,
  316. ).site_data_path
  317. def user_config_path(
  318. appname: str | None = None,
  319. appauthor: str | None | Literal[False] = None,
  320. version: str | None = None,
  321. roaming: bool = False, # noqa: FBT001, FBT002
  322. ensure_exists: bool = False, # noqa: FBT001, FBT002
  323. ) -> Path:
  324. """
  325. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  326. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  327. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  328. :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
  329. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  330. :returns: config path tied to the user
  331. """
  332. return PlatformDirs(
  333. appname=appname,
  334. appauthor=appauthor,
  335. version=version,
  336. roaming=roaming,
  337. ensure_exists=ensure_exists,
  338. ).user_config_path
  339. def site_config_path(
  340. appname: str | None = None,
  341. appauthor: str | None | Literal[False] = None,
  342. version: str | None = None,
  343. multipath: bool = False, # noqa: FBT001, FBT002
  344. ensure_exists: bool = False, # noqa: FBT001, FBT002
  345. ) -> Path:
  346. """
  347. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  348. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  349. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  350. :param multipath: See `roaming <platformdirs.api.PlatformDirsABC.multipath>`.
  351. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  352. :returns: config path shared by the users
  353. """
  354. return PlatformDirs(
  355. appname=appname,
  356. appauthor=appauthor,
  357. version=version,
  358. multipath=multipath,
  359. ensure_exists=ensure_exists,
  360. ).site_config_path
  361. def site_cache_path(
  362. appname: str | None = None,
  363. appauthor: str | None | Literal[False] = None,
  364. version: str | None = None,
  365. opinion: bool = True, # noqa: FBT001, FBT002
  366. ensure_exists: bool = False, # noqa: FBT001, FBT002
  367. ) -> Path:
  368. """
  369. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  370. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  371. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  372. :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
  373. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  374. :returns: cache directory tied to the user
  375. """
  376. return PlatformDirs(
  377. appname=appname,
  378. appauthor=appauthor,
  379. version=version,
  380. opinion=opinion,
  381. ensure_exists=ensure_exists,
  382. ).site_cache_path
  383. def user_cache_path(
  384. appname: str | None = None,
  385. appauthor: str | None | Literal[False] = None,
  386. version: str | None = None,
  387. opinion: bool = True, # noqa: FBT001, FBT002
  388. ensure_exists: bool = False, # noqa: FBT001, FBT002
  389. ) -> Path:
  390. """
  391. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  392. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  393. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  394. :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
  395. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  396. :returns: cache path tied to the user
  397. """
  398. return PlatformDirs(
  399. appname=appname,
  400. appauthor=appauthor,
  401. version=version,
  402. opinion=opinion,
  403. ensure_exists=ensure_exists,
  404. ).user_cache_path
  405. def user_state_path(
  406. appname: str | None = None,
  407. appauthor: str | None | Literal[False] = None,
  408. version: str | None = None,
  409. roaming: bool = False, # noqa: FBT001, FBT002
  410. ensure_exists: bool = False, # noqa: FBT001, FBT002
  411. ) -> Path:
  412. """
  413. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  414. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  415. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  416. :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
  417. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  418. :returns: state path tied to the user
  419. """
  420. return PlatformDirs(
  421. appname=appname,
  422. appauthor=appauthor,
  423. version=version,
  424. roaming=roaming,
  425. ensure_exists=ensure_exists,
  426. ).user_state_path
  427. def user_log_path(
  428. appname: str | None = None,
  429. appauthor: str | None | Literal[False] = None,
  430. version: str | None = None,
  431. opinion: bool = True, # noqa: FBT001, FBT002
  432. ensure_exists: bool = False, # noqa: FBT001, FBT002
  433. ) -> Path:
  434. """
  435. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  436. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  437. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  438. :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
  439. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  440. :returns: log path tied to the user
  441. """
  442. return PlatformDirs(
  443. appname=appname,
  444. appauthor=appauthor,
  445. version=version,
  446. opinion=opinion,
  447. ensure_exists=ensure_exists,
  448. ).user_log_path
  449. def user_documents_path() -> Path:
  450. """:returns: documents path tied to the user"""
  451. return PlatformDirs().user_documents_path
  452. def user_downloads_path() -> Path:
  453. """:returns: downloads path tied to the user"""
  454. return PlatformDirs().user_downloads_path
  455. def user_pictures_path() -> Path:
  456. """:returns: pictures path tied to the user"""
  457. return PlatformDirs().user_pictures_path
  458. def user_videos_path() -> Path:
  459. """:returns: videos path tied to the user"""
  460. return PlatformDirs().user_videos_path
  461. def user_music_path() -> Path:
  462. """:returns: music path tied to the user"""
  463. return PlatformDirs().user_music_path
  464. def user_desktop_path() -> Path:
  465. """:returns: desktop path tied to the user"""
  466. return PlatformDirs().user_desktop_path
  467. def user_runtime_path(
  468. appname: str | None = None,
  469. appauthor: str | None | Literal[False] = None,
  470. version: str | None = None,
  471. opinion: bool = True, # noqa: FBT001, FBT002
  472. ensure_exists: bool = False, # noqa: FBT001, FBT002
  473. ) -> Path:
  474. """
  475. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  476. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  477. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  478. :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
  479. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  480. :returns: runtime path tied to the user
  481. """
  482. return PlatformDirs(
  483. appname=appname,
  484. appauthor=appauthor,
  485. version=version,
  486. opinion=opinion,
  487. ensure_exists=ensure_exists,
  488. ).user_runtime_path
  489. def site_runtime_path(
  490. appname: str | None = None,
  491. appauthor: str | None | Literal[False] = None,
  492. version: str | None = None,
  493. opinion: bool = True, # noqa: FBT001, FBT002
  494. ensure_exists: bool = False, # noqa: FBT001, FBT002
  495. ) -> Path:
  496. """
  497. :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
  498. :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
  499. :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
  500. :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
  501. :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
  502. :returns: runtime path shared by users
  503. """
  504. return PlatformDirs(
  505. appname=appname,
  506. appauthor=appauthor,
  507. version=version,
  508. opinion=opinion,
  509. ensure_exists=ensure_exists,
  510. ).site_runtime_path
  511. __all__ = [
  512. "__version__",
  513. "__version_info__",
  514. "PlatformDirs",
  515. "AppDirs",
  516. "PlatformDirsABC",
  517. "user_data_dir",
  518. "user_config_dir",
  519. "user_cache_dir",
  520. "user_state_dir",
  521. "user_log_dir",
  522. "user_documents_dir",
  523. "user_downloads_dir",
  524. "user_pictures_dir",
  525. "user_videos_dir",
  526. "user_music_dir",
  527. "user_desktop_dir",
  528. "user_runtime_dir",
  529. "site_data_dir",
  530. "site_config_dir",
  531. "site_cache_dir",
  532. "site_runtime_dir",
  533. "user_data_path",
  534. "user_config_path",
  535. "user_cache_path",
  536. "user_state_path",
  537. "user_log_path",
  538. "user_documents_path",
  539. "user_downloads_path",
  540. "user_pictures_path",
  541. "user_videos_path",
  542. "user_music_path",
  543. "user_desktop_path",
  544. "user_runtime_path",
  545. "site_data_path",
  546. "site_config_path",
  547. "site_cache_path",
  548. "site_runtime_path",
  549. ]