Add a Devcontainer (#6290)
This commit is contained in:
parent
db002cb958
commit
742c8fd3f3
22
.devcontainer/devcontainer.json
Normal file
22
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "moto",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/python:0-3.11",
|
||||||
|
"remoteUser": "root",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": ["ms-vscode.makefile-tools", "ms-python.python", "ms-python.black-formatter"],
|
||||||
|
"settings": {
|
||||||
|
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
|
||||||
|
"python.formatting.provider": "none",
|
||||||
|
"[python]": {
|
||||||
|
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postCreateCommand": "python -m venv .venv",
|
||||||
|
"postStartCommand": ". .venv/bin/activate && make init"
|
||||||
|
}
|
@ -52,3 +52,31 @@ If black fails, you can run the following command to automatically format the of
|
|||||||
make format
|
make format
|
||||||
|
|
||||||
If any of these steps fail, please see our :ref:`contributing faq` or open an issue on Github.
|
If any of these steps fail, please see our :ref:`contributing faq` or open an issue on Github.
|
||||||
|
|
||||||
|
Development within a Devcontainer
|
||||||
|
==================================
|
||||||
|
|
||||||
|
Moto is equipped with a `devcontainer.json` for use in VSCode Devcontainers and/or GitHub Codespaces.
|
||||||
|
|
||||||
|
Launching the Devcontainer or Codespace:
|
||||||
|
|
||||||
|
- Configures Docker-in-Docker.
|
||||||
|
- Sets up a Virtual Environment in `${workspaceFolder}/.venv`.
|
||||||
|
- Runs `make init`.
|
||||||
|
|
||||||
|
Be patient while the Devcontainer or Codespace launches as dependencies automatically installed.
|
||||||
|
|
||||||
|
Once both `postCreateCommand` and `postStartCommand` have run, open a Terminal session in VSCode and run:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
|
Then standard development on Moto can proceed, for example:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
flake8 moto/s3
|
||||||
|
black --check moto/s3 tests/test_s3
|
||||||
|
pylint tests/test_s3
|
||||||
|
pytest -sv tests/test_s3
|
Loading…
Reference in New Issue
Block a user