Skip to content

Commit 798047f

Browse files
added debugger config and container for vs code
1 parent 40f2491 commit 798047f

File tree

6 files changed

+71
-5
lines changed

6 files changed

+71
-5
lines changed

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
3+
{
4+
"name": "Existing Dockerfile",
5+
"build": {
6+
// Sets the run context to one level up instead of the .devcontainer folder.
7+
"context": "..",
8+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
9+
"dockerfile": "../Dockerfile"
10+
},
11+
"mounts": [
12+
"source=${localEnv:HOME}/.gitconfig,target=/root/.gitconfig,type=bind,consistency=cached"
13+
],
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"ms-python.python",
18+
"ms-python.black-formatter",
19+
"ms-python.pylint",
20+
"benjamin-simmonds.pythoncpp-debug",
21+
"ms-vscode.cpptools-extension-pack"
22+
]
23+
}
24+
},
25+
// Features to add to the dev container. More info: https://containers.dev/features.
26+
// "features": {},
27+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
28+
// "forwardPorts": [],
29+
// Uncomment the next line to run commands after the container is created.
30+
"postCreateCommand": "pip install . && pip install pytest"
31+
// Configure tool-specific properties.
32+
// "customizations": {},
33+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
34+
// "remoteUser": "devcontainer"
35+
}

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python C++ Debugger",
9+
"type": "pythoncpp",
10+
"request": "launch",
11+
"pythonConfig": "default",
12+
"cppConfig": "default (gdb) Attach"
13+
}
14+
]
15+
}

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Set Versions.
2+
ARG FEDORA_VERSION=41
3+
#Base image
4+
FROM quay.io/foundata/fedora${FEDORA_VERSION}-itt:latest AS builder
5+
#To avoid file permission error, set as root user. In docker, default user is root. With devcontainer and Podman, default user is the host user.
6+
USER root
7+
#To run as non root, you can set the home to a different folder, but we are choosing to run as root for now.
8+
# ENV HOME=/tmp
9+
#Install dev packages, just git for now.
10+
RUN dnf upgrade --refresh -y && dnf install -y python3-pip
11+
RUN dnf upgrade --refresh -y && dnf install -y git python3 python3-devel gcc-c++ gdb make
12+
RUN pip install setuptools wheel pybind11

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
["src/main.cpp"],
2020
# Example: passing in the version to the compiled code
2121
define_macros=[("VERSION_INFO", __version__)],
22+
extra_compile_args=["-g"]
2223
),
2324
]
2425

tests/sample_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import python_example as m
2+
3+
def test_basic():
4+
assert m.__version__ == "0.0.1"
5+
assert m.add(1, 2) == 3
6+
assert m.subtract(1, 2) == -1
7+
8+
test_basic()

tests/test.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)