3 ms·
You can check that a venv exists by looking for .venv/pyvenv.cfg. Is that not enough? Unless you also need to check that all packages are installed and up to da
by 323 4y ago
You can check that a venv exists by looking for .venv/pyvenv.cfg. Is that not enough? Unless you also need to check that all packages are installed and up to date.
- fbdab103 4y ago1) Confirming that the environment is in sync with my definition file (pyproject.toml or lockfile) is my true objective. If I suddenly add libraryFoo to pyproject.toml, but I forget to run `poetry install`, I want my `make test` command to note the discrepancy and correct the situation. 2) I think that has some brittleness of detecting where the environment lives (as per the author's post). For my use case, I would be fine assuming the defaults, but it is something else to go wrong Edit: Thinking out loud, I guess the quickest solution is to checksum the pyproject.toml file and store that somewhere. If current hash matches previous, do not run `poetry install`. While that would get me there, I am hoping for a first-party, standard solution.
- 323 4y ago> I guess the quickest solution is to checksum the pyproject.toml This is the kind of stuff bazel/ninja do. https://bazel.build https://bazel.build https://ninja-build.org https://ninja-build.org
- jaccarmac 4y agoThanks for the heads-up about that file; I use a similar development setup and have been slacking on wiring Make rules together because I thought I would have to touch my own files. It would be nice if the files Python installed had better timestamps, though. I'm the only one using Make on the team and install some tooling of my own, so have to chain upgrade Pip -> install deps -> install tools in the correct order. I'm not sure how to automate that order without running all three steps every time.