-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Add devcontainer #1085
✨ Add devcontainer #1085
Conversation
What is this and why would we want it? |
Hi, devcontainer make it easier to contribute, basically you just define the what's the basic/minimal development system (here ubuntu+python and requirements), and open source contributor could directly launch the repo on this predefine system. The usual usage are:
So it's kind like your conda env, redondent with ./requirements but help a lot in the user/dev perspective. It's up to you, I will at least keep it on my branch as it help me standardize my development system |
I've never heard of or used any of these things before, so I guess it's difficult for me to want to maintain these files. I've at least used pip/conda/spack before, so I don't mind supporting those installation methods. But any file we add to this git repo is something we're committing to maintain, and I'm trying to keep that burden minimal. Like the docker PR, this feels very specific (what if someone wants to use RHEL instead of Ubuntu? or macOS or Windows? or Python 3.8?), and we don't want to maintain a file like this for every system and Python version. Maybe we could just add this file to At least it doesn't duplicate the list of places I need to update dependencies. I would like to get rid of So this isn't a no, but I'm not yet convinced. |
@julien-blanchon thanks for the contribution! I've never used Codespaces before, is the idea that if you open @adamjstewart I don't think this is a huge overhead (similar in scope to the pre-commit hook) and generally makes it easier for some people to edit. The only thing we would need to change is what is |
I want to get rid of this too 😆 |
Why -- you don't have to maintain it? (put differently, these things don't get released / tested -- if they break they are going to break for technical people that are already trying to contribute and who will tell us about it) Is there a like this nagging feeling that you get when something isn't under the comforting umbrella of |
Someone has to maintain it. precommit becomes quickly out of date any time a style or mypy dep changes. I just had to upgrade the black version the other day.
Yes 🙂 |
Yeah but that's only because you have an insane memory for these things. If you forgot, then nothing bad would have happened and ashnair would have gotten to it (https://github.com/microsoft/torchgeo/commits/main/.pre-commit-config.yaml). If ashnair didn't get to it then someone else would have. |
(@julien-blanchon sorry for meta-discussion here, do you mind signing the CLA?) |
Yes sure,
@microsoft-github-policy-service agree |
Here is a little example on the vscode desktop app. It should also work with Intellij, expect for the extensions part. Screen.Recording.2023-02-04.at.02.03.47.movCPU and GPU configuration must be split, at least for now. About codespace, here is the setup example: The image build could be quite long, expecially with codespace. So you can enable image prebuild in "settings/codespaces/prebuild_configurations/new". So any contributor will be able to launch the project with the specify configuration (same extensions, same black/mypy/... conf ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not convinced that this is something we want to maintain (why stop at codespaces when there are dozens of other editors and environments with dotfiles we could add?) but figured I would comment on some of the issues I see.
I'm slowly warming up to the idea of adding this. Other repos (nbmake) also ship devcontainers, and it can make it easier to reproduce bugs. |
@adamjstewart I'd like to merge this, I don't see any of the open issues as blockers and it makes it easier to for people to contribute to torchgeo |
I see all of the above as blockers, shouldn't be hard to investigate these. |
Here is some improvement we can do in term of .devcontainer:
|
@julien-blanchon are you still working on this? Would love to get this merged someday so we can use codespaces for PR reviews. |
@adamjstewart Could you have a look ! It's way simpler than before and work both on CPU and GPU |
"ms-python.vscode-pylance", | ||
"ms-python.pylint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these? Not sure if I want to enforce any style constraints that aren't already enforced in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's extension, I would keep them espectially pylance. This give many IDE feedback to the user even before the CI. For example the current settings will display pylint error on the IDE side before any CI. Black will also auto format the code on file save with the same specification as the CI. This may put less work on the CI side and enforce best practice directly in the IDE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I definitely want to keep black/mypy/isort/pydocstyle/flake8 because we also enforce that in CI. I'm specifically commenting on things like pylance and pylint which we don't use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove pylint. I would keep pylance anyway because it's just visual, it doesn't enforce anything, but feel free to remove it if you'r sure you don't need it
Btw for torchgeo in general you can have a look to ruff that bundle everything in a single package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1908 (comment) for my thoughts on ruff. Not strongly opposed in principle, but let's discuss that in a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does pylance flag anything that the other tools don't flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know much about this, but someday I'll learn how to use Codespaces and VS Code.
Can you tell me more about the failing tests? Do those tests fail for you when manually run in your local environment, or do they only fail in VS Code? |
Seems to be due to the Python version. I think it's gone with the 3.12. I'm looking into that |
That's still odd, since we test Python 3.9–3.12 in CI and all pass. |
Let's merge as is. We can always make improvements in future PRs. Want to squeeze this in before our next release. |
* ✨ Add devcontainer * 🐛 Add postCreateCommand.sh * Downgrade to Python 3.10 * Add gdal * Separate CPU/GPU devcontainer.json * Add cpu as default * Rename default * In order to enable vscode black auto format, color must be disable ! * Remove default root devcontainer * Format and clean * Switch to .[dataset ...] * Add postStartCommand with pip install -e . * Fix black * Update * Mise à jour des commandes postCreateCommand et postStartCommand dans devcontainer.json * 🔥 Add devcontainer * Update Python version and postStartCommand in devcontainer.json
I'm going to investigate next week about the tests failed. I don't think it's blocking anyway |
Add
.devcontainer
directory with basic working devcontainer