Figured out a new relatively minimal GitHub Actions recipe for running CI tests against a Python package that uses setup.py for dependencies, taking advantage of the actions/setup-python caching feature to avoid installing packages from PyPI on every run: til.simonwillison.net/github-a

Follow

@simon Why `pip install -e`? That is usually a red flag for me in non-interactive environments, because it suggests you may be relying on some accidental "feature" of the editable install mechanism.

Better to test as your users are expected to install it: blog.ganssle.io/articles/2019/

@pganssle @simon

Concur -- that said, for convenience sake I typically use the clone/-e . in my routine CI, and only go to the trouble of testing isolated installs (tox FTW, of course) as part of my release process.

@btskinn @simon But why? There is or should be no advantage to using -e in a non interactive install. Its only purpose is to allow you to let the installed code reflect changes to the source without installing, but CI does a fresh install each time.

@pganssle @simon

Mostly it's in situations where I want to reuse my dev requirements in CI.

Seems superfluous to have a requirements-dev.txt with '-e .' and a nearly identical requirements-dev-ci.txt with just '.'

@btskinn That just seems weird to me. I mainly put all my requirements in `tox`, and occasionally I'll create a virtualenv where I do `pip install -e . && pip install ipython` just to have a little environment where I can play around with my library or whatever.

You can also just, like, not include `.` in your `requirements-dev.txt` file: `pip install -e . && pip install -r requirements-dev.txt`.

@pganssle that's a good tip, thanks - I've updated the templates to use straight "pip install '.[test]'" instead

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.