Hello. I have a submodule that I only want linting...
# general
i
Hello. I have a submodule that I only want linting and tests to run on. It has its own requirements.txt that unfortunately pants can not manage(it is a serverless framework project) but I do want to use the standard pants lint and test commands. Is there a way to do this?
h
Hi there! What are the things you don't want Pants to do on this code?
It has its own requirements.txt
Have you heard about multiple resolves? https://blog.pantsbuild.org/multiple-lockfiles-python/ https://www.pantsbuild.org/docs/python-third-party-dependencies#lockfiles
i
Thanks for the response. I just don't want it to do any building or packaging.
h
Okay, that should be fine. You would avoid adding
package
target types like
pex_binary
,
pyoxidizer_binary
, and
python_distribution
. Otherwise, do the same thing as normal. Likely, you will want to use "multiple resolves" if that project's requirements.txt is meant to be separate from the rest of your repository, which it sounds like it is
i
got it. We were running into an error with Pants getting confused about the requirements.txt that was not in the root. You think this will solve that?
h
What do you mean? What was the error?
i
Pants seemed to get confused and install the wrong dependencies
So the build would fail
p
(w/ Sepehr) It was a dependency ambiguity error that I think will be resolved once we use multiple lockfiles:
Copy code
00:48:04.83 [WARN] The target src/{app}/main.py:lib imports `jwt`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['//:root#pyjwt', 'src/state_machines:reqs0#pyjwt'].
h
Ah yep, multiple resolves will fix that 🙂
🙌 1
p
Thank you!
h
you're welcome! let us know if you have questions on how to use it. We still want to create better guides on how to get set up & best practices
p
Will do!