Skip to main content

nonebot

NoneBot Plugin LocalStore

✨ NoneBot 本地数据存储插件 ✨

license pypi python

使用方式

加载插件后使用 require 声明插件依赖,直接使用 localstore 插件提供的函数即可。

from pathlib import Path
from nonebot import require

require("nonebot_plugin_localstore")

import nonebot_plugin_localstore as store

plugin_cache_dir: Path = store.get_plugin_cache_dir()
plugin_cache_file: Path = store.get_plugin_cache_file("filename")
plugin_config_dir: Path = store.get_plugin_config_dir()
plugin_config_file: Path = store.get_plugin_config_file("filename")
plugin_data_dir: Path = store.get_plugin_data_dir()
plugin_data_file: Path = store.get_plugin_data_file("filename")

存储路径

在项目安装插件后,可以使用 nb-cli 查看具体的存储路径:

nb localstore

参考路径如下:

cache path

  • macOS: ~/Library/Caches/<AppName>
  • Unix: ~/.cache/<AppName> (XDG default)
  • Windows: C:\Users\<username>\AppData\Local\<AppName>\Cache

data path

  • macOS: ~/Library/Application Support/<AppName>
  • Unix: ~/.local/share/<AppName> or in $XDG_DATA_HOME, if defined
  • Win XP (not roaming): C:\Documents and Settings\<username>\Application Data\<AppName>
  • Win 7 (not roaming): C:\Users\<username>\AppData\Local\<AppName>

config path

  • macOS: same as user_data_dir
  • Unix: ~/.config/<AppName>
  • Win XP (roaming): C:\Documents and Settings\<username>\Local Settings\Application Data\<AppName>
  • Win 7 (roaming): C:\Users\<username>\AppData\Roaming\<AppName>

配置项

插件支持配置全局存储路径,也支持为插件单独配置存储路径。

LOCALSTORE_CACHE_DIR=/tmp/cache
LOCALSTORE_DATA_DIR=/tmp/data
LOCALSTORE_CONFIG_DIR=/tmp/config

LOCALSTORE_PLUGIN_CACHE_DIR='
{
  "plugin1": "/tmp/plugin1/cache",
  "plugin2:sub_plugin": "/tmp/plugin2/sub_plugin/cache"
}
'
LOCALSTORE_PLUGIN_DATA_DIR='
{
  "plugin1": "/tmp/plugin1/data",
  "plugin2:sub_plugin": "/tmp/plugin2/sub_plugin/data"
}
'
LOCALSTORE_PLUGIN_CONFIG_DIR='
{
  "plugin1": "/tmp/plugin1/config",
  "plugin2:sub_plugin": "/tmp/plugin2/sub_plugin/config"
}
'

Metadata

Release files for nonebot-plugin-localstore 0.7.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-localstore 0.7.3
File Size Uploaded Provenance Actions
nonebot_plugin_localstore-0.7.3.tar.gz 5.7 kB With provenance Details for nonebot_plugin_localstore-0.7.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-localstore 0.7.3
File Interpreter ABI Platform Actions
nonebot_plugin_localstore-0.7.3-py3-none-any.whl Python 3 none any Details for nonebot_plugin_localstore-0.7.3-py3-none-any.whl

Total release size: 12.6 kB

Release files / nonebot_plugin_localstore-0.7.3.tar.gz

Download URL nonebot_plugin_localstore-0.7.3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1aff10e2dacfc5bc9ce239fd34849f8d7172a118135dbc5aeba1c97605d9959d
BLAKE2b-256 checksum
How to use checksums
5eaaa038f16a1770e0f3a12efa4e99ffee236a7742bbbba0f7ed7c369a0e073e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 21, 2024.

Transparency log

Release files / nonebot_plugin_localstore-0.7.3-py3-none-any.whl

Download URL nonebot_plugin_localstore-0.7.3-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bc239b4b5320df0dc08eada7c4f8ba4cb92d4dc3134bf4646ab5e297bd7e575
BLAKE2b-256 checksum
How to use checksums
d6ab5589d873bbc47bfb70c5fca95de7538568ddfd4e9a1f0a40c16d3b80077d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 21, 2024.

Transparency log

Security for nonebot-plugin-localstore 0.7.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nonebot_plugin_localstore-0.7.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 21, 2024.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page