Two packages in one folder

GitHub link: https://github.com/Svtter/2InOne

Could two packages share same folder? The answer is yes.

  1. packagea is in apps
  2. packageb is in apps

And the mainc installed them all, run src/main.py successfully.

The folder tree is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
โ”œโ”€โ”€ mainc
โ”‚   โ”œโ”€โ”€ poetry.lock
โ”‚   โ”œโ”€โ”€ pyproject.toml
โ”‚   โ””โ”€โ”€ src
โ”‚       โ””โ”€โ”€ main.py
โ”œโ”€โ”€ packagea
โ”‚   โ”œโ”€โ”€ apps
โ”‚   โ”‚   โ””โ”€โ”€ packagea
โ”‚   โ””โ”€โ”€ pyproject.toml
โ”œโ”€โ”€ packageb
โ”‚   โ”œโ”€โ”€ apps
โ”‚   โ”‚   โ””โ”€โ”€ packageb
โ”‚   โ””โ”€โ”€ pyproject.toml
โ””โ”€โ”€ readme.md

The main.py is:

1
2
3
4
5
6
7
from apps.packagea.a import printa
from apps.packageb.b import printb


if __name__ == "__main__":
    printa()
    printb()
comments powered by Disqus
ไฝฟ็”จ Hugo ๆž„ๅปบ
ไธป้ข˜ Stack ็”ฑ Jimmy ่ฎพ่ฎก