Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure devcontainer #30

Merged
merged 5 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "qldebugger",

"image": "mcr.microsoft.com/devcontainers/python:3.8-bookworm",
"features": {
"ghcr.io/devcontainers-contrib/features/apt-packages:1": {
"packages": "bash-completion"
},
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
},

"containerUser": "vscode",
"runArgs": [
"--userns=keep-id"
],
"mounts": [
{
"type": "bind",
"source": "/etc/localtime",
"target": "/etc/localtime"
}
],

"postCreateCommand": "scripts/update-tools-completion.sh\nscripts/init-project.sh",

"customizations": {
"vscode": {
"extensions": [
"editorconfig.editorconfig",
"tamasfe.even-better-toml",
"ms-python.autopep8",
"charliermarsh.ruff",
"matangover.mypy"
]
}
}
}
14 changes: 11 additions & 3 deletions .vscode/settings.json.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"python.formatting.provider": "autopep8",
"python.defaultInterpreterPath": "python",
"autopep8.importStrategy": "fromEnvironment",
"ruff.importStrategy": "fromEnvironment",
"python.linting.mypyEnabled": true,
"mypy.runUsingActiveInterpreter": true,
"mypy.targets": [
"qldebugger",
"tests"
],
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"--no-cov",
"tests"
]
],
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
}
}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:
.PHONY: fmt

fmt:
poetry run autopep8 --in-place $(srcdir) $(testsdir)
poetry run autopep8 --recursive --in-place $(srcdir) $(testsdir)
poetry run ruff --fix $(srcdir) $(testsdir)


Expand All @@ -34,7 +34,7 @@ lint-pycodestyle:
poetry run pycodestyle --show-source $(srcdir) $(testsdir)

lint-autopep8:
poetry run autopep8 --diff --exit-code $(srcdir) $(testsdir)
poetry run autopep8 --diff --exit-code --recursive $(srcdir) $(testsdir)

lint-ruff:
poetry run ruff check --show-source $(srcdir) $(testsdir)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ mkdocs = "^1.4"
qldebugger = "qldebugger.cli:cli"

[tool.autopep8]
recursive = true
aggressive = 3

[tool.ruff]
Expand Down
7 changes: 7 additions & 0 deletions scripts/init-project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -xe

# Project dependencies
poetry install --with=docs

# Visual Studio Code
[ -e .vscode/settings.json ] || jq ".[\"python.defaultInterpreterPath\"] = \"$(poetry env info -e)\"" .vscode/settings.json.example > .vscode/settings.json
11 changes: 11 additions & 0 deletions scripts/update-tools-completion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -xe

# Dependencies
which register-python-argcomplete >/dev/null || /usr/local/bin/pip install --user argcomplete
mkdir -p ~/.local/share/bash-completion/completions

# pipx
echo 'eval "$(register-python-argcomplete pipx)"' > ~/.local/share/bash-completion/completions/pipx

# Poetry
echo 'eval "$(poetry completions bash)"' > ~/.local/share/bash-completion/completions/poetry
Loading