一个简单的Python包,用于演示Python虚拟环境和包管理工具。
Project description
res-msg
一个简单的Python包,用于演示Python虚拟环境和包管理工具。
安装
使用uv工具安装:
uv pip install -e .
或使用pip安装:
pip install -e .
使用方法
命令行
# 显示问候语
res-msg
# 指定名称显示问候语
res-msg --name "Your Name"
# 调用API示例
res-msg --api
# 显示Python版本
res-msg --version
作为库使用
from res_msg import greet, get_simple_api, get_python_version
# 显示问候语
print(greet("Your Name"))
# 调用API
print(get_simple_api())
# 获取Python版本
print(get_python_version())
项目结构
res-msg/
├── main.py # 主入口文件
├── pyproject.toml # 项目配置文件
├── README.md # 项目说明文件
└── src/ # 源代码目录
└── res_msg/ # 包目录
├── __init__.py # 包初始化文件
└── cli.py # 命令行接口
依赖
- Python >= 3.11
- requests >= 2.32.3
许可证
MIT
测试
本项目使用 pytest 进行测试。以下是运行测试的方法:
安装测试依赖
# 安装项目和测试依赖
uv pip install -e ".[dev]"
运行测试
# 使用便捷脚本运行测试
./run_tests.sh
# 或者直接使用 pytest
python -m pytest
生成代码覆盖率报告
# 使用便捷脚本生成覆盖率报告
./run_tests.sh --cov
# 或者直接使用 pytest
python -m pytest --cov=res_msg --cov-report=term --cov-report=html
覆盖率报告将生成在 htmlcov/ 目录中。
测试目录结构
tests/
├── __init__.py # 测试包初始化文件
├── conftest.py # pytest 配置和共享 fixtures
├── test_cli.py # CLI 功能测试
└── test_requests.py # HTTP 请求功能测试
持续集成
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
res_msg-0.3.2.tar.gz
(2.7 kB
view details)
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 res_msg-0.3.2.tar.gz.
File metadata
- Download URL: res_msg-0.3.2.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc38d6a950cb1bddb0a6d3b97eb4c8f376b54954e32f3fd79b69d14ba2e2cfad
|
|
| MD5 |
f5430bbc08d20eb54e2fb978772e358b
|
|
| BLAKE2b-256 |
496bdb4a68e2083aa5acf7bcc1a89967fabcd6931b9a0bd8e3dbe1f8d72d9a2b
|
File details
Details for the file res_msg-0.3.2-py3-none-any.whl.
File metadata
- Download URL: res_msg-0.3.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be6fc3322f646758e8408647783a65becdf697c7127d4936fc13fa42439ccb45
|
|
| MD5 |
84d40f8cd27e38a0ec897a5b35a8e635
|
|
| BLAKE2b-256 |
fa2d0f67dc731ab7849f962f7b502c0a1d783f0565cce9e1018f2d2488dd2265
|