RobotPajamas / suspenders

Keep those Pants up
MIT License
12 stars 2 forks source link

Automatically regenerate IDE integration steps #125

Open grahamalama opened 1 month ago

grahamalama commented 1 month ago

Initially posted this as a question in the Slack and was encouraged to convert it to an issue here.

The docs have a clear section on how to set up some basic IDE integrations (with VSCode, in my case):

First party deps:

ROOTS=$(pants roots)
python3 -c "print('PYTHONPATH=./' + ':./'.join('''${ROOTS}'''.replace(' ', '\\ ').split('\n')) + ':\$PYTHONPATH')" > .env

Third party deps:

pants export --py-resolve-format=symlinked_immutable_virtualenv --resolve=python-default

It would be nice to rerun these steps automatically when either a source is changed (for first party deps) or a 3rd party dependency is changed.

sureshjoshi commented 1 month ago

Yep, this is a great idea - could be done pretty reasonably as part of some post-pants.toml change hooks that the plugin already needs to have.

Ideally could be back ported into pants.