https://pantsbuild.org/ logo
r

rapid-bird-79300

04/07/2022, 9:33 PM
Hey Pants Team,
update-build-files
goal shows errors to add
name
to
poetry_requirements
but that's not a supported option. Since the
pyproject.toml
lives at the root of the project I believe this error is related:
Copy code
njgrisafi@Nicks-MacBook-Pro ~/workspace/pants-example (build-file-defaults)$ ./pants lint ::
14:28:42.68 [INFO] Initializing scheduler...
14:28:42.88 [INFO] Scheduler initialized.
14:28:42.93 [ERROR] 1 Exception encountered:

  MappingError: Failed to parse ./BUILD:
Targets in root-level BUILD files must be named explicitly.
example branch: https://github.com/njgrisafi/pants-example/tree/build-file-defaults
👀 1
this was the output from `update-build-files`:
Copy code
njgrisafi@Nicks-MacBook-Pro ~/workspace/pants-example (build-file-defaults)$ ./pants update-build-files --fix-python-macros
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
14:22:38.03 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.

  * `poetry_requirements` in BUILD: add `name="poetry"
h

happy-kitchen-89482

04/07/2022, 9:34 PM
What happens if you add those names?
h

hundreds-father-404

04/07/2022, 9:35 PM
Hi Nick! The deprecation for using the new macros is very particular. At the same time that you add the name field, you must also change the global option for use deprecated python macros
There is a very awkward and unfortunate in between where things do not work in a partial state
r

rapid-bird-79300

04/07/2022, 9:36 PM
after adding name to
poetry_requirements
it fails to parse the BUILD file:
Copy code
njgrisafi@Nicks-MacBook-Pro ~/workspace/pants-example (build-file-defaults)$ ./pants update-build-files --fix-python-macros
14:20:38.53 [INFO] Initializing scheduler...
14:20:38.70 [INFO] Scheduler initialized.
14:20:44.74 [ERROR] 1 Exception encountered:

  MappingError: Failed to parse ./BUILD:
__call__() got an unexpected keyword argument 'name'
h

hundreds-father-404

04/07/2022, 9:36 PM
Did you set the global option?
r

rapid-bird-79300

04/07/2022, 9:36 PM
is that for
use_deprecated_python_macros
?
h

hundreds-father-404

04/07/2022, 9:37 PM
Yes
Set it to false
r

rapid-bird-79300

04/07/2022, 9:40 PM
that seems to have did the trick thank you @hundreds-father-404!
❤️ 1
h

hundreds-father-404

04/07/2022, 9:40 PM
Great! I wish so badly that the deprecation could have been less intricate