Skip to main content

一个示例 Python 包,用于演示打包和测试

Project description

MyPackage

一个示例 Python 包,用于演示打包和测试流程。

功能特性

  • 基本的项目结构
  • 单元测试配置
  • 打包配置
  • 开发工具集成

安装

从源码安装

pip install .

开发模式安装

pip install -e ".[dev]"

使用方法

from mypackage import main_function
from mypackage.utils import format_string

# 使用主函数
message = main_function("World")
print(message)  # 输出:Hello, World!

# 使用工具函数
formatted = format_string("  Hello  ", uppercase=True)
print(formatted)  # 输出:HELLO

运行测试

# 运行所有测试
pytest

# 运行测试并生成覆盖率报告
pytest --cov=mypackage --cov-report=html

打包发布

# 构建分发包
python -m build

# 上传到 PyPI (需要配置 twine)
python -m twine upload dist/*

项目结构

package-test/
├── mypackage/          # 源代码
├── tests/              # 测试文件
├── docs/               # 文档
├── examples/           # 示例代码
└── 配置文件

许可证

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

mypackage_test_demo-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

mypackage_test_demo-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file mypackage_test_demo-0.1.0.tar.gz.

File metadata

  • Download URL: mypackage_test_demo-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for mypackage_test_demo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d0a1a082e2e91f3feeaf651ec10ab6ed7bb5b5c2c000813cd2a8cd8ac45325ec
MD5 8c9cbde1609347aacc0b4c0fc7c77f22
BLAKE2b-256 f974e6dd2117d40557753422a3d59bc1e95f438f49def0b35f56e7e84a3e062a

See more details on using hashes here.

File details

Details for the file mypackage_test_demo-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mypackage_test_demo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e345f7beb003c3930c1d91c37c470d10b7694e8a5472e4e0a92307906f5ac72
MD5 fe2927db8c0d28361b6f871ca860ba70
BLAKE2b-256 42a43e196c6cebbdacea792a1e10a2c3496932dab7eab8676a46879e4893ba2f

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