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

chore: add vscode dev container config #730

Merged
merged 3 commits into from
Feb 22, 2022
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
39 changes: 39 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/python-3/.devcontainer/base.Dockerfile

# [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
ARG VARIANT="3.10-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
COPY requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
&& rm -rf /tmp/pip-tmp

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& 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

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

RUN echo "Downloading Noto Font..." \
&& mkdir -p ~/.fonts/opentype/noto \
&& wget -q https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip \
&& unzip -q Noto-unhinted.zip -d ~/.fonts/opentype/noto/ \
&& mkdir -p /usr/share/fonts/truetype/noto/ \
&& ln -sf ~/.fonts/opentype/noto/*.[to]tf /usr/share/fonts/truetype/noto/ \
&& echo "Downloading Roboto Mono Font..." \
&& mkdir -p ~/.fonts/opentype/roboto \
&& wget -q https://fonts.google.com/download?family=Roboto%20Mono -O roboto-mono.zip \
&& unzip -q roboto-mono.zip -d ~/.fonts/opentype/roboto/ \
&& mkdir -p /usr/share/fonts/truetype/roboto/ \
&& ln -sf ~/.fonts/opentype/roboto/*.[to]tf /usr/share/fonts/truetype/roboto/ \
&& echo "Reloading Font Cache..." \
&& fc-cache -f -v

RUN pip3 --disable-pip-version-check --no-cache-dir install --upgrade pip wheel
RUN pip3 --disable-pip-version-check --no-cache-dir install tox certifi decorator dict2xml==1.7 "pycairo<1.20" PyPDF2 "weasyprint<53"
58 changes: 58 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/python-3
{
"name": "xml2rfc",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.9-bullseye",
// Options
"NODE_VERSION": "16"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.vscode-docker",
"editorconfig.editorconfig",
"redhat.vscode-yaml",
"visualstudioexptteam.vscodeintellicode",
"mrmlnc.vscode-duplicate",
"mutantdino.resourcemonitor",
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install --user -r requirements.txt",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode",
"features": {
"github-cli": "latest"
}
}
51 changes: 51 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf

# Settings for Python files
# ---------------------------------------------------------
# PEP8 Style

[*.py]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
insert_final_newline = false

# Settings for .md files
# ---------------------------------------------------------
# GitHub Markdown Style

[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

# Settings for Makefile
# ---------------------------------------------------------

[Makefile]
indent_style = tab
indent_size = 4

# Settings for .github folder
# ---------------------------------------------------------

[.github/**]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

# Settings for .devcontainer folder
# ---------------------------------------------------------

[.devcontainer/**]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[![Release](https://img.shields.io/github/release/ietf-tools/xml2rfc.svg?style=flat&maxAge=600)](https://github.com/ietf-tools/xml2rfc/releases)
[![License](https://img.shields.io/github/license/ietf-tools/xml2rfc)](https://github.com/ietf-tools/xml2rfc/blob/main/LICENSE)
[![PyPI - Version](https://img.shields.io/pypi/v/xml2rfc)](https://pypi.org/project/xml2rfc/)
[![PyPI - Status](https://img.shields.io/pypi/status/xml2rfc)](https://pypi.org/project/xml2rfc/)
[![PyPI - Status](https://img.shields.io/pypi/status/xml2rfc)](https://pypi.org/project/xml2rfc/)
[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/ietf-tools/xml2rfc)
[![PyPI - Format](https://img.shields.io/pypi/format/xml2rfc)](https://pypi.org/project/xml2rfc/)

##### Generate RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ configargparse>=1.2.3
google-i18n-address>=2.3.2
html5lib>=1.0.1
intervaltree>=2.1.0,!=3.0.0
jinja2>=2.11,<3.0
jinja2>=3.0.3
kitchen>=1.2.6
lxml>=2.2.8,!=4.3.1
pycountry>=1.8,!=19.7.15
Expand Down