Hi all, I'm currently in the process of evaluating...
# general
r
Hi all, I'm currently in the process of evaluating Pants to improve the management of a Python monorepo. It is constrained to Python 3.8. There is a core project which is included as a relative dependency in the requirements.txt of other projects in the monorepo. However, when I run
pants tailor ::
I get the following warnings for the projects with have the relative dependency in their requirements.txt:
Copy code
20:38:27.52 [WARN] An error occurred when validating `Project/requirements.txt`: Invalid requirement '../CoreLibrary' in Project/requirements.txt at line 1:
 Parse error at "'../CoreL'": Expected W:(0-9A-Za-z).

You'll need to create targets for its contents manually.
To silence this error in future, see <https://www.pantsbuild.org/docs/reference-tailor#section-ignore-paths>
Can anyone advise as to how I can set up Pants to understand my relative dependencies? I've scoured the docs and attempted a few things, but not had any luck. TIA!
c
You don't need to include a mention in the requirements.txt for in-repo dependencies. Pants should infer the dependency from imports. If not, you can also manually add it as a dependency in the target. I think you should just be able to remove that line from your requirements.txt file and it'll work.
r
Thanks, I wasn't aware of that. I'm fairly new to Python and come from a Gradle/Java background so I'm learning at pace - I may well rear my head again 😄 Thanks again.
c
Welcome! Pants also helps a lot with automatic dependency inference.
h
Note: for this to work automatically you do need your source roots to be set up correctly, so if you hit issues, that's one thing to look at.