Skip to main content

A FastMCP demo server with basic tools and resources

Project description

Wanyi Today

一个基于 FastMCP 的演示服务器,提供基础工具和资源用于演示目的。

功能特性

  • 加法工具: 将两个数字相加
  • 问候资源: 获取个性化问候语
  • 问候提示: 生成不同风格的问候提示

安装

pip install wanyi-today

使用方法

运行服务器:

wanyi-today-server

或者直接使用 Python 运行:

python -m wanyi_today.main

开发

本项目使用 uv 进行依赖管理。

# 安装依赖
uv sync

# 运行服务器
uv run python -m wanyi_today.main

标准的 PyPI 包目录结构

一个标准的 PyPI 包应该具有以下目录结构:

wanyi_today/                    # 项目根目录
├── wanyi_today/               # 包目录(Python包)
│   ├── __init__.py           # 包初始化文件,定义版本等
│   ├── main.py               # 主模块文件
│   └── other_modules.py      # 其他模块文件
├── tests/                    # 测试目录(可选但推荐)
│   ├── __init__.py
│   └── test_main.py
├── docs/                     # 文档目录(可选)
├── dist/                     # 构建输出目录(自动生成)
│   ├── *.whl                # wheel分发包
│   └── *.tar.gz             # 源码分发包
├── pyproject.toml           # 项目配置文件(现代Python项目标准)
├── README.md                # 项目说明文档
├── LICENSE                  # 许可证文件
├── .gitignore              # Git忽略文件
└── uv.lock                 # 依赖锁定文件(使用uv时)

关键文件说明

  1. pyproject.toml: 现代 Python 项目的配置文件,包含:

    • 项目元数据(名称、版本、描述等)
    • 依赖关系
    • 构建系统配置
    • 脚本入口点
  2. 包目录结构:

    • 包名使用下划线(如 wanyi_today
    • PyPI 项目名可以使用连字符(如 wanyi-today
    • __init__.py 文件标识这是一个 Python 包
  3. 入口点配置:

    [project.scripts]
    wanyi-today-server = "wanyi_today.main:main"
    

    这样用户安装后可以直接运行 wanyi-today-server 命令

  4. 模块运行方式:

    • python -m wanyi_today.main - 以模块方式运行
    • wanyi-today-server - 通过安装的脚本运行

上传到 PyPI 的完整流程

1. 准备工作

确保已安装必要的工具:

pip install build twine

2. 配置 PyPI 认证

在用户目录下创建 .pypirc 文件(如果还没有):

[pypi]
username = __token__
password = your-api-token-here

3. 构建包

清理之前的构建文件并重新构建:

# 清理旧的构建文件
rm -rf dist/ build/ *.egg-info/

# 使用 uv 构建(推荐)
uv build

# 或者使用标准工具构建
python -m build

4. 检查包

验证构建的包是否正确:

twine check dist/*

5. 上传到 PyPI

# 上传到正式 PyPI
twine upload dist/*

# 或者先上传到测试 PyPI(推荐)
twine upload --repository testpypi dist/*

6. 测试安装

从 PyPI 安装并测试:

# 从测试 PyPI 安装
pip install --index-url https://test.pypi.org/simple/ wanyi-today

# 从正式 PyPI 安装
pip install wanyi-today

7. 版本更新流程

当需要发布新版本时:

  1. 更新 pyproject.toml 中的版本号
  2. 更新 wanyi_today/__init__.py 中的版本号
  3. 重新构建和上传:
    uv build
    twine check dist/*
    twine upload dist/*
    

常见问题

  • 403 错误: 包名已被占用,需要选择不同的名称
  • 400 错误: 版本号已存在,需要增加版本号
  • 认证失败: 检查 API token 是否正确配置

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wanyi_today-0.1.4.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wanyi_today-0.1.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file wanyi_today-0.1.4.tar.gz.

File metadata

  • Download URL: wanyi_today-0.1.4.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for wanyi_today-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7120da4ab6434d2265e429d06f201915fb39618424871827fe005ca462f5f61b
MD5 200878b900beea107e52c0e881ad042b
BLAKE2b-256 b08020570bd0dc9afd1f5fd659df7e10c5d3745110deb7b4bf7370eca4f77c28

See more details on using hashes here.

File details

Details for the file wanyi_today-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: wanyi_today-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for wanyi_today-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 90ff5d18b6f62ee1c2631df1216a19ab5875fb55f3dedbcc2c1d9583536d0d6a
MD5 c479054ce693c6b0f34a674653aa2420
BLAKE2b-256 46ee7842351a09340ddb10663fcac311ee31be2de9587135f98e0241c818be45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page