Skip to content

Commit f1c449e

Browse files
author
Ashutosh Tiwari
committed
vscode utilities
1 parent d1b0d4e commit f1c449e

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

.vscode/extensions.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
{
3+
"recommendations": [
4+
"GitHub.copilot",
5+
"GitHub.copilot-chat",
6+
"ms-python.python",
7+
"ms-python.black-formatter",
8+
"charliermarsh.ruff",
9+
"ms-python.mypy-type-checker",
10+
"eamodio.gitlens",
11+
"ms-vscode.makefile-tools",
12+
]
13+
}

.vscode/settings.json

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"files.exclude": {
3+
"**/.git": true,
4+
"**/.svn": true,
5+
"**/.hg": true,
6+
"**/CVS": true,
7+
"**/.DS_Store": true,
8+
"**/Thumbs.db": true,
9+
"**/__pycache__" : true,
10+
"**/node_modules/" : true,
11+
"**/.mypy_cache" : true,
12+
"**/.metals" : true,
13+
"**/.pytest_cache" : true,
14+
"**/.ruff_cache" : true,
15+
".venvs" : true,
16+
"**/*.egg-info" : true,
17+
},
18+
"files.associations": {
19+
"*.log.*": "log"
20+
},
21+
22+
"editor.insertSpaces": true,
23+
"files.trimTrailingWhitespace": true,
24+
"[markdown]": {
25+
"files.trimTrailingWhitespace": false,
26+
},
27+
"[python]" : {
28+
"editor.formatOnSave": true,
29+
"editor.defaultFormatter": "ms-python.black-formatter",
30+
},
31+
32+
// ==== Autocomplete issues ========
33+
34+
// Auto import
35+
"python.analysis.autoImportCompletions" : true,
36+
"python.analysis.packageIndexDepths" : [
37+
{
38+
"name": "graph_ml",
39+
"depth": 4
40+
},
41+
],
42+
43+
// ==== Linting ===
44+
// linter
45+
"flake8.enabled" : false,
46+
"isort.enabled" : false,
47+
"ruff.enable": true,
48+
"ruff.lint.args": [
49+
"--config=pyproject.toml",
50+
"--extend-ignore=I",
51+
],
52+
53+
// mypy - typechecker
54+
"mypy-type-checker.importStrategy": "fromEnvironment",
55+
"mypy-type-checker.args": ["--config-file", "pyproject.toml"],
56+
57+
// code formatter - black
58+
"black-formatter.importStrategy": "fromEnvironment",
59+
"black-formatter.args": ["--config", "${workspaceFolder}/pyproject.toml"],
60+
61+
// ====== pytest =====
62+
// See linting re passing config path.
63+
"python.testing.pytestEnabled": true,
64+
"python.testing.pytestArgs": ["-c", "${workspaceFolder}/pyproject.toml"],
65+
66+
67+
// === Integrated terminal ====
68+
"terminal.integrated.profiles.linux": {
69+
// Ensure the default integrated terminal (bash) respects .bash_profile
70+
// https://superuser.com/questions/1209366/win10-vs-code-integrated-bash-not-loading-bash-profile
71+
"bash": {
72+
"path": "bash",
73+
"args": ["--init-file", "${workspaceFolder}/.vscode/start-terminal.sh"],
74+
},
75+
},
76+
77+
// By default use the dev environment python created by env.py.
78+
"python.defaultInterpreterPath": "${workspaceFolder}/.venvs/dev/bin/python",
79+
"python.envFile": "${workspaceFolder}/.env",
80+
81+
"github.copilot.enable": {
82+
"*": true,
83+
}
84+
85+
}

.vscode/start-terminal.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
echo "Init vscode integrated terminal"
4+
5+
ENV_FILE=".env"
6+
VENV_DIR=".venv/bin/activate"
7+
8+
if test -f ~/.bash_profile; then
9+
echo "Running ~/.bash_profile"
10+
source ~/.bash_profile
11+
fi
12+
13+
if test -f "$ENV_FILE"; then
14+
echo "Exporting env vars in $ENV_FILE"
15+
set -o allexport
16+
source "$ENV_FILE"
17+
set +o allexport
18+
fi
19+
20+
if test -f "$VENV_DIR"; then
21+
echo "Activating virtualenv"
22+
source "$VENV_DIR"
23+
fi

0 commit comments

Comments
 (0)