อ้างอิง samplemod ของ Kenneth Reitz (สร้าง Requests)
โครงสร้างมาตรฐาน
README.rst
LICENSE
setup.py
requirements.txt
sample/
__init__.py
core.py
helpers.py
docs/
conf.py
index.rst
tests/
test_basic.py
test_advanced.py
คำอธิบายแต่ละไฟล์/โฟลเดอร์
| ไฟล์/โฟลเดอร์ | หน้าที่ |
|---|---|
README.rst | คำอธิบายโปรเจกต์ วิธีติดตั้ง ใช้งาน |
LICENSE | License & Copyright |
setup.py | Build/Install Script (python setup.py install) |
requirements.txt | Dependency สำหรับ Dev/Test/Docs |
sample/ | Source Code จริง (Module/Package) |
docs/ | Documentation (Sphinx, MkDocs) |
tests/ | Unit/Integration Tests (pytest) |
หลักการสำคัญ
- Source Code อยู่ในโฟลเดอร์ชื่อ Package (ไม่ใช่
src/หรือpython/) - Single Module → วาง
sample.pyที่ Root ได้ - Tests โครงสร้างเหมือน Package