powerful-scooter-95162
06/15/2023, 1:19 AMfresh-cat-90827
06/15/2023, 8:08 AMpants run
would execute an arbitrary script/program you pass as input arguments e.g. pants run src/foo.py
. It is not going to create any Python files for you (unless your src/foo.py
has the code to do this for you).
There's another goal, tailor
which will populate the BUILD files metadata, but it won't create any Python files.powerful-scooter-95162
06/15/2023, 6:14 PMpowerful-scooter-95162
06/15/2023, 6:18 PMfresh-cat-90827
06/17/2023, 10:37 AM__init__.py
files to be present in a package (it's going to be a namespace package). Pants is okay with these types of packages, e.g. if you check out https://github.com/pantsbuild/example-python and delete
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
deleted: helloworld/__init__.py
deleted: helloworld/greet/__init__.py
deleted: helloworld/translator/__init__.py
you can still do
❯ pants --keep-sandboxes=always run helloworld/main.py
11:36:02.78 [INFO] Preserving local process execution dir /tmp/pants-sandbox-Rs97Xj for interactive process
Hola, pantsbuild!
❯ find /tmp/pants-sandbox-Rs97Xj -name "__init__.py"
/tmp/pants-sandbox-Rs97Xj/lib.pex/__pex__/__init__.py
with no __init__.py
files added by Pants:
❯ tree /tmp/pants-sandbox-Rs97Xj/helloworld -L 2
/tmp/pants-sandbox-Rs97Xj/helloworld
├── greet
│ ├── greeting.py
│ ├── __pycache__
│ └── translations.json
├── main.py
├── __pycache__
│ └── main.cpython-39.pyc
└── translator
├── __pycache__
└── translator.py
5 directories, 5 files
fresh-cat-90827
06/17/2023, 10:40 AM__init__.py
files in certain cases, but it's not something I see being done in v2.fresh-cat-90827
06/17/2023, 10:53 AM__init__.py
files at all), but be able to prevent directories with a common name, such as string
, from unintentionally hiding valid modules that occur later on the module search path.