fresh-cat-90827
05/17/2022, 4:05 PM$ ./pants_from_sources version
2.13.0.dev2
The repo is currently on 2.10.0
and has all tests/packaging workflows running fine. When I attempt to run tests using Pants built from sources, I get
$ ./pants_from_sources test project::
16:08:14.71 [ERROR] 1 Exception encountered:
ResolveError: 'pymysql' was not found in namespace ''. Did you mean one of:
:my-project
FATAL: exception not rethrown
Aborted (core dumped)
I am confused by this error message.python_tests(
name="project_tests",
dependencies=[
":testdata",
...<redacted>",
"//:pymysql", # Imported dynamically by sqlalchemy
],
sources=[
"project/tests/**/test_*.py",
...<redacted>...
],
)
Where the root BUILD
is
$ cat BUILD
python_requirements(name="my-project",
module_mapping={
"PyMySQL": ["pymysql"],
"protobuf": ["google"],
...<redacted>...
"python-geohash": ["geohash"],
},
)
I had to give the root target a name, after seeing:
$ ./pants_from_sources test project::
15:33:47.43 [ERROR] 1 Exception encountered:
MappingError: Failed to parse ./BUILD:
Targets in root-level BUILD files must be named explicitly.
Docs don’t mention this yet https://www.pantsbuild.org/v2.12/docs/reference-python_requirements, but the sources were helpful.hundreds-father-404
05/17/2022, 4:11 PMfresh-cat-90827
05/17/2022, 4:12 PM2.10.0
is what we usehundreds-father-404
05/17/2022, 4:12 PMuse_deprecated_python_macros
set?fresh-cat-90827
05/17/2022, 4:12 PMhundreds-father-404
05/17/2022, 4:15 PMpants_ignore
?
(use --no-pantsd
to force the warning to re-render)fresh-cat-90827
05/17/2022, 4:18 PM"//:pymysql"
what will this become? I still need python_requirements
with module_mapping
and I have already gave it a name.you don’t get a warning message in 2.10 w/ instructions? are you usingI did ignore those and have noticed now, thanks for this.?pants_ignore
ResolveError: 'pymysql' was not found in namespace ''. Did you mean one of:
:my-project
hundreds-father-404
05/17/2022, 4:49 PMuse_deprecated_python_macros = false
. Land that, before trying to use 2.12
follow the instructions preciselyThere are a few steps involved, unfortunately. And it's an "atomic change" - in-betwen states don't work. You have to do it all in one swoop
fresh-cat-90827
05/17/2022, 5:30 PM./pants update-build-files --fix-python-macros
and it has produced about a 100 error messages for the same file, just FYI:
* `python_requirements` in BUILD: add `name="reqs"
18:09:43.05 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.
* `python_requirements` in BUILD: add `name="reqs"
18:09:43.06 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.
* `python_requirements` in BUILD: add `name="reqs"
18:09:43.06 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal.
But all looks good, I’ve made manual change (one file only).hundreds-father-404
05/17/2022, 5:51 PMfresh-cat-90827
05/17/2022, 7:13 PMhundreds-father-404
05/17/2022, 7:15 PMfresh-cat-90827
05/18/2022, 8:08 AM