silly-queen-7197
01/25/2023, 6:28 AMrequirements.txt
and requirements-dev.txt
. The first is for 3rd party dependencies we use in our application while the second is limited to pytest
, black
, flake8
, and the like. When developing we have one venv
that we can point VS Code . In addition to the code completion benefits we can use VS Code's Testing extension with python to easily set breakpoints when debugging tests.
I ran ./pants export ::
but pytest
isn't included as a dependency in the main venv
it exported and I'm not sure how to use the exported pytest
venv
as it's not able to import any of my code (I'm using a src
style layout). I could just include pytest
as a 3rd party dependency and specify export = false
in my pants.toml
but I don't want to ship pytest
to production.
How can I setup Pants so I can maintain install dependencies (e.g. pytest, typeshed, etc) to facilitate a good developer experience while ensuring I don't ship dev dependencies to production?high-yak-85899
01/25/2023, 6:34 AMhigh-yak-85899
01/25/2023, 6:35 AMsilly-queen-7197
01/25/2023, 6:43 AMhappy-kitchen-89482
01/25/2023, 7:05 AMrequirements.txt
(and the lockfile you are hopefully generating from it) as a "universe" of allowed 3rdparty dependencies. But Pants will actually use just the actually needed subset from that universe. So if Pants is building your production binaries, you can safely have pytest
etc in your requirements.txt
, and it won't show up in production.happy-kitchen-89482
01/25/2023, 7:08 AMrequirements-dev.txt
, a resolve can span multiple requirements.txt files, so when you ./pants export --resolve=python-default
you'll get a venv with everything from both files in it. But you do need a python_requirements(source="requirements-dev.txt")
target of course.silly-queen-7197
01/26/2023, 8:33 AM