完成本章学习后,你将能够:
my_project/ ├── src/ │ └── my_package/ │ ├── __init__.py │ ├── module1.py │ └── module2.py ├── tests/ │ ├── __init__.py │ └── test_module1.py ├── docs/ ├── .gitignore ├── LICENSE ├── README.md ├── pyproject.toml └── requirements.txt
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "my_project"
version = "1.0.0"
description = "A sample project"
readme = "README.md"
requires-python = ">=3.8"
license = {text = "MIT"}
authors = [
{name = "Author", email = "author@example.com"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
]
dependencies = [
"requests>=2.0",
"numpy>=1.20",
]
[project.optional-dependencies]
dev = ["pytest", "black", "flake8", "mypy"]
1. 创建规范的项目结构 2. 配置CI/CD 3. 发布到PyPI
下一章:第四十三章:性能优化