-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cross-platform local dev experience per #24
* Windows and Bash setup script * Local debug loop using custom commandline args that are omitted from source control * VS Code settings including extensions, Python settings and launch configuration
- Loading branch information
Showing
21 changed files
with
627 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root=true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.py] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ coverage.xml | |
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
.ruff_cache/ | ||
cover/ | ||
|
||
# Translations | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{ | ||
"recommendations": [ | ||
"esbenp.prettier-vscode", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"charliermarsh.ruff" | ||
] | ||
} | ||
{ | ||
"recommendations": [ | ||
"esbenp.prettier-vscode", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"charliermarsh.ruff", | ||
"bungcip.better-toml", | ||
"EditorConfig.EditorConfig" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Module", | ||
"type": "python", | ||
"cwd": "${workspaceFolder}/src", | ||
"request": "launch", | ||
"module": "algokit", | ||
"justMyCode": true | ||
} | ||
] | ||
} | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Module", | ||
"type": "python", | ||
"cwd": "${workspaceFolder}", | ||
"request": "launch", | ||
"module": "localinvoke", | ||
"justMyCode": true, | ||
"console": "internalConsole" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,46 @@ | ||
{ | ||
"python.formatting.provider": "black", | ||
"editor.formatOnSave": true, | ||
"python.formatting.blackArgs": ["--line-length\", \"120\""], | ||
"python.analysis.typeCheckingMode": "strict", | ||
"python.linting.enabled": true, | ||
"python.linting.lintOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"files.eol": "\n" | ||
} | ||
{ | ||
// General - see also /.editorconfig | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
}, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
|
||
// Python | ||
// Inform VS Code there is an interpreter in the .venv for the workspace | ||
// On Windows this doesn't work since it's not in .venv/bin, but rather .venv/Scripts. | ||
// However if you symlink Scripts -> bin it does work! Run scripts/setup.ps1 as admin for that trick | ||
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", | ||
"python.analysis.extraPaths": ["${workspaceFolder}/src"], | ||
"python.formatting.provider": "black", | ||
"[python]": { | ||
// https://dev.to/eegli/quick-guide-to-python-formatting-in-vs-code-2040 | ||
"editor.defaultFormatter": null | ||
}, | ||
"python.analysis.typeCheckingMode": "strict", | ||
"python.linting.enabled": true, | ||
"python.linting.lintOnSave": true, | ||
"ruff.importStrategy": "fromEnvironment", | ||
"python.linting.pylintEnabled": false, | ||
"python.linting.mypyEnabled": false, | ||
"python.linting.banditEnabled": false, | ||
"python.linting.prospectorEnabled": false, | ||
"python.linting.pydocstyleEnabled": false, | ||
"python.linting.pycodestyleEnabled": false, | ||
// https://github.com/microsoft/vscode-python/issues/6933 | ||
"python.sortImports.args": [ | ||
"--multi-line=3", | ||
"--trailing-comma", | ||
"--force-grid-wrap=0", | ||
"--use-parentheses", | ||
"--line-width=120" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
|
||
// PowerShell | ||
"[powershell]": { | ||
"editor.defaultFormatter": "ms-vscode.powershell" | ||
}, | ||
"powershell.codeFormatting.preset": "Stroustrup" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
function installPoetry () { | ||
pyenv="$(pyenv --version 2>/dev/null)" | ||
if [[ $? -ne 0 ]]; then | ||
echo "Error: can't install poetry, pyenv is not available ❌" | ||
return 1 | ||
fi | ||
|
||
echo "Installing poetry..." | ||
|
||
pyenv exec pip install poetry | ||
if [[ $? -ne 0 ]]; then | ||
return 1 | ||
fi | ||
} | ||
|
||
installPoetry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
function installPyenvLinux () { | ||
# https://github.com/pyenv/pyenv-installer | ||
curl https://pyenv.run | bash | ||
if [[ $? -ne 0 ]]; then | ||
return 1 | ||
fi | ||
|
||
# set up .bashrc for pyenv https://github.com/pyenv/pyenv-installer | ||
if ! grep -q "# pyenv config" ~/.bashrc; then | ||
echo '' >> ~/.bashrc | ||
echo '# pyenv config' >> ~/.bashrc | ||
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc | ||
echo 'eval "$(pyenv init -)"' >> ~/.bashrc | ||
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc | ||
fi | ||
} | ||
|
||
function installPyenvMac() { | ||
brew install pyenv | ||
} | ||
|
||
echo "Installing pyenv..." | ||
|
||
if [ "$(uname -s)" == Darwin ]; then | ||
installPyenvMac | ||
else | ||
installPyenvLinux | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
function installPython () { | ||
|
||
if [ $# -ne 1 ]; then | ||
echo Error: missing python version argument, e.g.: install-python.sh 3.10.6 | ||
return 1 | ||
fi | ||
|
||
PYTHON_VERSION=$1 | ||
|
||
if [ "$(uname -s)" == Linux ]; then | ||
echo "Installing python build pre-requisistes..." | ||
# install python build pre-requisites https://github.com/pyenv/pyenv/wiki#suggested-build-environment | ||
sudo apt-get update; sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \ | ||
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ | ||
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev | ||
fi | ||
|
||
pyenv="$(pyenv --version 2>/dev/null)" | ||
if [[ $? -ne 0 ]]; then | ||
echo "Error: can't install python, pyenv is not available (if it just installed you might need to restart your shell for environment to update) ❌" | ||
return 1 | ||
fi | ||
|
||
echo "Installing python..." | ||
|
||
# install and use python via pyenv | ||
pyenv install ${PYTHON_VERSION} | ||
pyenv global ${PYTHON_VERSION} | ||
} | ||
|
||
installPython $1 |
Oops, something went wrong.