From 9459ca7711717069648a4338c444e687b99dfa68 Mon Sep 17 00:00:00 2001 From: c-w-m Date: Sat, 2 Apr 2022 23:31:01 +0000 Subject: [PATCH] devcontainer --- .devcontainer/Dockerfile | 55 ++++++++ .devcontainer/devcontainer.json | 58 ++++++++ .gitignore | 21 ++- .vscode/launch.json | 16 +++ .vscode/settings.json | 119 +++++++++++++++++ certs/update-certificates.sh | 77 +++++++++++ ipynb/quick_test.ipynb | 227 ++++++++++++++++++++++++++++++++ requirements_dev.txt | 35 +++++ requirements_user.txt | 25 ++++ 9 files changed, 626 insertions(+), 7 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 certs/update-certificates.sh create mode 100644 ipynb/quick_test.ipynb create mode 100644 requirements_dev.txt create mode 100644 requirements_user.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..a38aa91 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,55 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.224.3/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} + +# CA Certificate using a script that read the files from the ./certs directory +COPY certs/. /usr/local/share/ca-certificates/ +ENV NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/my_company.pem +RUN sudo update-ca-certificates + +# [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] Add Tini, it operates as a process subreaper for jupyter. This prevents kernel crashes. +# Load before `requirements.txt`, probably more stable in that order +# This allows VSCode to open notebook files and run them from within the IDE (this does NOT support in a Browser use) +ENV TINI_VERSION v0.6.0 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini +RUN chmod +x /usr/bin/tini +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"] + +# [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 + +# original files from the project +# none + +# added for devcontainer convenience +COPY requirements_dev.txt /tmp/pip-tmp/ +RUN pip3 --trusted-host pypi.org \ + --trusted-host files.pythonhosted.org \ + --disable-pip-version-check \ + --no-cache-dir \ + install -r /tmp/pip-tmp/requirements_dev.txt + +COPY requirements_user.txt /tmp/pip-tmp/ +RUN pip3 --trusted-host pypi.org \ + --trusted-host files.pythonhosted.org \ + --disable-pip-version-check \ + --no-cache-dir \ + install -r /tmp/pip-tmp/requirements_user.txt + +RUN 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 + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..425cfea --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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.224.3/containers/python-3 +{ + "name": "Python 3", + "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.10", + // Options + "NODE_VERSION": "none" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "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-toolsai.jupyter" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [8080, 80, 443], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "pip3 install --user -r requirements.txt", + + // dev project package installation as `develop` (i.e., instant availability of changes) + //"postCreateCommand": "python setup.py develop", # FAILS unable to write, raise to sudo + //"postCreateCommand": "sudo python setup.py develop", + //"postCreateCommand": "sudo pip3 --trusted-host pypi.org --trusted-host files.pythonhosted.org --disable-pip-version-check --no-cache-dir install -e .", + "postCreateCommand": "sudo python setup.py develop", + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "github-cli": "latest" + } +} diff --git a/.gitignore b/.gitignore index 58d609b..d7a60ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,14 @@ -__pycache__ -*.py[cod] -/docs/_build -/dist -/yamllint.egg-info -/build -/.eggs +# certificate files +certs/*.crt +certs/*.pem + +# tox results +tox_run.md + +__pycache__ +*.py[cod] +/docs/_build +/dist +/yamllint.egg-info +/build +/.eggs diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..948a236 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a7540f0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,119 @@ +{ + "cSpell.words": [ + "addopts", + "anyio", + "asttokens", + "asyncio", + "atlassian", + "autopep", + "backcall", + "basetemp", + "beautifulsoup", + "bitbucketpipelines", + "bytesize", + "cachedir", + "certifi", + "cffi", + "configfile", + "Cython", + "dateutil", + "debugpy", + "defusedxml", + "devcontainer", + "devop", + "distlib", + "docutils", + "dotenv", + "entrypoints", + "filelock", + "fonttools", + "genutils", + "idna", + "iniconfig", + "inorout", + "installdeps", + "ipykernel", + "ipython", + "isort", + "jsonschema", + "junitxml", + "jupyterlab", + "kiwisolver", + "lldd", + "matplotlib", + "mccabe", + "mkdocs", + "myorg", + "mypy", + "nbclassic", + "nbclient", + "nbconvert", + "nbformat", + "nocolor", + "numpy", + "openpyxl", + "orjson", + "pandocfilters", + "parso", + "pathspec", + "pexpect", + "pickleshare", + "platformdirs", + "plotly", + "pluggy", + "psutil", + "ptyprocess", + "pybadges", + "pycodestyle", + "pycparser", + "pydantic", + "pydocstyle", + "pyflakes", + "pygments", + "pylance", + "pylint", + "pyparsing", + "pypi", + "pyproject", + "pyrsistent", + "pytest", + "PYTHONHASHSEED", + "pythonhosted", + "pytz", + "pyyaml", + "pyzmq", + "rootdir", + "scipy", + "seaborn", + "setuptools", + "sniffio", + "soupsieve", + "sqlalchemy", + "Stmts", + "terminado", + "testpath", + "testpaths", + "toolsai", + "traitlets", + "ujson", + "urllib", + "virtualenv", + "wcwidth", + "webencodings", + "xfailed", + "yapf" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "python.testing.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test_*.py" + ], + "python.testing.pytestArgs": [ + "tests" + ], + "restructuredtext.syntaxHighlighting.disabled": true +} \ No newline at end of file diff --git a/certs/update-certificates.sh b/certs/update-certificates.sh new file mode 100644 index 0000000..b2dc9be --- /dev/null +++ b/certs/update-certificates.sh @@ -0,0 +1,77 @@ +# CA Certificate should be kept in this directory and ignored by git +# +# The script that follows is a WIP so it isn't doing anything yet +# but the intent is to read all the *.crt and *.pem files and +# do something like the following from the dockerfile +# +#ARG CA_DIR=/usr/local/share/ca-certificates/ +#COPY certs/. ${CA_DIR} +#ENV NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/${PEM_FILENAME} +#RUN update-ca-certificates + +# or +#========================================================= +# container with root credential +# this should work behind Cisco AnyConnect VPN +# docker cache lines are not reduced - future optimization + +# syntax=docker/dockerfile:1 +#FROM node:12-alpine as base + +# Company CA Certificate +#ARG ca_file_crt=my_company.crt +# location of shared CA Certificate +#ARG ca_share_dir=/usr/local/share/ca-certificates/ +# concatinated bundle of all CA Certificate +#ARG ca_bundle_all=/etc/ssl/certs/ca-certificates.crt + +# 2 location on container for project +#WORKDIR /app + +# 3 copy from local to WORKDIR +#COPY ./ca/${ca_file_crt} . + +# 4-6 CA files to be added to container +#RUN mkdir ${ca_share_dir} +#RUN cp ${ca_file_crt} ${ca_share_dir}${ca_file_crt} +#RUN rm ${ca_file_crt} + +# 7 upgrade alpine +#RUN apk --update upgrade + +# 8 add each new CA to bundle file +#RUN cat ${ca_share_dir}${ca_file_crt} >> ${ca_bundle_all} + +# 9 install curl and ca-certificates +#RUN apk add --no-cache curl ca-certificates + +#10 run(update) Alpine ca-certificates +#RUN update-ca-certificates +#========================================================= + +# For now, this shell script will display the list of file names +# having read, Write and Execute permission +echo "The name of all files having all permissions :" + +# loop through all files in current directory +for file in * +do + +# check if it is a file +if [ -f $file ] +then + +# check if it has all permissions +if [ -r $file -a -w $file -a -x $file ] +then + +# print the complete file name with -l option +ls -l $file + +# closing second if statement +fi + +# closing first if statement +fi + +done \ No newline at end of file diff --git a/ipynb/quick_test.ipynb b/ipynb/quick_test.ipynb new file mode 100644 index 0000000..18700e8 --- /dev/null +++ b/ipynb/quick_test.ipynb @@ -0,0 +1,227 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Manual Validation Testing\n", + "\n", + "Here are the basic validation tests you can perform in a terminal or here from a Jupyter notebook. \n", + "Basic `mypy`, `flake8`, and `pytest` commands and results. These test can also be fond in `tox.ini` were they are run against Python 3.9 and 3.10.\n", + "\n", + "---\n", + "\n", + "## `pytest` \n", + "\n", + "__~45.6 seconds to run__\n", + "\n", + "Run all the `/tests` to make sure the code is behaving as expected.\n", + "\n", + ">Note: Remember to add tests if new behavior is added" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[1m============================= test session starts ==============================\u001b[0m\n", + "platform linux -- Python 3.10.2, pytest-7.1.1, pluggy-1.0.0\n", + "rootdir: /workspaces/yamllint\n", + "plugins: anyio-3.5.0, env-0.6.2\n", + "collected 356 items \u001b[0m\u001b[1m\u001b[1m\u001b[1m\u001b[1m\u001b[1m\u001b[1m\n", + "\n", + "tests/test_cli.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 7%]\u001b[0m\n", + "tests/test_config.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 12%]\u001b[0m\n", + "tests/test_linter.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 14%]\u001b[0m\n", + "tests/test_module.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 16%]\u001b[0m\n", + "tests/test_parser.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 16%]\u001b[0m\n", + "tests/test_spec_examples.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 29%]\n", + "\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 42%]\u001b[0m\n", + "tests/test_syntax_errors.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 44%]\u001b[0m\n", + "tests/test_yamllint_directives.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 47%]\u001b[0m\n", + "tests/rules/test_braces.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 50%]\u001b[0m\n", + "tests/rules/test_brackets.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 52%]\u001b[0m\n", + "tests/rules/test_colons.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 55%]\u001b[0m\n", + "tests/rules/test_commas.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 57%]\u001b[0m\n", + "tests/rules/test_comments.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 61%]\u001b[0m\n", + "tests/rules/test_comments_indentation.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 62%]\u001b[0m\n", + "tests/rules/test_common.py \u001b[32m.\u001b[0m\u001b[32m [ 63%]\u001b[0m\n", + "tests/rules/test_document_end.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 64%]\u001b[0m\n", + "tests/rules/test_document_start.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 65%]\u001b[0m\n", + "tests/rules/test_empty_lines.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 67%]\u001b[0m\n", + "tests/rules/test_empty_values.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 72%]\u001b[0m\n", + "tests/rules/test_hyphens.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 73%]\u001b[0m\n", + "tests/rules/test_indentation.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 84%]\n", + "\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 85%]\u001b[0m\n", + "tests/rules/test_key_duplicates.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 86%]\u001b[0m\n", + "tests/rules/test_key_ordering.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 89%]\u001b[0m\n", + "tests/rules/test_line_length.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 91%]\u001b[0m\n", + "tests/rules/test_new_line_at_end_of_file.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 92%]\u001b[0m\n", + "tests/rules/test_new_lines.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 93%]\u001b[0m\n", + "tests/rules/test_octal_values.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 94%]\u001b[0m\n", + "tests/rules/test_quoted_strings.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 97%]\u001b[0m\n", + "tests/rules/test_trailing_spaces.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [ 98%]\u001b[0m\n", + "tests/rules/test_truthy.py \u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m [100%]\u001b[0m\n", + "\n", + "\u001b[32m============================= \u001b[32m\u001b[1m356 passed\u001b[0m\u001b[32m in 44.09s\u001b[0m\u001b[32m =============================\u001b[0m\n" + ] + } + ], + "source": [ + "!cd .. && pytest tests" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---\n", + "\n", + "## `flake8` \n", + "\n", + "__~ 2.9 seconds to run__\n", + "\n", + "Run `flake8` on both the `/src` and `/tests` to identify:\n", + "\n", + "- coding style (PEP8)\n", + "- programming errors (like “library imported but unused” and “Undefined name”)\n", + "- cyclomatic complexity\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "!flake8 ../yamllint" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "!flake8 ../tests" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---\n", + "\n", + "## `mypy` \n", + "\n", + "__~ 2.9 seconds to run__\n", + "\n", + "Run `mypy` on both the `/src` to identify\"\n", + "\n", + "- missing static type passing between methods" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "../yamllint/parser.py:17: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/linter.py:19: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/truthy.py:125: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/quoted_strings.py:120: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/octal_values.py:76: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/line_length.py:101: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/key_ordering.py:86: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/key_duplicates.py:57: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/empty_values.py:78: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/document_start.py:75: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/document_end.py:85: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/common.py:19: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/indentation.py:203: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/hyphens.py:79: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/comments_indentation.py:78: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/commas.py:105: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/colons.py:82: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/brackets.py:137: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/braces.py:136: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "../yamllint/rules/braces.py:136: \u001b[34mnote:\u001b[m Hint: \u001b[m\u001b[1m\"python3 -m pip install types-PyYAML\"\u001b[m\u001b[m\n", + "../yamllint/rules/braces.py:136: \u001b[34mnote:\u001b[m (or run \u001b[m\u001b[1m\"mypy --install-types\"\u001b[m to install all missing stub packages)\u001b[m\n", + "../yamllint/rules/braces.py:136: \u001b[34mnote:\u001b[m See \u001b[4mhttps://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\u001b[m\u001b[m\n", + "../yamllint/config.py:19: \u001b[1m\u001b[31merror:\u001b[m Skipping analyzing \u001b[m\u001b[1m\"pathspec\"\u001b[m: module is installed, but missing library stubs or py.typed marker\u001b[m\n", + "../yamllint/config.py:20: \u001b[1m\u001b[31merror:\u001b[m Library stubs not installed for \u001b[m\u001b[1m\"yaml\"\u001b[m (or incompatible with Python 3.10)\u001b[m\n", + "\u001b[1m\u001b[31mFound 21 errors in 20 files (checked 29 source files)\u001b[m\n" + ] + } + ], + "source": [ + "!mypy ../yamllint" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---\n", + "\n", + "## `tox` \n", + "\n", + "__~ 12 minutes and 35 seconds to run__ the first time because each virtual environment has to be\n", + "created. On the second run the time is __~ 3 minutes and 47 seconds to run__ \n", + "\n", + "Run `tox` to do all of the above again for multiple Python versions. The results are piped into a markdown file that you can inspect and update with your notes." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# this project doesn't have a tox (yet)\n", + "#!cd .. && sudo tox > tox_run.md" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---" + ] + } + ], + "metadata": { + "interpreter": { + "hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1" + }, + "kernelspec": { + "display_name": "Python 3.10.2 64-bit", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.2" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..6f45651 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,35 @@ +# dev devcontainer convenience +# ~~~~~~~ tox.ini ~~~~~~~ +# none + +# ~~~~~~~ setup.py ~~~~~~~ +# none + +# ~~~~~~~ setup.cfg ~~~~~~~ +sphinx +flake8 +pathspec >= 0.5.3 +pyyaml +setuptools + +# ~~~~~~~ pyproject.toml ~~~~~~~ +# none + +# ~~~~~~~ mkdocs.yml ~~~~~~~ +# none + +# ~~~~~~~ pre-commit-config.yaml ~~~~~~~ +# none + +# ~~~~~~~ bitbucket-pipelines.yml ~~~~~~~ +# none + +# ~~~~~~~ future use ~~~~~~~ +tox==3.24.5 +GitPython==3.1.27 +covdefaults>=2.2 +coverage +distlib +pytest +pytest-env +re-assert \ No newline at end of file diff --git a/requirements_user.txt b/requirements_user.txt new file mode 100644 index 0000000..a154122 --- /dev/null +++ b/requirements_user.txt @@ -0,0 +1,25 @@ +# user devcontainer convenience +# ~~~~~~~ project demo ~~~~~~~ +datamodel-code-generator +orjson==3.6.7 +pydantic==1.9.0 +SQLAlchemy==1.4.33 +ruamel.yaml +typing==3.7.4.3 +ujson==5.1.0 + +# ~~~~~~~ awesome development ~~~~~~~ +beautifulsoup4==4.10.0 +Cython==0.29.26;sys_platform!='win32' +devtools==0.8.0 +openpyxl==3.0.9 +pandas==1.4.1 +python-dotenv==0.19.2 +typing-extensions==4.0.1 +XlsxWriter==3.0.3 + +# ~~~~~~~ notebooks & visualization ~~~~~~~ +ipykernel==6.11.0 +jupyterlab==3.3.2 +matplotlib==3.5.1 +seaborn==0.11.2