Skip to content
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

Merged
merged 18 commits into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
{
"name": "Torchgeo DevContainer",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:3.12",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": { "version": "os-provided" }
},

// "postCreateCommand": "",
"postStartCommand": "pip install -e .[all]",

// Enable GPU support
"hostRequirements": {
"gpu": "optional"
},

"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.isort",
"ms-python.black-formatter",
"ms-python.vscode-pylance",
"ms-python.pylint",
Comment on lines +26 to +27
Copy link
Collaborator

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.

Copy link
Contributor Author

@julien-blanchon julien-blanchon Mar 2, 2024

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

Copy link
Collaborator

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.

Copy link
Contributor Author

@julien-blanchon julien-blanchon Mar 2, 2024

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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?

"ms-python.flake8",
"ms-python.mypy-type-checker",
"GitHub.codespaces",
"ms-toolsai.jupyter"
],
"settings": {
"telemetry.telemetryLevel": "off",
"python.languageServer": "Pylance",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "/usr/local/py-utils/bin/pytest",
"python.editor.formatOnSave": true,
"python.editor.formatOnSaveMode": "file",
"python.editor.formatOnPaste": false,
"python.editor.codeActionsOnSave": {
"source.organizeImports": true
},
"python.diffEditor.wordWrap": "off",
"isort.args": ["--profile", "black"],
"isort.path": ["/home/vscode/.local/bin/isort"]
}
}
}
}
Loading