neuromodulation / py_neuromodulation

Real-time analysis of intracranial neurophysiology recordings.
https://neuromodulation.github.io/py_neuromodulation/
MIT License
41 stars 9 forks source link

Improve Github actions testing workflow #311

Closed toni-neurosc closed 2 months ago

toni-neurosc commented 2 months ago

So, as I mentioned in issue #310 I wanted to see if Rye could speed up setting up the testing environment for Github actions automated testing.

In the end I made several changes:

Overall, the testing time in Linux went from 2m20s to 1m10s, so that's half the time if my math is correct.

PS. Oh, and forgot to add that tests run in Windows now as well

PS2. With dependencies already cached, 59s on Linux!

timonmerk commented 2 months ago

Wow, that's amazing @toni-neurosc! Thanks soo much looking into that and fixing this in such an elegant way!

Do you think it makes sense to also recommend to use the uv installer as recommended tool? Currently I mentioned in the ReadMe rye, but I think it still uses pip under the hood.

I would be curious to know how you would recommend that. I saw in our meeting you used conda to create an environment, but for my machine the dependency resolving was with conda way too slow so I tried to recommend rye and leave out conda altogether..

toni-neurosc commented 2 months ago

Hi @timonmerk . So, Rye does indeed use 'uv' as an installer, it's all developed by the same people (Ruff, Rye, uv).

The problem I see with Rye is not that is not a good tool, it's that it serves a different purpose. Rye is more like, a dev environment manager, and a build/deploy tool. So in that sense, it's more like an alternative to Hatch, and in the "contributing guidelines" that you mentioned in another message, we should tell people to use either one or the other, and choose one to manage our dev tools and dev environment, building docs, publishing and all that fuss.

In fact using Rye might be problematic for end-users, since they need to sync their environment with our project with rye sync, conform to our version Python, and activate the .venv created by Rye which they might not want to do e.g. if they're developing their own tool that depends on PyNM and they just want to add it as a dependency, in which case they should be doing rye add py-neuromodulation and not rye sync!

On the other hand 'uv' is more like a faster version of pip, in fact is almost a drop-in replacement, so you could just in theory do alias pip="uv pip" and it would work pretty much the same but faster.

So I think in our "install guide" (not for devs, just for users) we should recommend doing either pip install py-neuromodulation or uv pip install py-neuromodulation. They'll get the package the same, but we can throw 'uv' some support by recommending that people use it 😄