Invoke cleanup can skip the venv removal
I find it tedious and time consuming to have my .venv removed each time I'm publishing a tiny fix in a package. Is it safe to add a venv flag on the clean task (and its invokers) so each time we (in)directly call clean we have the option to skip .venv cleanup?
My understanding was this complete removal was to account for the possibility of contaminated venv environments during development. We could add a flag, but for the publish task, I do have some slight concerns about that, especially since I created the install-local task which produces a venv that doesn't match the to be published package's pyproject.toml or lock file.
I see, so we might risk going forward with a persistent .venv which might trick the tests and have a chance at publishing potentially hidden issues? What if we keep the .venv for publish --ci only?
Anyway, the install-local is available in the meta package (and we don't publish with that). Also, every time I manually edited the .venv, publishing was complaining about some subpaths mismatching and I could't even build the package in the first place (so that prevented me publishing with a non-clean .venv). But if I'm the only one feeling I'm wasting time with .venv recreation each time we publish, then we can close this issue as won't fix.
I think allowing no rebuild for publish --ci makes a lot of sense actually, so I think with that scope in mind, this issue can be implemented.
Will definitely save a lot of time from manually going to edit my tasks.py scripts beforehand every time I'm CI-publishing, because me personally, will never allow myself to waste time on .venv recreation without a sane reason.
To clarify on this:
.venvremoval should happen if you explicitly pass an argument to thecleanInvoke command when doing it. (as it creates many headaches to recreate the .venv each time if that's not happening as it should by default on the system -- example: recreation of the .venv will use by default Python 3.10 on my Mac but I want it created manually with Python 3.9.13 (since that's working withnumpyon M1), place where I usepoetry env use <path/to/python>initially and then it stays like that until .venv gets removed; and Invoke ofc doesn't do that for me)- Tests won't be executed with
--ciparam duringpublishsince I'm only interested into pushing the package to our PyPI for testing purposes. (later on when I decide to really push in prod, then yes, I expect to have the entire pipeline running including tests)
Don't you think we'll save dev time like that @mikahanninen / @blakewaud / @osrjv ?
Taking a look again, and with regards to your point 1, the meta-package tasks.py already allows for the use of clean --no-venv. I think it makes sense to add similar flags at the package level and implement similar flags on publish that only work when --ci is used.
This is possible now with: inv install.clean --no-venv and publishing into CI with: inv build.publish --ci --no-build.