Add `uv` building system and add `gpu` support/Makefile
Whom it may concern,
Do you think that:
- adding
uvin addition to pip to support the integration with the modern dependency systems - with addition of
jaxversions and for the sake of build simplification, would it be useful to add aMakefilefor different builds and update the dockerfile with the gpu requirements
Thank you!
Thanks for raising this! I think both points make sense, especially:
-
Using uv alongside pip could simplify reproducibility and align with modern dependency practices.
-
A Makefile would be really helpful for standardizing builds across environments (CPU vs GPU), and it could also serve as an entry point for CI/CD pipelines.
I’d be happy to help draft the initial Makefile with targets for:
-
CPU build
-
GPU build with JAX
-
Docker image update for GPU dependencies
Would you be open to me taking a first pass at this and submitting a PR?
Hi @YashSachdeva. In spite of me fully sharing your intentions, I would still wait for any opinion of the maintainers first.
Hi guys,
Thanks @alexunderch . I don't know about uv and it's the first I'm hearing about it.
I've had numerous requests like this in the past. The problem is that I barely have any time to support OpenSpiel in its current form. When something major like this is added, and then it falls on me to support it, long-term that's an issue because I am not familiar with it and it would cost time I don't have to learn it.
Would there be a way to add this and mark it as optionally supported? Or maybe one of you could offer to support it if something breaks? E.g. would it necessitate any changes to the current pip system? Keep in mind that we also need to keep everything working internally for our project use cases.
Curious to see how this could be put into place but still not affecting my usual pip support workflow. Can you give an outline as to what would be added and where?
Let me know what you think,
BTW when you say 'Makefile' do you really mean the same GNU Make Makefile? I find that a bit odd for python-based projects given that they're all dynamically run....? (I'm likely out of the loop!)
Most importantly, I'd like the following question answered: would we be adding this because it's cool and hip, or is there currently something that can't be done without it? (E.g. JAX port of AlphaZero).
I'm afraid I can't entertain supporting this just because they are nice and cool (unless someone other than me helps support it long-term ... :-p ) and it doesn't interfere. We had that kind of this with a Dockerfile, for instance. It was nice to offer that but we didn't use it ourselves, so we marked it as not supported and could break at any time.
Yes, sure, I'll shortly try to be sure if it's possible to keep both, pip and uv, simultaneously supportable. Reason, why I asked in the fact that uv is being used in many projects and, secondly, it has a different dependency resolution system which may allow to flexibly include/configure it with to other projects.
For Makefiles, yes, but I had in mind like hardware dependent docker runs or testing (rerun only make install/test other than a long bash install/build other than python scripts).
I absolutely understand your concerns about long-term support, will address them. Sure, a lot of things could be done without that and so are they being. Somebody would've asked it in some time, me or not me.
Thanks.
If e.g. uv is so popular that it's a candidate to replace pip, then that would change my stance, of course.
So, simultaneously, I will look into it.
In case helpful, note that whether or not you use uv in open-spiel does not affect your users' ability to use uv themselves. So if you make changes here it should be because different tooling makes your life easier (or other contributors / maintainers of open-spiel's lives)
really, looks like a smth transient and easy to support: https://docs.astral.sh/uv/guides/migration/pip-to-project
@hauntsaninja, does uv work nicely with external build systems, like cmake? or it is only for the python part?
If I drew an draft configuration, would you look into it?
It's sort of in between. You should be able to use uv as a project manager with extension modules, but you can't yet use the uv build backend (uv_build ) for extension modules — you'll have to stick with setuptools (or scikit-build-core which has a nice cmake integration)
Yeah I'd take a look (but no promises / I haven't dev-ed on open-spiel myself)!