资料:
Packaging Python Projects — Python Packaging User Guide
6. Modules — Python 3.11.4 documentation
python3 -m pip install setuptools wheel twine
python3 -m pip install --upgrade pip
python_test_package/
├── LICENSE # 许可证
├── pyproject.toml # 包配置文件
├── README.md # 可读性说明文件
├── src/ # 程序文件
│ ├── __init__.py
│ └── example01/ # 每个文件夹算一个包,可以有多个
│ ├── __init__.py
│ └── example.py
└── test/ # 测试程序
参考网页
sound/ Top-level package
__init__.py Initialize the sound package
formats/ Subpackage for file format conversions
__init__.py
wavread.py
wavwrite.py
aiffread.py
aiffwrite.py
auread.py
auwrite.py
...
effects/ Subpackage for sound effects
__init__.py
echo.py
surround.py
reverse.py
...
filters/ Subpackage for filters
__init__.py
equalizer.py
vocoder.py
karaoke.py
...
# 调用
from . import echo
from .. import formats
from ..filters import equalizer
# 命令行切换到和src同级别的路径
python3 -m pip install --upgrade build
python3 -m build