Skip to content

Commit

Permalink
Devcontainer and CodeSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
vladistan committed Sep 2, 2024
1 parent ec82c74 commit 2939b2c
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "Plain Python 3.11",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": "true"
},
"ghcr.io/nils-geistmann/devcontainers-features/zsh:0": {
"theme": "robbyrussell",
"plugins": "git",
"setLocale": false,
"desiredLocale": "en_US.UTF-8"
},
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {
"jqVersion": "latest",
"yqVersion": "latest",
"gojqVersion": "latest",
"xqVersion": "latest"
}
},
"customizations": {
"codespaces": {
"openFiles": [
"CODESPACES.md"
]
},
"vscode": {
"extensions": [
"ms-python.python@2024.1.10401008",
"ms-vscode-remote.remote-containers@0.342.0",
"tamasfe.even-better-toml@0.19.2",
"eamodio.gitlens@14.8.2",
"MS-vsliveshare.vsliveshare@1.0.5905",
"ms-python.mypy-type-checker@2023.9.12421015",
"ms-python.debugpy@2024.6.0",
"github.copilot@1.172.0",
"github.copilot-chat@0.13.0"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
}
}
}
},
"updateContentCommand": ".devcontainer/env_setup.sh"
}
14 changes: 14 additions & 0 deletions .devcontainer/env_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

sudo apt update
sudo apt install -y python3-ament-xmllint

pipx install pre-commit

pre-commit install || true

python -m pip install --upgrade pip
python -m pip install '.[dev]'
python -m pip install -e .

pre-commit run -a || true
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ repos:
rev: v1.0.0
hooks:
- id: format-xmllint
exclude: .run/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand Down
21 changes: 21 additions & 0 deletions .run/pytest.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="pytest" type="tests" factoryName="py.test" nameIsGenerated="true">
<module name="greenbutton_objects" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="SDK_NAME" value="Python 3.12" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;&quot;" />
<option name="_new_targetType" value="&quot;CUSTOM&quot;" />
<method v="2" />
</configuration>
</component>
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Module",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"justMyCode": true
}
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"mypy-type-checker.ignorePatterns": ["*/tests/*"]
}
29 changes: 29 additions & 0 deletions CODESPACES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Developing in Codespaces / DevContainer

Looks like you have opened this project in GitHub Codespaces or a Dev Container.
Here are some important things you should be aware of:

1. **Ready Environment & Auto-Configuration**: The environment is pre-configured
there is no need for any manual setup. Newly created codespaces will
automatically run initialization tasks. If you see a message like the one below
wait for the setup completion before running tests or making commits.

```
Finishing up
Running postStartCommand
.devcontainer/post_start.sh
```

2. **Pre-configured VS Code Extensions**: This setup pre-installs some VSCode
extensions for you, but some may need a window refresh to activate. If your
sidebar extensions icon looking like the one below, click on it to check the
messages:

![Extensions loading](images/vscode_extension_attention_needed.png)
![Extensions wait](images/vscode_extension_wait.png)

3. **GitHub Copilot**: We've included this, but remember it requires a
subscription. If you're not a subscriber, you can safely ignore any error
messages related to Copilot.

If you encounter any issues or need help, please reach out to the project maintainers.
Binary file added images/vscode_extension_attention_needed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode_extension_wait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.

0 comments on commit 2939b2c

Please sign in to comment.