Project structure
├── README.md
├── external <folder name is defined by you>
│ └── python <folder name ref to python projects>
│ ├── BUILD
│ ├── poetry.lock <generate after install some dep e.g: poetry add requests>
│ └── pyproject.toml <generate by poetry init - in this folder>
├── pants.toml
├── src
│ └── python
│ └── my_package
│ ├── BUILD
│ ├── __init__.py
│ └── my_module.py
└── tests
└── python
└── my_package
├── BUILD
├── __init__.py
└── test_my_module.py
We need have Poetry installed
brew install poetry
Let create a folder with the sub folder /python
to have all deps
mkdir -r external/python
cd external/python & poetry init
Installs a project dependency
poetry add requests
We need to init pants at the root dir
pants
this commant will create a pants.toml file similiar to this:
[GLOBAL]
pants_version = "2.19.1"
Update it like this:
[GLOBAL]
pants_version = "2.19.1"
backend_packages = ["pants.backend.python"]
[python]
interpreter_constraints = ["==3.8.*", "==3.9.*"]
pants run src/python/my_package:my_main
pants test tests/python/my_package:test_my_module