-
-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tailor
generated a target for an invalid requirements.txt
file
#15276
Comments
Can you try passing Are you able to attach the literal content of both/either of those files, unmodified? Perhaps renamed to
It is documented by the thirdparty dependencies page and the Note that the version of the docsite you are looking at matters quite a bit: your link above is to
Yea: sorry about that. There is a missing link between "Getting started" and the per-language introduction pages. For Python in particular, the next step is to work through the Python section.
A
Most critically though: having |
Thanks, @stuhood. Stacktrace:
|
Ah I think I may see a possible cause of the problem. There are a couple of subprojects that have requirements.txt that contain only a comment (because the actual requirements need to be extracted from a Dockerfile). They aren't the subproject where the test is being run, but would that do it? I'll try running tailor with --ignore-paths to exclude the parts of the repo that might not be tailor-ready. |
That workaround got me around the problem. The error was indeed from |
Great! Are you able to include any more detail about the content of those files? The fact that this was a unicode error would lead me to believe that they were actually binary? In any case, this is related to #14974. |
tailor
generated a target for an invalid requirements.txt
file
No, the requirements.txt files in question were not binary. Just text files containing a "#comment". |
Thanks again for the report!: I've opened #15734 for next steps here. |
Describe the bug
Getting started with Pants in my Python monorepo and quickly got the error when trying to run test goal first time
Steps to reproduce:
Configured
pants.toml
like so:Then ran
./pants tailor
to autogenerate BUILD files.This command put
BUILD
files insrc
and subdirectories as well astests
and subdirectories: any directory that contained a *.py file got a BUILD. Visual inspection shows many of the BUILD files in the `src' directories have a single line of code:Note that this
python_requirements()
macro doesn't seem to be well documented as no example code shows it, nor is it in the docs I could find readily. I found a passing mention of it here and it appears to have been automatically added because of the presence of requirements.txt in the same directory.I noticed that other generated BUILD files nested under the /src directories contained:
Not sure what I had accomplished at this point (the step-by-step "Getting Started" instructions seem to peter out after telling you to run tailor) I figured I would see if the tests goal would run, so entered
./pants test path/to/a/pytest/test.py
After Pants crunches for a few seconds I get the "Failed to parse" error listed above. If I go through the automatically generated build files and add an empty line to files with
python_requirements()
I can sometimes make the error go away (or move to a different file) but it's inconsistent: I have added blank lines at the top of all the BUILD files and the error persists so I suspect I was seeing only some variation in the order of execution before hitting the error. The error only occurs on BUILD files containingpython_requirements()
.Pants version
2.10.0
OS
MacOS
Additional info
Please write some more docs about what we can expect to see happen when the
tailor
command is run since many things are mysterious about this to new users:root_patterns
. I didn't expect to see BUILD files in every subdirectory of these configured roots: I have a nested structure to provide some namespacing, not to have a separate build for every leaf in my tree. Perhaps BUILD doesn't always mean BUILD and I should ignore these? Or perhaps tailor isn't working properly because I've structured my code in this nested manner? (which I think is common?) I can't tell at this point and feel pretty confused.python_sources()
macro, which also doesn't seem to be documented very well considering it's output from the very first command the Getting Started instructions have the new user execute.Or if I find I can get some traction with Pants I would be happy to help with documenting things that I learn and that seem not to be documented.
The text was updated successfully, but these errors were encountered: