Trying out the new poetry functionality but poetry...
# general
p
Trying out the new poetry functionality but poetry_requirements seems to be not part of the python backend by default. Do I need to add a new backend?
Copy code
$ ./pants --version
23:01:10.36 [INFO] Initializing scheduler...
23:01:10.52 [INFO] Scheduler initialized.
2.6.0rc0
./project-app/BUILD ./project-app/pyproject.toml ./project-app/src/app.py
Copy code
poetry_requirements()

pex_binary(
    name="project-app-pex",
    entry_point="src/app.py",
    zip_safe=False,
)


python_tests(
    name="tests",
    sources=["test_*.py"],
    timeout=120,
)
Copy code
$ ./pants run project-app:project-app-pex -lerror
23:03:12.60 [ERROR] Exception caught: (pants.engine.internals.scheduler.ExecutionError)
  File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 234, in _run_inner
    return self._perform_run(goals)
  File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 173, in _perform_run
    return self._perform_run_body(goals, poll=False)
  File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 190, in _perform_run_body
    return self.graph_session.run_goal_rules(
  File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/init/engine_initializer.py", line 135, in run_goal_rules
    exit_code = self.scheduler_session.run_goal_rule(
  File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 533, in run_goal_rule
    self._raise_on_error([t for _, t in throws])
  File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 501, in _raise_on_error
    raise ExecutionError(

Exception message: 1 Exception encountered:

  MappingError: Failed to parse project-app/BUILD:
Name 'poetry_requirements' is not defined.

If you expect to see more symbols activated in the below list, refer to (<https://www.pantsbuild.org/v2.6/docs/enabling-backends>) for all available backends to activate.

All registered symbols: ['_python_requirements_file', 'archive', 'files', 'pants_requirement', 'pex_binary', 'pipenv_requirements', 'python_artifact', 'python_distribution', 'python_library', 'python_requirement_library', 'python_requirements', 'python_tests', 'relocated_files', 'resources', 'setup_py', 'target']
h
Oh, oopsies 🙂 you are right indeed. will hotfix and do a new rc today
🙌 1
p
python3.9.5, Ubuntu 21.04
I'm new to pants and going in the deep end with new bleeding edge features... do I understand that only the top level directories where requirements.txt or pyproject.toml will need the BUILD files? tailor seems to put them in most directories... do they need to be in like every dir like
___init___.py
h
Those BUILD files tell pants "here is some python source code for you to care about", so they are neccessary.
The BUILD file that represents requirements is different (same file name, different content...)
BUILD is just metadata that describes the structure of your codebase to Pants.