If anyone would like to develop local with lean in VSCode using devcontainers, just add the below to your .devcontainer folder in your project. 

Dockerfile

  1. FROM ubuntu:20.04
  2. ADD https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/docker-in-docker-debian.sh /tmp/library-scripts/docker-in-docker-debian.sh
  3. RUN apt-get update && /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh
  4. RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
  5. && apt-get -y install --no-install-recommends \
  6. apt-transport-https \
  7. ca-certificates \
  8. curl \
  9. gnupg \
  10. lsb-release \
  11. git \
  12. python3 \
  13. python3-tk
  14. RUN apt-get -y remove python3-wheel
  15. RUN apt-get -y install python3-pip
  16. RUN pip3 --no-cache-dir install \
  17. ptvsd \
  18. pydevd-pycharm \
  19. ipykernel \
  20. lean
  21. ENTRYPOINT ["/usr/local/share/docker-init.sh"]
  22. VOLUME [ "/var/lib/docker" ]
  23. CMD ["sleep", "infinity"]
+ Expand

devcontainer.json

  1. // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
  2. // https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/python-3
  3. {
  4. "name": "QuantConnect",
  5. "build": {
  6. "dockerfile": "Dockerfile",
  7. "context": ".."
  8. },
  9. // Set *default* container specific settings.json values on container create.
  10. "settings": {
  11. "terminal.integrated.shell.linux": "/bin/bash",
  12. "python.pythonPath": "/usr/local/bin/python",
  13. "python.languageServer": "Pylance",
  14. "python.linting.enabled": true,
  15. "python.linting.pylintEnabled": true,
  16. "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
  17. "python.formatting.blackPath": "/usr/local/py-utils/bin/black",
  18. "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
  19. "python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
  20. "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
  21. "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
  22. "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
  23. "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
  24. "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
  25. },
  26. // Add the IDs of extensions you want installed when the container is created.
  27. "extensions": [
  28. "ms-python.python",
  29. "ms-python.vscode-pylance"
  30. ],
  31. "runArgs": ["--init", "--privileged"],
  32. "overrideCommand": false
  33. }
+ Expand

 

 

 

 

Author

Stefan Stoeckigt

January 2022