rpaframework icon indicating copy to clipboard operation
rpaframework copied to clipboard

Invoke cleanup can skip the venv removal

Open cmin764 opened this issue 3 years ago • 6 comments

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?

cmin764 avatar Jun 24 '22 08:06 cmin764

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.

kylie-bee avatar Jun 24 '22 11:06 kylie-bee

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.

cmin764 avatar Jun 24 '22 13:06 cmin764

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.

kylie-bee avatar Jun 30 '22 15:06 kylie-bee

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.

cmin764 avatar Jul 04 '22 08:07 cmin764

To clarify on this:

  1. .venv removal should happen if you explicitly pass an argument to the clean Invoke 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 with numpy on M1), place where I use poetry 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)
  2. Tests won't be executed with --ci param during publish since 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 ?

cmin764 avatar Aug 10 '22 14:08 cmin764

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.

kylie-bee avatar Aug 15 '22 13:08 kylie-bee

This is possible now with: inv install.clean --no-venv and publishing into CI with: inv build.publish --ci --no-build.

cmin764 avatar Sep 28 '22 17:09 cmin764