is there an easy way to speed up developing with d...
# general
g
is there an easy way to speed up developing with django + pants? atm the even the most minimal change takes ~8-10 seconds to reload the django development server without pants this is nearly instant
🤯 1
w
What command are you running via pants?
g
pants run src/fings:manage_dev_pex -- runserver_plus
and the relevant build file entry
Copy code
pex_binary(
    name = "manage_dev_pex",
    dependencies = [
        ":src",
        "3rdparty/python:reqs#django-extensions",
        "3rdparty/python:reqs#Werkzeug",
    ],
    entry_point = "manage.py",
    execution_mode = "venv",
    restartable = True,
)
h
I have a solution for this, will post in a sec
after this meeting
The recommendation is to let Pants do the autoreloading (it is more accurate than Django’s anyway):
Copy code
./pants run helloworld/service/admin/manage.py -- runserver --noreload
👀 1
In that example repo there’s some logic to automatically apply
--noreload
so you don’t have to remember it: https://github.com/pantsbuild/example-django/blob/main/helloworld/util/service.py#L31
I think you’re also hitting the difference between running a file and running a target, where the former is faster because it doesn’t rebuild a sandbox (I think, @bitter-ability-32190 can confirm)
b
That, uh won't work today for that use-case,
python_sources
doesn't have a
restartable
field 😮
Super easy to add though 🙂
Then, it will reconstruct the sandbox. But won't be building a full PEX. So better perf, but not instant
g
is there a way i can help with this? im a little bit overwhelmed with the whole but maybe im able to implement this on my own if i get pushed in the right direction? 🙂
b
It should be suuuuuuuuper simple 🙂
I'll comment on the ticket with the changes required (form a high level)
g
ok. but i think the first step would be to install pants in a way so i can walk on the bleeding edge? ^^
b
oh lolol you are the one who filed the original ticket 😂
g
i know ^^
b
Follow that guide, then you can follow https://www.pantsbuild.org/docs/running-pants-from-sources to use bleeding-edge on your repo
FWIW you can easily test this behavior in the Pants repo though
g
kk. i will take a look a this tomorrow. today to much celebrations on other projects 😄
b
🎉
g
today i can burp in 1 and a half promille! 🙂
h
Oh, yeah, this is going to be really important for performance in this case
❤️ 1
g
@bitter-ability-32190 ok, i've implemented the changes. that was really simple. you've noticed something about
python_test_utils
and
python_tests
do you mean i should add
restartable
to this too?
b
Let's open that can up in PR. I want the permanence if the discussion there