pkgs
This commit is contained in:
@@ -1,227 +0,0 @@
|
||||
{
|
||||
"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
|
||||
}
|
||||
848
ipynb/tox_prototype.ipynb
Normal file
848
ipynb/tox_prototype.ipynb
Normal file
@@ -0,0 +1,848 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Tox Prototype\n",
|
||||
"\n",
|
||||
"Before running [`tox.ini`](../tox.ini) with a matrix of tests vs Python versions it is wise to manually run the same testing in your development environment.\n",
|
||||
"\n",
|
||||
"## Development Environment\n",
|
||||
"\n",
|
||||
"The recommended development (__dev__) environment:\n",
|
||||
"\n",
|
||||
"- Python 3.10\n",
|
||||
"- requirements_dev.txt # must have\n",
|
||||
"- requirements_user.txt # nice to have\n",
|
||||
" - requirements-test-min.txt # benchmark (do this from tox)\n",
|
||||
" - requirements-test.txt # testing (do this from tox)\n",
|
||||
"\n",
|
||||
"> Note: The [`Dockfile`](../.devcontainer/Dockerfile) loads all three of these `requirements-*.txt` files into the [`devcontianer`](../.devcontainer/devcontainer.json)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"## [`tox.ini`](../tox.ini)\n",
|
||||
"\n",
|
||||
"This is a 'developers' version with the following perspective:\n",
|
||||
"\n",
|
||||
"- py39 only\n",
|
||||
" - use this notebook to manually check py310\n",
|
||||
" - no plan to support py38 or earlier\n",
|
||||
"\n",
|
||||
"---\n",
|
||||
"\n",
|
||||
"## Test: `pytest` and `coverage`\n",
|
||||
"\n",
|
||||
"__[testenv]__\n",
|
||||
"\n",
|
||||
"Looking for broken code to the extent necessary for development.\n",
|
||||
"\n",
|
||||
"Minimal Requirements:\n",
|
||||
"\n",
|
||||
"- fix all broken tests\n",
|
||||
"- create new tests to cover new behavior\n",
|
||||
"- maintain ~40% at all times during development"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Python 3.10.2\n",
|
||||
"Coverage.py, version 6.3.2 with C extension\n",
|
||||
"Full documentation is at https://coverage.readthedocs.io\n",
|
||||
"pytest 7.1.1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# versions used for testing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! python --version\n",
|
||||
"! coverage --version\n",
|
||||
"! pytest --version"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"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",
|
||||
"benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)\n",
|
||||
"rootdir: /workspaces/vsclint, configfile: pyproject.toml, testpaths: tests\n",
|
||||
"plugins: typeguard-2.13.3, anyio-3.5.0, forked-1.4.0, cov-3.0.0, xdist-2.5.0, profiling-1.7.0, benchmark-3.4.1, timeout-2.1.0, env-0.6.2\n",
|
||||
"collected 1 item \u001b[0m\n",
|
||||
"\n",
|
||||
"tests/test_cli.py \u001b[32m.\u001b[0m\u001b[32m [100%]\u001b[0m\n",
|
||||
"\n",
|
||||
"\u001b[32m============================== \u001b[32m\u001b[1m1 passed\u001b[0m\u001b[32m in 0.15s\u001b[0m\u001b[32m ===============================\u001b[0m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# pytest only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && pytest tests"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"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",
|
||||
"benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)\n",
|
||||
"rootdir: /workspaces/vsclint, configfile: pyproject.toml, testpaths: tests\n",
|
||||
"plugins: typeguard-2.13.3, anyio-3.5.0, forked-1.4.0, cov-3.0.0, xdist-2.5.0, profiling-1.7.0, benchmark-3.4.1, timeout-2.1.0, env-0.6.2\n",
|
||||
"collected 1 item \u001b[0m\n",
|
||||
"\n",
|
||||
"tests/test_cli.py \u001b[32m.\u001b[0m\u001b[32m [100%]\u001b[0m\n",
|
||||
"\n",
|
||||
"---------- coverage: platform linux, python 3.10.2-final-0 -----------\n",
|
||||
"Name Stmts Miss Cover\n",
|
||||
"---------------------------------------------\n",
|
||||
"src/vsclint/__init__.py 0 0 100%\n",
|
||||
"src/vsclint/cli.py 19 7 63%\n",
|
||||
"tests/__init__.py 2 0 100%\n",
|
||||
"tests/common.py 14 0 100%\n",
|
||||
"tests/test_cli.py 39 0 100%\n",
|
||||
"---------------------------------------------\n",
|
||||
"TOTAL 74 7 91%\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\u001b[32m============================== \u001b[32m\u001b[1m1 passed\u001b[0m\u001b[32m in 0.27s\u001b[0m\u001b[32m ===============================\u001b[0m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# pytest and coverage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && pytest --cov"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"## Linters: `flake8`, `isort`, `black`, and `twine`\n",
|
||||
"\n",
|
||||
"__[testenv:linters]__\n",
|
||||
"\n",
|
||||
"Lint - Readability and style enforcement.\n",
|
||||
"\n",
|
||||
"Minimal Requirements:\n",
|
||||
"\n",
|
||||
"- fix all warnings"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Python 3.10.2\n",
|
||||
"4.0.1 (flake8-bugbear: 22.3.23, flake8-docstrings: 1.6.0, pydocstyle: 6.1.1,\n",
|
||||
"flake8_typing_imports: 1.12.0, mccabe: 0.6.1, naming: 0.12.1, pycodestyle:\n",
|
||||
"2.8.0, pyflakes: 2.4.0) CPython 3.10.2 on Linux\n",
|
||||
"\n",
|
||||
" _ _\n",
|
||||
" (_) ___ ___ _ __| |_\n",
|
||||
" | |/ _/ / _ \\/ '__ _/\n",
|
||||
" | |\\__ \\/\\_\\/| | | |_\n",
|
||||
" |_|\\___/\\___/\\_/ \\_/\n",
|
||||
"\n",
|
||||
" isort your imports, so you don't have to.\n",
|
||||
"\n",
|
||||
" VERSION 5.10.1\n",
|
||||
"\n",
|
||||
"\u001b[0mblack, 22.3.0 (compiled: yes)\n",
|
||||
"twine version 4.0.0 (importlib-metadata: 4.11.3, keyring: 23.5.0, pkginfo:\n",
|
||||
"1.8.2, requests: 2.27.1, requests-toolbelt: 0.9.1, urllib3: 1.26.9)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# versions used for testing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! python --version\n",
|
||||
"! flake8 --version\n",
|
||||
"! isort --version\n",
|
||||
"! black --version\n",
|
||||
"! twine --version"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"### `flake8`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# flake8 all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && flake8 src/vsclint tests setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# flake8 src/vsclint ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && flake8 src/vsclint"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# flake8 tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && flake8 tests"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# flake8 setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && flake8 setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"### `isort`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df src/vsclint tests setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort src/vsclint ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df src/vsclint"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df tests"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"### `black`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df src/vsclint tests setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort src/vsclint ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df src/vsclint"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df tests"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort --check-only --df setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"### `twine`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[31mERROR \u001b[0m InvalidDistribution: Cannot find file (or expand pattern): \n",
|
||||
" '.tox/dist/*' \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# twine check dist/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && twine check .tox/dist/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#! check-manifest # needs `apt-get install python3-venv`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"## Fixers: `isort`, `black`, and `mypy`\n",
|
||||
"\n",
|
||||
"__[testenv:fixers]__\n",
|
||||
"\n",
|
||||
"Fix - Readability and style enforcement.\n",
|
||||
"\n",
|
||||
"Minimal Requirements:\n",
|
||||
"\n",
|
||||
"- fix all warnings\n",
|
||||
"- gradual typing"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Python 3.10.2\n",
|
||||
"black, 22.3.0 (compiled: yes)\n",
|
||||
"\n",
|
||||
" _ _\n",
|
||||
" (_) ___ ___ _ __| |_\n",
|
||||
" | |/ _/ / _ \\/ '__ _/\n",
|
||||
" | |\\__ \\/\\_\\/| | | |_\n",
|
||||
" |_|\\___/\\___/\\_/ \\_/\n",
|
||||
"\n",
|
||||
" isort your imports, so you don't have to.\n",
|
||||
"\n",
|
||||
" VERSION 5.10.1\n",
|
||||
"\n",
|
||||
"\u001b[0mmypy 0.942\n",
|
||||
"mypy-extensions==0.4.3\n",
|
||||
"types-PyYAML==6.0.5\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# versions used for testing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! python --version\n",
|
||||
"! black --version\n",
|
||||
"! isort --version\n",
|
||||
"! mypy --version\n",
|
||||
"! pip freeze | grep mypy-extensions\n",
|
||||
"! pip freeze | grep types-PyYAML\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"### `isort`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[0m"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# isort all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && isort src/vsclint/ tests/ setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"### `black`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"black, 22.3.0 (compiled: yes)\n",
|
||||
"\u001b[1mAll done! ✨ 🍰 ✨\u001b[0m\n",
|
||||
"\u001b[34m10 files \u001b[0mleft unchanged.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# black all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd ..&& black --version && black src/vsclint/ tests/ setup.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"## `mypy` \n",
|
||||
"\n",
|
||||
"Run `mypy` on the `/src` and `tests`\n",
|
||||
"\n",
|
||||
"- gradual typing"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[1m\u001b[32mSuccess: no issues found in 6 source files\u001b[m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# mypy src/vsclint ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd ../src && mypy vsclint"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[1m\u001b[32mSuccess: no issues found in 3 source files\u001b[m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# mypy tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && mypy tests"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Full check on type hinting."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"vsclint/config.py:18: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def __init__(self, content=None, file=None):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:34: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function \u001b[m\u001b[1m\"parse\"\u001b[m in typed context \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m self.parse(content)\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:35: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function \u001b[m\u001b[1m\"validate\"\u001b[m in typed\n",
|
||||
"context \u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m self.validate()\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:37: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def is_file_ignored(self, filepath):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:41: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def is_yaml_file(self, filepath):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:45: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def enabled_rules(self, filepath):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:49: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m for id, val in self.rules.items()\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:58: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def extend(self, base_config):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:62: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m for rule in self.rules:\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:64: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m isinstance(self.rules[rule], dict)\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:65: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m and rule in base_config.rules\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:66: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m and base_config.rules[rule] is not False\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:68: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m base_config.rules[rule].update(self.rules[rule])\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:70: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m base_config.rules[rule] = self.rules[rule]\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:72: \u001b[1m\u001b[31merror:\u001b[m Cannot determine type of \u001b[m\u001b[1m\"rules\"\u001b[m \u001b[m\u001b[33m[has-type]\u001b[m\n",
|
||||
"\u001b[2;90m self.rules = base_config.rules\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:77: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def parse(self, raw_content):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:98: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function\n",
|
||||
"\u001b[m\u001b[1m\"get_extended_config_file\"\u001b[m in typed context \u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m path = get_extended_config_file(conf[\"extends\"])\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:99: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function \u001b[m\u001b[1m\"VscLintConfig\"\u001b[m in typed\n",
|
||||
"context \u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m base = VscLintConfig(file=path)\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:101: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function \u001b[m\u001b[1m\"extend\"\u001b[m in typed\n",
|
||||
"context \u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m self.extend(base)\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:133: \u001b[1m\u001b[31merror:\u001b[m Function is missing a return type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def validate(self):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:133: \u001b[34mnote:\u001b[m Use \u001b[m\u001b[1m\"-> None\"\u001b[m if function does not return a value\u001b[m\n",
|
||||
"vsclint/config.py:143: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function \u001b[m\u001b[1m\"validate_rule_conf\"\u001b[m in\n",
|
||||
"typed context \u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m self.rules[id] = validate_rule_conf(rule, self.rules[id])\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:146: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def validate_rule_conf(rule, conf):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"vsclint/config.py:234: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def get_extended_config_file(name):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"\u001b[1m\u001b[31mFound 23 errors in 1 file (checked 6 source files)\u001b[m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# mypy --config-file ../mypy_full_check.ini -p vsclint ~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd ../src && mypy --config-file ../mypy_full_check.ini -p vsclint"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"tests/common.py:6: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def build_temp_workspace(files):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:17: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def __init__(self, case):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:22: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def __enter__(self):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:29: \u001b[1m\u001b[31merror:\u001b[m Function is missing a type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def __exit__(self, *exc_info):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:36: \u001b[1m\u001b[31merror:\u001b[m Function is missing a return type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def returncode(self):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:47: \u001b[1m\u001b[31merror:\u001b[m Function is missing a return type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def setUpClass(cls):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:47: \u001b[34mnote:\u001b[m Use \u001b[m\u001b[1m\"-> None\"\u001b[m if function does not return a value\u001b[m\n",
|
||||
"tests/test_cli.py:51: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function \u001b[m\u001b[1m\"build_temp_workspace\"\u001b[m in\n",
|
||||
"typed context \u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m cls.wd = build_temp_workspace(\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:89: \u001b[1m\u001b[31merror:\u001b[m Function is missing a return type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def tearDownClass(cls):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:89: \u001b[34mnote:\u001b[m Use \u001b[m\u001b[1m\"-> None\"\u001b[m if function does not return a value\u001b[m\n",
|
||||
"tests/test_cli.py:95: \u001b[1m\u001b[31merror:\u001b[m Function is missing a return type annotation \n",
|
||||
"\u001b[m\u001b[33m[no-untyped-def]\u001b[m\n",
|
||||
"\u001b[2;90m def test_run_version(self):\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"tests/test_cli.py:95: \u001b[34mnote:\u001b[m Use \u001b[m\u001b[1m\"-> None\"\u001b[m if function does not return a value\u001b[m\n",
|
||||
"tests/test_cli.py:97: \u001b[1m\u001b[31merror:\u001b[m Call to untyped function \u001b[m\u001b[1m\"RunContext\"\u001b[m in typed\n",
|
||||
"context \u001b[m\u001b[33m[no-untyped-call]\u001b[m\n",
|
||||
"\u001b[2;90m with RunContext(self) as ctx:\u001b[m\n",
|
||||
"\u001b[31m ^\u001b[m\n",
|
||||
"\u001b[1m\u001b[31mFound 10 errors in 2 files (checked 3 source files)\u001b[m\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# mypy --config-file mypy_full_check.ini -p tests ~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
"! cd .. && mypy --config-file mypy_full_check.ini -p tests"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"---\n",
|
||||
"\n",
|
||||
"## [`tox.ini`](../tox.ini)\n",
|
||||
"\n",
|
||||
"OK, if everything in the above testing is 'good' then your ready to run a full tox matrix.\n",
|
||||
"\n",
|
||||
">Note: The full `tox` matrix can take alot of time so only run this when you are ready to push changes to the repository."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ready_to_recreate_and_run_tox = True # set to True when your ready\n",
|
||||
"if ready_to_recreate_and_run_tox:\n",
|
||||
" # force recreation of virtual environments (-r or --recreate)\n",
|
||||
" ! cd .. && sudo tox -r > tox_run_r.md"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ready_to_run_tox = True # set to True when your ready\n",
|
||||
"if ready_to_run_tox:\n",
|
||||
" # use existing virtual environment (only build if not present)\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
|
||||
}
|
||||
Reference in New Issue
Block a user