Skip to content

Commit 3ae5c77

Browse files
authored
chore: add vscode dev container config (#730)
* chore: add vscode dev container config * fix: bump up jinja2 to 3.0.3
1 parent dc12311 commit 3ae5c77

File tree

5 files changed

+151
-2
lines changed

5 files changed

+151
-2
lines changed

.devcontainer/Dockerfile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/python-3/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
4+
ARG VARIANT="3.10-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
6+
7+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8+
ARG NODE_VERSION="none"
9+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10+
11+
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
12+
COPY requirements.txt /tmp/pip-tmp/
13+
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
14+
&& rm -rf /tmp/pip-tmp
15+
16+
# [Optional] Uncomment this section to install additional OS packages.
17+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
18+
&& apt-get -y install --no-install-recommends groff html2text python3-cffi python3-brotli libpango-1.0-0 libcairo2-dev libjpeg-dev libgif-dev librsvg2-dev libharfbuzz0b libpangoft2-1.0-0 libxml2-dev libxml2-utils
19+
20+
# [Optional] Uncomment this line to install global node packages.
21+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
22+
23+
RUN echo "Downloading Noto Font..." \
24+
&& mkdir -p ~/.fonts/opentype/noto \
25+
&& wget -q https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip \
26+
&& unzip -q Noto-unhinted.zip -d ~/.fonts/opentype/noto/ \
27+
&& mkdir -p /usr/share/fonts/truetype/noto/ \
28+
&& ln -sf ~/.fonts/opentype/noto/*.[to]tf /usr/share/fonts/truetype/noto/ \
29+
&& echo "Downloading Roboto Mono Font..." \
30+
&& mkdir -p ~/.fonts/opentype/roboto \
31+
&& wget -q https://fonts.google.com/download?family=Roboto%20Mono -O roboto-mono.zip \
32+
&& unzip -q roboto-mono.zip -d ~/.fonts/opentype/roboto/ \
33+
&& mkdir -p /usr/share/fonts/truetype/roboto/ \
34+
&& ln -sf ~/.fonts/opentype/roboto/*.[to]tf /usr/share/fonts/truetype/roboto/ \
35+
&& echo "Reloading Font Cache..." \
36+
&& fc-cache -f -v
37+
38+
RUN pip3 --disable-pip-version-check --no-cache-dir install --upgrade pip wheel
39+
RUN pip3 --disable-pip-version-check --no-cache-dir install tox certifi decorator dict2xml==1.7 "pycairo<1.20" PyPDF2 "weasyprint<53"

.devcontainer/devcontainer.json

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/python-3
3+
{
4+
"name": "xml2rfc",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": "..",
8+
"args": {
9+
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
10+
// Append -bullseye or -buster to pin to an OS version.
11+
// Use -bullseye variants on local on arm64/Apple Silicon.
12+
"VARIANT": "3.9-bullseye",
13+
// Options
14+
"NODE_VERSION": "16"
15+
}
16+
},
17+
18+
// Set *default* container specific settings.json values on container create.
19+
"settings": {
20+
"terminal.integrated.defaultProfile.linux": "zsh",
21+
"python.defaultInterpreterPath": "/usr/local/bin/python",
22+
"python.linting.enabled": true,
23+
"python.linting.pylintEnabled": true,
24+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
25+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
26+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
27+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
28+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
29+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
30+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
31+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
32+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
33+
},
34+
35+
// Add the IDs of extensions you want installed when the container is created.
36+
"extensions": [
37+
"ms-python.python",
38+
"ms-python.vscode-pylance",
39+
"ms-azuretools.vscode-docker",
40+
"editorconfig.editorconfig",
41+
"redhat.vscode-yaml",
42+
"visualstudioexptteam.vscodeintellicode",
43+
"mrmlnc.vscode-duplicate",
44+
"mutantdino.resourcemonitor",
45+
],
46+
47+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
48+
// "forwardPorts": [],
49+
50+
// Use 'postCreateCommand' to run commands after the container is created.
51+
"postCreateCommand": "pip3 install --user -r requirements.txt",
52+
53+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
54+
// "remoteUser": "vscode",
55+
"features": {
56+
"github-cli": "latest"
57+
}
58+
}

.editorconfig

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
11+
# Settings for Python files
12+
# ---------------------------------------------------------
13+
# PEP8 Style
14+
15+
[*.py]
16+
indent_style = space
17+
indent_size = 4
18+
trim_trailing_whitespace = false
19+
insert_final_newline = false
20+
21+
# Settings for .md files
22+
# ---------------------------------------------------------
23+
# GitHub Markdown Style
24+
25+
[*.md]
26+
indent_style = space
27+
indent_size = 2
28+
trim_trailing_whitespace = false
29+
30+
# Settings for Makefile
31+
# ---------------------------------------------------------
32+
33+
[Makefile]
34+
indent_style = tab
35+
indent_size = 4
36+
37+
# Settings for .github folder
38+
# ---------------------------------------------------------
39+
40+
[.github/**]
41+
indent_style = space
42+
indent_size = 2
43+
trim_trailing_whitespace = false
44+
45+
# Settings for .devcontainer folder
46+
# ---------------------------------------------------------
47+
48+
[.devcontainer/**]
49+
indent_style = space
50+
indent_size = 2
51+
trim_trailing_whitespace = true

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
[![Release](https://img.shields.io/github/release/ietf-tools/xml2rfc.svg?style=flat&maxAge=600)](https://github.com/ietf-tools/xml2rfc/releases)
66
[![License](https://img.shields.io/github/license/ietf-tools/xml2rfc)](https://github.com/ietf-tools/xml2rfc/blob/main/LICENSE)
77
[![PyPI - Version](https://img.shields.io/pypi/v/xml2rfc)](https://pypi.org/project/xml2rfc/)
8-
[![PyPI - Status](https://img.shields.io/pypi/status/xml2rfc)](https://pypi.org/project/xml2rfc/)
8+
[![PyPI - Status](https://img.shields.io/pypi/status/xml2rfc)](https://pypi.org/project/xml2rfc/)
9+
[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/ietf-tools/xml2rfc)
910
[![PyPI - Format](https://img.shields.io/pypi/format/xml2rfc)](https://pypi.org/project/xml2rfc/)
1011

1112
##### Generate RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ configargparse>=1.2.3
33
google-i18n-address>=2.3.2
44
html5lib>=1.0.1
55
intervaltree>=2.1.0,!=3.0.0
6-
jinja2>=2.11,<3.0
6+
jinja2>=3.0.3
77
kitchen>=1.2.6
88
lxml>=2.2.8,!=4.3.1
99
pycountry>=1.8,!=19.7.15

0 commit comments

Comments
 (0)