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

silly-byte-14207

11/05/2021, 10:29 PM
Hello! I've got a few, hopefully simple, questions that I was hoping someone could point me in the right direction for. Question 1: I have an existing scrapy project I'm trying to put into a pex. Before pex, I would run
scrapy runspider myproj/spider/myspider.py
but now I've got:
Copy code
python_library()

pex_binary(
     name="bin",
     entry_point="scrapy.cmdline:execute"
)
which will execute scrapy but I can't figure how to pass the
runspider myproj/spider/myspider.py
Question 2: Is there a python plugin (or command I missed) that will generate a virtualenv for local development? In the example above I can use pants to generate a pex, but can I use pants to build a virtualenv so I can hack on the project as well? I know I can take a pex and turn that into a virtualenv but was wondering if this is built in
h

hundreds-father-404

11/05/2021, 10:41 PM
Hi! For question 1, you probably want to use a console script. If you use Pants 2.8.0rc3, you can set
script="scrapy"
on the
pex_binary
, and it will be like you're running
scrapy
normally on the CLI To start with trying things out, you could do this:
Copy code
pex_binary(
   name="scrapy",
   dependencies=["//:scrapy"],  # or `3rdparty/python:scrapy` etc
   script="scrapy",
)
Then
./pants package
, and run the resulting PEX directly on your code
For question #2, sounds like you're looking for something similar to https://github.com/pantsbuild/pants/pull/13415?
😍 1
s

silly-byte-14207

11/05/2021, 10:44 PM
8 days ago, great timing
Thankyou so much for the quick replies 🙏
❤️ 2
4 Views