https://pantsbuild.org/ logo
#general
Title
# general
i

incalculable-hydrogen-44003

08/24/2022, 4:57 PM
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

hundreds-father-404

08/24/2022, 4:58 PM
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

incalculable-hydrogen-44003

08/24/2022, 4:59 PM
Thanks for the response. I just don't want it to do any building or packaging.
h

hundreds-father-404

08/24/2022, 5:00 PM
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

incalculable-hydrogen-44003

08/24/2022, 5:02 PM
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

hundreds-father-404

08/24/2022, 5:04 PM
What do you mean? What was the error?
i

incalculable-hydrogen-44003

08/24/2022, 5:38 PM
Pants seemed to get confused and install the wrong dependencies
So the build would fail
p

plain-summer-72727

08/24/2022, 5:38 PM
(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

hundreds-father-404

08/24/2022, 5:39 PM
Ah yep, multiple resolves will fix that 🙂
🙌 1
p

plain-summer-72727

08/24/2022, 5:39 PM
Thank you!
h

hundreds-father-404

08/24/2022, 5:39 PM
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

plain-summer-72727

08/24/2022, 5:40 PM
Will do!
6 Views