Hacker News new | ask | show | jobs
by ageofwant 2381 days ago
Nice. I do however much prefer keeping the venv out of the source tree where they do not interfere with `tree` and `grep` and whatnot. I'm curios what benefit you see with having the venv cluttering the work-space ?
4 comments

It took me a while to be convinced to switch to in-folder venv but the benefits are

* VS Code configuration so much easier as you can point to the correct env using a relative path in settings.json and check that in

* Predictable paths to execute tasks / build

* No outside of development tree vens that you forget to clean up or forget to deactivate

* No different to node_modules, .git or similar when it comes to "polluting" the local project tree as you can .gitignore it

> as you can .gitignore it

As well as ignore config in codecov, black, flake8, mypy and so on...

We setup systemd with gunicorn or uwsgi start in the project venv. So when they are created inside the project folders is easy to have the automated deployment for Python softwares easy with systemd services or local scripts.

Our developers use mac, windows and Linux for development and each one have different location of venv with poetry, if we start gunicorn or uwsgi they may make mistakes. With predictable venv location all can work the same way from within project directory.

If you use a grepping tool like ripgrep it will automatically ignore everything in your `.gitignore`, so at least for that specific case you're covered.
Your app is self contained in a single folder (not 2), run scripts are simpler (can use relative paths like ./venv/ Scripts/foo, no need to “activate”...