feat: setup code-workspace

This commit is contained in:
Laureηt 2022-03-03 23:35:45 +01:00
parent dbfead57b7
commit 285999225b
No known key found for this signature in database
GPG key ID: D88C6B294FD40994
11 changed files with 127 additions and 35 deletions

26
.vscode/launch.json vendored
View file

@ -1,30 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Server",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/src/server.py",
"console": "integratedTerminal",
"envFile": ""
},
{
"name": "Emulator",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/src/emulator.py",
"console": "integratedTerminal",
"envFile": ""
}
],
"compounds": [
{
"name": "Server/Emulator",
"name": "Launch",
"configurations": [
"Server",
"Emulator"
"Launch (server)",
"Launch (emulator)"
],
"preLaunchTask": "Start NGINX+Redis",
// "postLaunchask": "Stop NGINX+Redis", // not yet supported by vscode, launch the task manually
"stopAll": true
}
]

View file

@ -1,5 +1,4 @@
{
// "python.defaultInterpreterPath": "${workspaceFolder}/src/server/.venv/bin/python",
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"python.linting.enabled": true,
@ -13,7 +12,6 @@
}
},
"python.analysis.extraPaths": [
"${workspaceFolder}/mgba/src/platform/python",
"./src/mgba/src/platform/python"
"${workspaceFolder}/src/mgba/src/platform/python",
],
}

58
.vscode/tasks.json vendored
View file

@ -2,14 +2,56 @@
"version": "2.0.0",
"tasks": [
{
"label": "Redis server",
"command": "redis-server",
"type": "process",
"isBackground": true,
"problemMatcher": [],
"presentation": {
"reveal": "silent"
},
"label": "Start NGINX",
"type": "docker-run",
"dockerRun": {
"containerName": "nginx-rtmp",
"image": "tiangolo/nginx-rtmp",
"ports": [
{
"containerPort": 1935,
"hostPort": 1935
}
],
"remove": true
}
},
{
"label": "Start Redis",
"type": "docker-run",
"dockerRun": {
"containerName": "redis",
"image": "redis:alpine",
"ports": [
{
"containerPort": 6379,
"hostPort": 6379
}
],
"remove": true
}
},
{
"label": "Start NGINX+Redis",
"dependsOn": [
"Start NGINX",
"Start Redis"
]
},
{
"label": "Stop NGINX",
"type": "shell",
"command": "docker stop nginx-rtmp"
},
{
"label": "Stop NGINX",
"type": "shell",
"command": "docker stop redis"
},
{
"label": "Stop NGINX+Redis",
"type": "shell",
"command": "docker stop redis nginx-rtmp"
}
]
}

13
src/emulator/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch (emulator)",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/main.py",
"console": "integratedTerminal",
"envFile": ""
}
]
}

14
src/emulator/.vscode/setttings.json vendored Normal file
View file

@ -0,0 +1,14 @@
{
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.banditEnabled": true,
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}

View file

@ -16,8 +16,8 @@ EMULATOR_FPS: int = int(getenv("EMULATOR_FPS", 60))
EMULATOR_SPF: float = 1.0 / EMULATOR_FPS
EMULATOR_INPUT_HZ: int = int(getenv("EMULATOR_INPUT_HZ", 10))
EMULATOR_POLLING_RATE: int = EMULATOR_FPS // EMULATOR_INPUT_HZ
EMULATOR_ROM_PATH: str = getenv("EMULATOR_ROM_PATH", "roms/pokemon.gba")
EMULATOR_STATES_PATH: str = getenv("EMULATOR_STATES_PATH", "states/")
EMULATOR_ROM_PATH: str = getenv("EMULATOR_ROM_PATH", "../../roms/pokemon.gba")
EMULATOR_STATES_PATH: str = getenv("EMULATOR_STATES_PATH", "../../states/")
EMULATOR_RAND_RATE: float = float(getenv("EMULATOR_RAND_RATE", 0.0))
FFMPEG_WIDTH: int = int(getenv("FFMPEG_WIDTH", EMULATOR_WIDTH))

View file

@ -12,7 +12,6 @@ cffi = "^1.15.0"
cached-property = "^1.5.2"
Pillow = "^8.4.0"
redis = "^3.5.3"
mgba = { path="../mgba/src/platform/python" }
watchdog = "^2.1.6"
[tool.poetry.dev-dependencies]
@ -24,6 +23,7 @@ bandit = "^1.7.0"
isort = "^5.9.3"
mypy = "^0.931"
types-redis = "^3.5.15"
mgba = { path="../mgba/src/platform/python" }
[build-system]
requires = ["poetry-core>=1.0.0"]

1
src/mgba Submodule

@ -0,0 +1 @@
Subproject commit 0676769b6897408fa009c8a6cb29f1824fd4f6e7

13
src/server/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch (server)",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/main.py",
"console": "integratedTerminal",
"envFile": ""
}
]
}

14
src/server/.vscode/setttings.json vendored Normal file
View file

@ -0,0 +1,14 @@
{
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.banditEnabled": true,
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}

13
workspace.code-workspace Normal file
View file

@ -0,0 +1,13 @@
{
"folders": [
{
"path": "src/emulator"
},
{
"path": "src/server"
},
{
"path": "."
}
]
}