Skip to content

Commit

Permalink
chore: update devcontainer config. (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Nov 23, 2023
1 parent 326d075 commit 77cd2fe
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 81 deletions.
51 changes: 0 additions & 51 deletions .devcontainer/Dockerfile

This file was deleted.

53 changes: 32 additions & 21 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "python dev",
"dockerFile": "Dockerfile",
"build": {
"args": {}
},
// https://code.visualstudio.com/remote/advancedcontainers/environment-variables
"remoteEnv": {
// "PIP_INDEX_URL": "https://mirrors.ustc.edu.cn/pypi/web/simple"
},
"runArgs": [],
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
}
},
"postCreateCommand": "poetry install --all-extras",
"postAttachCommand": "poetry shell",
"remoteUser": "vscode"
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm",

"remoteEnv": {
// "PIP_INDEX_URL": "https://mirrors.ustc.edu.cn/pypi/web/simple"
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install pre-commit && pre-commit install && pip3 install poetry && poetry shell && poetry install --all-extras",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ XDRGEN_REPO=overcat/xdrgen
XDRGEN_COMMIT=c98916346eeea7e37aaea039de03c1e5ea0a116a
XDRNEXT_COMMIT=6a620d160aab22609c982d54578ff6a63bfcdc01

UNAME := $(shell uname)

ifeq ($(shell uname), Darwin)
SED := sed -i ''
REPLACE_KEYWORD_COMMAND := find xdr -type f -exec sed -i '' 's/from;/from_;/g' {} +
REPLACE_DOCS := sed -i '' '/stellar_sdk\.xdr/,$$d' docs/en/api.rst
else
SED := sed
ifeq ($(UNAME), Darwin)
SED := sed -i ''
REPLACE_KEYWORD_COMMAND := find xdr -type f -exec sed -i 's/from;/from_;/g' {} \;
REPLACE_DOCS := sed -i '/stellar_sdk\.xdr/,$$d' docs/en/api.rst
endif

# default target does nothing
Expand Down Expand Up @@ -59,13 +64,11 @@ clean:
.PHONY: clean

format:
autoflake --in-place --ignore-init-module-imports --remove-all-unused-imports --recursive .
isort .
black .
pre-commit run --all-file
.PHONY: format

replace-xdr-keywords:
find xdr -type f -exec $(SED) 's/from;/from_;/g' {} +
$(REPLACE_KEYWORD_COMMAND)
.PHONY: replace-xdr-keywords

xdr-generate: $(XDRS)
Expand All @@ -78,7 +81,8 @@ xdr-generate: $(XDRS)
--namespace stellar \
--output stellar_sdk/xdr \
$(XDRS)'
$(SED) '/stellar_sdk\.xdr/,$$d' docs/en/api.rst
pip install -e .
$(REPLACE_DOCS)
python docs/gen_xdr_api.py >> docs/en/api.rst
.PHONY: xdr-generate

Expand All @@ -91,5 +95,5 @@ xdr-clean:
rm stellar_sdk/xdr/*.py || true
.PHONY: xdr-clean

xdr-update: xdr-clean xdr-generate format
xdr-update: xdr-clean xdr-generate
.PHONY: xdr-update

0 comments on commit 77cd2fe

Please sign in to comment.