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

GH-102973: add a dev container #102975

Merged
merged 26 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b3b399c
Create a dev container
brettcannon Mar 20, 2023
b030aa3
Add WASI to the container file
brettcannon Mar 20, 2023
56f990e
Ignore `nis` for WASI
brettcannon Mar 20, 2023
95898c6
Add Zephyr extension
brettcannon Mar 20, 2023
6f47138
Add VS Code settings
brettcannon Mar 20, 2023
f6a543a
Move 4-space tab size to be a general setting
brettcannon Mar 21, 2023
86bdfbb
Add git to the `Dockerfile`
brettcannon Mar 22, 2023
5b646f4
Add the Live Preview extension
brettcannon Mar 22, 2023
a4b113d
Merge branch 'dev-container' of https://github.com/brettcannon/cpytho…
brettcannon Mar 22, 2023
5cb4547
Add ports used by the Live Preview extension
brettcannon Mar 22, 2023
ad6b72a
Let Live Preview trigger the notification for the ports
brettcannon Mar 22, 2023
97de684
Add autoconf syntax highlighting
brettcannon Mar 22, 2023
5fdd0be
Add the C extension
brettcannon Mar 23, 2023
ec514ce
Add settings for the Python extension
brettcannon Mar 23, 2023
a7437ae
Tweak a comment
brettcannon Mar 23, 2023
73c9bec
Turn off C error squiggles
brettcannon Mar 23, 2023
473d434
Add comments for why an extension is included
brettcannon Mar 23, 2023
a42cc51
Install `which`, `zsh`, and `fish` in the dev container
brettcannon Mar 23, 2023
bd54202
Merge branch 'main' into dev-container
brettcannon Mar 23, 2023
4d8d082
Add a news entry
brettcannon Mar 23, 2023
ab50a16
Add blurb to the container
brettcannon Mar 23, 2023
8805339
Fix a comment typo
brettcannon Mar 27, 2023
5884f0d
Merge branch 'main' into dev-container
brettcannon Mar 27, 2023
64bd77d
Don't build docs and have `dnf` clean up after itself
brettcannon Mar 27, 2023
cc8ac24
Drop `pipx` for `python3-blurb`
brettcannon Mar 28, 2023
a7d6545
Merge branch 'main' into dev-container
brettcannon Mar 28, 2023
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
24 changes: 24 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM docker.io/library/fedora:37

ENV CC=clang

ENV WASI_SDK_VERSION=19
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=7.0.0
ENV WASMTIME_CPU_ARCH=x86_64

RUN dnf -y --nodocs install git clang xz python3-blurb dnf-plugins-core && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize I am late to the party, but you might save space by installing git-core instead of git, which should avoid Perl (unless something else brings it in).
(dnf builddep python3 will bring in git-core as well, because we use git to apply patches, but that is probably not explicit enough.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invoking dnf with --setopt=install_weak_deps=False will also save space. Let me try sending a PR and see if it works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dnf -y --nodocs builddep python3 && \
dnf -y clean all

RUN mkdir ${WASI_SDK_PATH} && \
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-linux.tar.gz | \
tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip

RUN mkdir --parents ${WASMTIME_HOME} && \
curl --location "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_CPU_ARCH}-linux.tar.xz" | \
xz --decompress | \
tar --strip-components 1 --directory ${WASMTIME_HOME} -x && \
ln -s ${WASMTIME_HOME}/wasmtime /usr/local/bin
75 changes: 75 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"onCreateCommand": [
// Install common tooling.
"dnf",
"install",
"-y",
"which",
"zsh",
"fish"
],
"updateContentCommand": {
// Using the shell for `nproc` usage.
"python": "./configure --config-cache --with-pydebug && make -s -j `nproc`",
"docs": [
"make",
"--directory",
"Doc",
"venv",
"html"
]
},
"customizations": {
"vscode": {
"extensions": [
// Highlighting for Parser/Python.asdl.
"brettcannon.zephyr-asdl",
// Highlighting for configure.ac.
"maelvalais.autoconf",
// C auto-complete.
"ms-vscode.cpptools",
// To view built docs.
"ms-vscode.live-server"
// https://github.com/microsoft/vscode-python/issues/18073
// "ms-python.python"
],
"settings": {
"C_Cpp.default.cStandard": "c11",
"C_Cpp.default.defines": [
"Py_BUILD_CORE"
],
// https://github.com/microsoft/vscode-cpptools/issues/10732
"C_Cpp.errorSquiggles": "disabled",
"editor.insertSpaces": true,
"editor.rulers": [
80
],
"editor.tabSize": 4,
"editor.trimAutoWhitespace": true,
"files.associations": {
"*.h": "c"
},
"files.encoding": "utf8",
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"python.analysis.diagnosticSeverityOverrides": {
// Complains about shadowing the stdlib w/ the stdlib.
"reportShadowedImports": "none",
// Doesn't like _frozen_importlib.
"reportMissingImports": "none"
},
"python.analysis.extraPaths": [
"Lib"
],
"python.defaultInterpreterPath": "./python",
"[restructuredtext]": {
"editor.tabSize": 3
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add a dev container (along with accompanying Dockerfile) for development
purposes.
1 change: 1 addition & 0 deletions Tools/wasm/Setup.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ audioop
_bz2
_crypt
_decimal
nis
brettcannon marked this conversation as resolved.
Show resolved Hide resolved
_pickle
pyexpat _elementtree
_sha3 _blake2
Expand Down