Repository navigation
MNT Add initial setup for devcontainer - #31096
Conversation
|
Want to make it "not a draft" so we can merge this? |
Done 😉. I was planning to add some minimal doc somewhere, but this can be done in a further PR. |
|
Maybe we should add some minimal doc first to avoid confusing people. For instance, when opening VS Code on macOS on a latptop with an arm64/M1 processor with the scikit-learn source folder checked out on this branch, VS Code asked me if I wanted to reopen the project within the dev container but then it fails with the following log: DetailsI think this is related to devcontainers/images#545. So maybe we should at least document the purpose of this file, namely, to be used to open the scikit-learn project via the GitHub Codespaces editor. |
|
I am trying again after editing the json config to use EDIT: the initial setup seems to be fine but you still end-up in a non working env: So we should definitely manage expectations and let users now that this devcontainer config is only meant to be used via GitHub Codespaces and not intended for local dev with VS Code. |
|
After a quick conversation with perplexity.ai it seems like there is no way to have a devcontainer setup that is only used by code spaces and does not lead to a prompt by VS Code when used locally. But maybe VS Code remembers your preference? Said differently: it would be nice to have a documentation for people on how to stop VS Code asking you to use a devcontainer every time you start your editor. I tried to experiment with this locally but I never get prompted :-/ Maybe because I don't have docker installed on my laptop? I think having an easy way to avoid being prompted every time would be nice for users (and not trivial to find out how to do this) and would reduce the number of people who use the devcontainer. The latter might be important unless we want people to use the container also locally, in which case we need to somehow get ready to answer questions about things that go wrong. I've used devcontainers a bit for cuml, and while it was nice at first to solve setup problems, over time you discover more and more things that you need to "fix up" (e.g. ssh key forwarding/sharing for signed git commits, accessing local directories with datasets, etc - none of these are rocket science, but also not 1min jobs) |
|
Getting back to this, what would it take to get this merged? A few lines in I would think it would be useful to have it as backup for the PyData upcoming sprint and be able to test it, for people that have trouble getting setup. |
|
I changed the base docker image to be smaller so that the container starts a bit quicker. https://github.com/devcontainers/templates/tree/main/src/ubuntu claims that it support arm64/Apple Silicon so maybe the issue with running locally the devcontainer on macOS arm has gone away? |
|
To try using codespaces on this PR:
Doesn't work for me on Firefox for me (and Tim according to #31091 (comment)) but it works for @StefanieSenger so it may be down to browser settings (like addon/3rd party cookies etc ...). Works fine for me on Chromium. This was also noted in #31091. |
|
Can we make a separate repository (for sprints) that contains sprint setup instructions and a devcontainer? I don't remember everything I was thinking when we last discussed this, but it was the first idea that pop into my head when re-reading the last few comments on this PR. |
|
Codespaces is setup to open the repo code as a project in the VSCode tab. I guess if you do it in another repo, you would need to do additional work to do clone the scikit-learn repo (easy) and open it as a project in VSCode (not sure how easy this is). This also feels more natural to go to the repo you want to work on i.e. scikit-learn/scikit-learn and open a Codespace directly on it. To be honest, I am not sure what prevents us from merging this PR to try it out in a sprint ... the worst possible outcome is that the devcontainer is not that useful for sprints or breaks too often without us realizing and we eventually remove it. On having a separate repo for sprint instructions, I feel this is a slightly tangential discussion. |
I agree the most natural place is the repo itself. What I was thinking is that if we mainly want people to use this for sprints, then maybe having a dedicated repo for that would make sense. With instructions and devcontainer and so on. (There is already a sprint repo that I keep referring to for short beginner events, but I can't find it right now).
I think we can try it. The biggest downside that I expect is that I'll have to work out how to tell VS Code to stop asking me to use the devcontainer. But hopefully that is easy |
|
For further reference: here is what happens for now when you open the scikit-learn folder in VSCode (on this PR branch). If you don't take any action the dev container is not used which is what you want.
If you click on "Don't show again" you will never see this popup again. There is also a setting I would guess that not too many people are likely to click "Reopen in Container" and be confused in case it is broken, but maybe I am wrong ... I guess @betatim clicked "Don't show again" which is why he doesn't see the popup. |
betatim
left a comment
There was a problem hiding this comment.
Let's try it, use PyData sprinters as testers and see what we think
|
This will be a nice tool for new and occasional contributors, thanks @lesteve! I think we can add to the shell file, so that users get a ready to use setup, no? |
|
Interesting suggestion @StefanieSenger, I did not think about this at all. A Part of me likes it:
A part of me doesn't like it so much
|
|
Maybe we can print a message with the command when the container starts or somehow display it? Or even more adventurous: can we run the install command but have meson do nothing until the package gets installed the first time? I think I'd use codespaces mostly for making small typo fixes or similar "small things" - in those cases having to wait for it to start is annoying. |
|
Yeah there is definitely room for improvements in the future. Here is my current plan:
|
|
I agree with the argument that building the package is an important part of contributing. So this comes down to not build automatically, but to have beginner-friendly documentation for it. Maybe a small section in the contribution guide that introduces codespaces as an alternative for beginners that explains how to build from source (because it won't be obvious to people) and also how to see the build docs, which one needs to expose a port for ( |
|
I have some weird experience but I'm using cursor:
I'm not going to merge right away but we can quickly check before the sprint. |
Basically the first time you need to wait ~3 minutes for the container to build. In VSCode there is a small popup pointing to the build log when it starts to build. We probably want to look at this and see whether there is any relevant information in there. |
glemaitre
left a comment
There was a problem hiding this comment.
Actually, I was not patient enough apparently. It would be nice to have the output of the setup.sh. So we can see how to improve further.
|
Actually, testing in VS code with @rouk1, he got the output of the |
|
FYI: the VSCode popup situation and how to remove it was summarized in #32516 (comment). |


Instructions how to try it out are in #31091.
I guess let's try to keep feed-back about the user experience in #31091.