A tool for creating and managing loader projects
Project description
Talos Loader
一个用于创建和管理 Talos 加载器项目的工具。
安装
使用以下命令安装:
pip install talos-loader
使用方法
初始化新项目
talos-loader init
这将启动交互式向导,引导您创建一个新的加载器项目。您需要提供:
- 项目路径(默认为 ~/Downloads)
- 项目名称
执行后,将创建以下目录结构:
my_project_name/
├── README.md # 项目说明文档
├── pyproject.toml # 项目配置文件(Poetry配置)
├── poetry.toml # Poetry虚拟环境配置
├── dry_run.py # 用于测试加载器的脚本
├── my_project_name/ # 主项目目录
│ ├── __init__.py # 包初始化文件
│ └── loaders/ # 加载器模块目录
│ ├── __init__.py # 加载器包初始化文件
│ └── my_custom_loaders.py # 自定义加载器实现
项目初始化后的使用
项目创建完成后,您可以进入项目目录并安装依赖:
cd my_project_name
poetry install --no-root
然后,您可以开始开发自定义加载器。加载器模板已经包含了基本的结构,您只需要实现 load 方法即可。
测试加载器
项目中包含了一个 dry_run.py 文件,您可以用它来测试您的加载器:
python dry_run.py
开发
依赖
- Python 3.10+
- click
- inquirer
- jinja2
- pydantic
- talos-aclient
自定义加载器开发
在 my_project_name/loaders/my_custom_loaders.py 文件中,您可以看到一个基本的加载器模板:
from talos_loader import TalosLoader, Block, ContentType
class MyCustomLoader(TalosLoader):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def load(self, context) -> list[Block]:
"""Execute the custom operation"""
return []
您需要实现 load 方法,根据您的需求处理输入并返回适当的 Block 列表。
许可证
MIT
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 talos_loader-0.0.2.tar.gz.
File metadata
- Download URL: talos_loader-0.0.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0adc8e014b26a741566d9daea7d78a9423bbbf9083a7da72867d3d64501f0c11
|
|
| MD5 |
c68092966ce88c08b807e32f8cb5100f
|
|
| BLAKE2b-256 |
9f344570c7a798b810d9fb8bf017ad3afd280f049988eaec7923bf33e1b3a7e3
|
File details
Details for the file talos_loader-0.0.2-py3-none-any.whl.
File metadata
- Download URL: talos_loader-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ceccab8294dad2039685389494020ba35edb431103291312398c75aaf35976f
|
|
| MD5 |
551cf0ef8d3710841862e7561712c932
|
|
| BLAKE2b-256 |
637c358de19fc3bf6daa9640e2bf23fedba8dda218a1a36703831f417723183b
|