Running virtualenv to set the ENV

Chris Angelico rosuav at gmail.com
Thu Apr 25 02:28:58 EDT 2019


On Thu, Apr 25, 2019 at 2:38 PM Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 25Apr2019 12:05, Chris Angelico <rosuav at gmail.com> wrote:
> >> venv-requirements.txt
> >>   Periodically I run "pip freeze >venv-requirements.txt"; this file is
> >>   revision controlled. That way I can rebuild an equivalent venv
> >>   somewhere else later.
> >
> >Any particular reason for this name? If not, I would generally
> >recommend calling it "requirements.txt", as this is a minor
> >convention. For instance, Heroku will recognize the presence of this
> >file as an indication that this is a Python app, and will
> >automatically "pip install -r requirements.txt" as part of deployment.
> >
> >Otherwise, I broadly agree with your directory structure (although I
> >won't bother with a lib/python directory most of the time).
>
> Both of these stem from not working only in Python. For example today
> I've working on a project with a Python/PostgreSQL backend+cli, and a
> javascript frontend.
>
> The "venv-requirements.txt" makes it clear that it is for the venv
> directory, and it also sorts nicely together in the directory listing.

That's fair; OTOH, these are the project's dependencies, which is
nothing to do with whether you're using a venv or not. Doesn't make a
lot of difference (unlike NPM's package.json, which absolutely has to
be called that, or tools won't find it), so do whatever makes sense
for you.

> The lib/python is an old habit, as my home directory has a lib/python
> sitting beside my ossifying lib/perl. So I find the extra specificity
> useful. And once I've made one or two convenience top level symlinks the
> depth doesn't matter for interactive purposes.

Ossifying doesn't mean "turning into Open Source Software", but I know
I've had messy directories sitting around as I OSS-ify something :)

ChrisA


More information about the Python-list mailing list