Local Storage Support for NoneBot2
Project description
NoneBot Plugin LocalStore
✨ NoneBot 本地数据存储插件 ✨
使用方式
加载插件后使用 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"
}
'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_localstore-0.7.4.tar.gz.
File metadata
- Download URL: nonebot_plugin_localstore-0.7.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ddc13814bfcd484ab311306823651390020bf44f4fb4733b343a58e72723ce
|
|
| MD5 |
66e69198ac0cf66bac0b541df2757209
|
|
| BLAKE2b-256 |
632267ec1e604c0385729bf2d71db406c032de9015363588785617113dfb76ac
|
Provenance
The following attestation bundles were made for nonebot_plugin_localstore-0.7.4.tar.gz:
Publisher:
release.yml on nonebot/plugin-localstore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_localstore-0.7.4.tar.gz -
Subject digest:
85ddc13814bfcd484ab311306823651390020bf44f4fb4733b343a58e72723ce - Sigstore transparency entry: 175733356
- Sigstore integration time:
-
Permalink:
nonebot/plugin-localstore@26c7f4ee6a83e4abe0adb89d86582c915404d186 -
Branch / Tag:
refs/tags/v0.7.4 - Owner: https://github.com/nonebot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@26c7f4ee6a83e4abe0adb89d86582c915404d186 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nonebot_plugin_localstore-0.7.4-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_localstore-0.7.4-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b08030878eadcdd8b9ce3d079da0dc2d0e41dc91f0b2d8cf7fa862a27de9090
|
|
| MD5 |
0496378bbde91fc082e7868056a7c4ff
|
|
| BLAKE2b-256 |
7bc80fcb2c6d994579e53342cbf11bf9326ddfab010d1a8063e1fc0cc19c13bf
|
Provenance
The following attestation bundles were made for nonebot_plugin_localstore-0.7.4-py3-none-any.whl:
Publisher:
release.yml on nonebot/plugin-localstore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_localstore-0.7.4-py3-none-any.whl -
Subject digest:
3b08030878eadcdd8b9ce3d079da0dc2d0e41dc91f0b2d8cf7fa862a27de9090 - Sigstore transparency entry: 175733358
- Sigstore integration time:
-
Permalink:
nonebot/plugin-localstore@26c7f4ee6a83e4abe0adb89d86582c915404d186 -
Branch / Tag:
refs/tags/v0.7.4 - Owner: https://github.com/nonebot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@26c7f4ee6a83e4abe0adb89d86582c915404d186 -
Trigger Event:
push
-
Statement type: