From 50507fd43cf8a919af2d87f8823b0cbd80429a6d Mon Sep 17 00:00:00 2001 From: Jan Snasel Date: Mon, 8 Jan 2024 10:16:01 +0000 Subject: [PATCH 1/2] feat: Replace pydocstyle with ruff --- .../pyproject.toml | 42 ++++++++++++------ .../pyproject.toml | 42 ++++++++++++------ .../.github/workflows/ci.yml | 10 ++--- .../docs/dev/contributing.md | 2 +- .../docs/dev/dev_environment.md | 4 +- .../pyproject.toml | 42 ++++++++++++------ .../{{ cookiecutter.project_slug }}/tasks.py | 43 +++++++++++++++---- 7 files changed, 132 insertions(+), 53 deletions(-) diff --git a/nautobot-app-chatops/{{ cookiecutter.project_slug }}/pyproject.toml b/nautobot-app-chatops/{{ cookiecutter.project_slug }}/pyproject.toml index 98ee5a6..7db3c42 100644 --- a/nautobot-app-chatops/{{ cookiecutter.project_slug }}/pyproject.toml +++ b/nautobot-app-chatops/{{ cookiecutter.project_slug }}/pyproject.toml @@ -40,10 +40,10 @@ django-debug-toolbar = "*" flake8 = "*" invoke = "*" ipython = "*" -pydocstyle = "*" pylint = "*" pylint-django = "*" pylint-nautobot = "*" +ruff = "*" yamllint = "*" toml = "*" Markdown = "*" @@ -113,17 +113,35 @@ supported_nautobot_versions = [ "{{ cookiecutter.min_nautobot_version }}" ] -[tool.pydocstyle] -convention = "google" -inherit = false -match = "(?!__init__).*\\.py" -match-dir = "(?!tests|migrations|development)[^\\.].*" -# D212 is enabled by default in google convention, and complains if we have a docstring like: -# """ -# My docstring is on the line after the opening quotes instead of on the same line as them. -# """ -# We've discussed and concluded that we consider this to be a valid style choice. -add_ignore = "D212" +[tool.ruff] +line-length = 120 +target-version = "py38" +exclude = [ + "migrations", +] + +[tool.ruff.lint] +select = [ + "D1", # pydocstyle + "D2", # pydocstyle + "D3", # pydocstyle + "D4", # pydocstyle +] +ignore = [ + # warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. + "D203", # 1 blank line required before class docstring + + # D212 is enabled by default in google convention, and complains if we have a docstring like: + # """ + # My docstring is on the line after the opening quotes instead of on the same line as them. + # """ + # We've discussed and concluded that we consider this to be a valid style choice. + "D212", # Multi-line docstring summary should start at the first line + "D213", # Multi-line docstring summary should start at the second line + + # Produces a lot of issues in the current codebase. + "D401", # First line of docstring should be in imperative mood +] [build-system] requires = ["poetry_core>=1.0.0"] diff --git a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml index eacf228..3ddb680 100644 --- a/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml +++ b/nautobot-app-ssot/{{ cookiecutter.project_slug }}/pyproject.toml @@ -37,10 +37,10 @@ django-debug-toolbar = "*" flake8 = "*" invoke = "*" ipython = "*" -pydocstyle = "*" pylint = "*" pylint-django = "*" pylint-nautobot = "*" +ruff = "*" yamllint = "*" toml = "*" Markdown = "*" @@ -110,17 +110,35 @@ supported_nautobot_versions = [ "{{ cookiecutter.min_nautobot_version }}" ] -[tool.pydocstyle] -convention = "google" -inherit = false -match = "(?!__init__).*\\.py" -match-dir = "(?!tests|migrations|development)[^\\.].*" -# D212 is enabled by default in google convention, and complains if we have a docstring like: -# """ -# My docstring is on the line after the opening quotes instead of on the same line as them. -# """ -# We've discussed and concluded that we consider this to be a valid style choice. -add_ignore = "D212" +[tool.ruff] +line-length = 120 +target-version = "py38" +exclude = [ + "migrations", +] + +[tool.ruff.lint] +select = [ + "D1", # pydocstyle + "D2", # pydocstyle + "D3", # pydocstyle + "D4", # pydocstyle +] +ignore = [ + # warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. + "D203", # 1 blank line required before class docstring + + # D212 is enabled by default in google convention, and complains if we have a docstring like: + # """ + # My docstring is on the line after the opening quotes instead of on the same line as them. + # """ + # We've discussed and concluded that we consider this to be a valid style choice. + "D212", # Multi-line docstring summary should start at the first line + "D213", # Multi-line docstring summary should start at the second line + + # Produces a lot of issues in the current codebase. + "D401", # First line of docstring should be in imperative mood +] [build-system] requires = ["poetry_core>=1.0.0"] diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml b/nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml index c2f3caf..ba03bf2 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: uses: "networktocode/gh-action-setup-poetry-environment@v4" - name: "Linting: bandit" run: "poetry run invoke bandit" - pydocstyle: + ruff: runs-on: "ubuntu-22.04" env: INVOKE_{{ cookiecutter.app_name.upper() }}_LOCAL: "True" @@ -47,8 +47,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v4" - - name: "Linting: pydocstyle" - run: "poetry run invoke pydocstyle" + - name: "Linting: ruff" + run: "poetry run invoke ruff" check-docs-build: runs-on: "ubuntu-22.04" env: @@ -96,7 +96,7 @@ jobs: pylint: needs: - "bandit" - - "pydocstyle" + - "ruff" - "flake8" - "poetry" - "yamllint" @@ -139,7 +139,7 @@ jobs: check-migrations: needs: - "bandit" - - "pydocstyle" + - "ruff" - "flake8" - "poetry" - "yamllint" diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/contributing.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/contributing.md index c1f141a..848cb7b 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/contributing.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/contributing.md @@ -7,7 +7,7 @@ The project is packaged with a light [development environment](dev_environment.m The project is following Network to Code software development guidelines and is leveraging the following: -- Python linting and formatting: `black`, `pylint`, `bandit`, `flake8`, and `pydocstyle`. +- Python linting and formatting: `black`, `pylint`, `bandit`, `flake8`, and `ruff`. - YAML linting is done with `yamllint`. - Django unit test to ensure the app is working properly. diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md index c45a021..83e83a0 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md +++ b/nautobot-app/{{ cookiecutter.project_slug }}/docs/dev/dev_environment.md @@ -126,7 +126,7 @@ Each command can be executed with `invoke `. All commands support the a bandit Run bandit to validate basic static code security analysis. black Run black to check that Python files adhere to its style standards. flake8 Run flake8 to check that Python files adhere to its style standards. - pydocstyle Run pydocstyle to validate docstring formatting adheres to NTC defined standards. + ruff Run ruff to validate docstring formatting adheres to NTC defined standards. pylint Run pylint code analysis. tests Run all tests for this app. unittest Run Django unit tests for the app. @@ -467,6 +467,6 @@ To run an individual test, you can run any or all of the following: ➜ invoke bandit ➜ invoke black ➜ invoke flake8 -➜ invoke pydocstyle +➜ invoke ruff ➜ invoke pylint ``` diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml b/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml index 9a48f94..be65cd0 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml +++ b/nautobot-app/{{ cookiecutter.project_slug }}/pyproject.toml @@ -36,10 +36,10 @@ django-debug-toolbar = "*" flake8 = "*" invoke = "*" ipython = "*" -pydocstyle = "*" pylint = "*" pylint-django = "*" pylint-nautobot = "*" +ruff = "*" yamllint = "*" toml = "*" Markdown = "*" @@ -109,17 +109,35 @@ supported_nautobot_versions = [ "{{ cookiecutter.min_nautobot_version }}" ] -[tool.pydocstyle] -convention = "google" -inherit = false -match = "(?!__init__).*\\.py" -match-dir = "(?!tests|migrations|development)[^\\.].*" -# D212 is enabled by default in google convention, and complains if we have a docstring like: -# """ -# My docstring is on the line after the opening quotes instead of on the same line as them. -# """ -# We've discussed and concluded that we consider this to be a valid style choice. -add_ignore = "D212" +[tool.ruff] +line-length = 120 +target-version = "py38" +exclude = [ + "migrations", +] + +[tool.ruff.lint] +select = [ + "D1", # pydocstyle + "D2", # pydocstyle + "D3", # pydocstyle + "D4", # pydocstyle +] +ignore = [ + # warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. + "D203", # 1 blank line required before class docstring + + # D212 is enabled by default in google convention, and complains if we have a docstring like: + # """ + # My docstring is on the line after the opening quotes instead of on the same line as them. + # """ + # We've discussed and concluded that we consider this to be a valid style choice. + "D212", # Multi-line docstring summary should start at the first line + "D213", # Multi-line docstring summary should start at the second line + + # Produces a lot of issues in the current codebase. + "D401", # First line of docstring should be in imperative mood +] [build-system] requires = ["poetry_core>=1.0.0"] diff --git a/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py b/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py index 2e36f70..a932ba2 100644 --- a/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py +++ b/nautobot-app/{{ cookiecutter.project_slug }}/tasks.py @@ -23,7 +23,8 @@ def is_truthy(arg): """Convert "truthy" strings into Booleans. - Examples: + Examples + -------- >>> is_truthy('yes') True Args: @@ -111,6 +112,7 @@ def docker_compose(context, command, **kwargs): """Helper function for running a specific docker compose command with all appropriate parameters and environment. Args: + ---- context (obj): Used to run specific commands command (str): Command string to append to the "docker compose ..." command, such as "build", "up", etc. **kwargs: Passed through to the context.run() call. @@ -666,12 +668,34 @@ def pylint(context): run_command(context, command) -@task -def pydocstyle(context): - """Run pydocstyle to validate docstring formatting adheres to NTC defined standards.""" - # We exclude the /migrations/ directory since it is autogenerated code - command = "pydocstyle ." - run_command(context, command) +@task(aliases=("a",)) +def autoformat(context): + """Run code autoformatting.""" + black(context, autoformat=True) + ruff(context, action="both", fix=True) + + +@task( + help={ + "action": "One of 'lint', 'format', or 'both'", + "fix": "Automatically fix selected action. May not be able to fix all.", + "output_format": "see https://docs.astral.sh/ruff/settings/#output-format", + }, +) +def ruff(context, action="lint", fix=False, output_format="text"): + """Run ruff to perform code formatting and/or linting.""" + if action != "lint": + command = "ruff format" + if not fix: + command += " --check" + command += " ." + run_command(context, command) + if action != "format": + command = "ruff check" + if fix: + command += " --fix" + command += f" --output-format {output_format} ." + run_command(context, command) @task @@ -686,6 +710,7 @@ def yamllint(context): """Run yamllint to validate formatting adheres to NTC defined YAML standards. Args: + ---- context (obj): Used to run specific commands """ command = "yamllint . --format standard" @@ -760,12 +785,12 @@ def tests(context, failfast=False, keepdb=False, lint_only=False): # Sorted loosely from fastest to slowest print("Running black...") black(context) + print("Running ruff...") + ruff(context) print("Running flake8...") flake8(context) print("Running bandit...") bandit(context) - print("Running pydocstyle...") - pydocstyle(context) print("Running yamllint...") yamllint(context) print("Running poetry check...") From d32f71df3baa29fd0945cd44dd25eea8bb5b6ca6 Mon Sep 17 00:00:00 2001 From: Jan Snasel Date: Mon, 8 Jan 2024 10:16:39 +0000 Subject: [PATCH 2/2] cleanup: Pydocstyle and ruff are not necessary in root --- docs/dev/contributing.md | 4 +- docs/dev/dev_environment.md | 4 +- poetry.lock | 102 ++---------------------------------- pyproject.toml | 1 - tasks.py | 8 +-- 5 files changed, 13 insertions(+), 106 deletions(-) diff --git a/docs/dev/contributing.md b/docs/dev/contributing.md index fcf218a..ae42ad3 100644 --- a/docs/dev/contributing.md +++ b/docs/dev/contributing.md @@ -5,7 +5,7 @@ The project is packaged with a light [development environment](dev_environment.m The project is following Network to Code software development guidelines and is leveraging the following: -- Python linting and formatting: `black`, `pylint`, `bandit`, `flake8`, and `pydocstyle`. +- Python linting and formatting: `black`, `pylint`. - YAML linting is done with `yamllint`. - Django unit test to ensure the app is working properly. @@ -43,4 +43,4 @@ When a new release of any kind (e.g. from `develop` to `main`, or a release of a - A post release PR is created: - Change the version from `..` to `..-beta` in pyproject.toml. - Set the PR to the proper branch, e.g. either `develop` or `stable-.`. - - Once tests pass, merge. \ No newline at end of file + - Once tests pass, merge. diff --git a/docs/dev/dev_environment.md b/docs/dev/dev_environment.md index 1968b09..1dcbe53 100644 --- a/docs/dev/dev_environment.md +++ b/docs/dev/dev_environment.md @@ -105,7 +105,7 @@ Each command can be executed with `invoke `. All commands support the a bandit Run bandit to validate basic static code security analysis. black Run black to check that Python files adhere to its style standards. flake8 Run flake8 to check that Python files adhere to its style standards. - pydocstyle Run pydocstyle to validate docstring formatting adheres to NTC defined standards. + ruff Run ruff to validate docstring formatting adheres to NTC defined standards. pylint Run pylint code analysis. tests Run all tests for this app. unittest Run Django unit tests for the app. @@ -312,6 +312,6 @@ To run an individual test, you can run any or all of the following: ➜ invoke bandit ➜ invoke black ➜ invoke flake8 -➜ invoke pydocstyle +➜ invoke ruff ➜ invoke pylint ``` diff --git a/poetry.lock b/poetry.lock index ecc014c..1de1133 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "arrow" version = "1.3.0" description = "Better dates & times for Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -18,13 +17,12 @@ types-python-dateutil = ">=2.8.10" [package.extras] doc = ["doc8", "sphinx (>=7.0.0)", "sphinx-autobuild", "sphinx-autodoc-typehints", "sphinx_rtd_theme (>=1.3.0)"] -test = ["dateparser (>=1.0.0,<2.0.0)", "pre-commit", "pytest", "pytest-cov", "pytest-mock", "pytz (==2021.1)", "simplejson (>=3.0.0,<4.0.0)"] +test = ["dateparser (==1.*)", "pre-commit", "pytest", "pytest-cov", "pytest-mock", "pytz (==2021.1)", "simplejson (==3.*)"] [[package]] name = "astroid" version = "3.0.1" description = "An abstract syntax tree for Python with inference support." -category = "dev" optional = false python-versions = ">=3.8.0" files = [ @@ -39,7 +37,6 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} name = "bandit" version = "1.7.5" description = "Security oriented static analyser for python code." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -63,7 +60,6 @@ yaml = ["PyYAML"] name = "binaryornot" version = "0.4.4" description = "Ultra-lightweight pure Python package to check if a file is binary or text." -category = "main" optional = false python-versions = "*" files = [ @@ -78,7 +74,6 @@ chardet = ">=3.0.2" name = "black" version = "23.11.0" description = "The uncompromising code formatter." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -121,7 +116,6 @@ uvloop = ["uvloop (>=0.15.2)"] name = "certifi" version = "2023.11.17" description = "Python package for providing Mozilla's CA Bundle." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -133,7 +127,6 @@ files = [ name = "chardet" version = "5.2.0" description = "Universal encoding detector for Python 3" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -145,7 +138,6 @@ files = [ name = "charset-normalizer" version = "3.3.2" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -245,7 +237,6 @@ files = [ name = "click" version = "8.1.7" description = "Composable command line interface toolkit" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -260,7 +251,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -272,7 +262,6 @@ files = [ name = "cookiecutter" version = "2.5.0" description = "A command-line utility that creates projects from project templates, e.g. creating a Python package project from a Python package project template." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -294,7 +283,6 @@ rich = "*" name = "coverage" version = "7.3.2" description = "Code coverage measurement for Python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -359,7 +347,6 @@ toml = ["tomli"] name = "dill" version = "0.3.7" description = "serialize all of Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -374,7 +361,6 @@ graph = ["objgraph (>=1.7.2)"] name = "exceptiongroup" version = "1.2.0" description = "Backport of PEP 654 (exception groups)" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -389,7 +375,6 @@ test = ["pytest (>=6)"] name = "ghp-import" version = "2.1.0" description = "Copy your docs directly to the gh-pages branch." -category = "dev" optional = false python-versions = "*" files = [ @@ -407,7 +392,6 @@ dev = ["flake8", "markdown", "twine", "wheel"] name = "gitdb" version = "4.0.11" description = "Git Object Database" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -422,7 +406,6 @@ smmap = ">=3.0.1,<6" name = "gitpython" version = "3.1.40" description = "GitPython is a Python library used to interact with Git repositories" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -440,7 +423,6 @@ test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre name = "griffe" version = "0.38.1" description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -455,7 +437,6 @@ colorama = ">=0.4" name = "idna" version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -467,7 +448,6 @@ files = [ name = "importlib-metadata" version = "7.0.0" description = "Read metadata from Python packages" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -487,7 +467,6 @@ testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -499,7 +478,6 @@ files = [ name = "invoke" version = "2.2.0" description = "Pythonic task execution" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -511,7 +489,6 @@ files = [ name = "isort" version = "5.12.0" description = "A Python utility / library to sort Python imports." -category = "dev" optional = false python-versions = ">=3.8.0" files = [ @@ -529,7 +506,6 @@ requirements-deprecated-finder = ["pip-api", "pipreqs"] name = "jinja2" version = "3.1.2" description = "A very fast and expressive template engine." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -547,7 +523,6 @@ i18n = ["Babel (>=2.7)"] name = "markdown" version = "3.5.1" description = "Python implementation of John Gruber's Markdown." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -566,7 +541,6 @@ testing = ["coverage", "pyyaml"] name = "markdown-it-py" version = "3.0.0" description = "Python port of markdown-it. Markdown parsing, done right!" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -591,7 +565,6 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] name = "markupsafe" version = "2.1.3" description = "Safely add untrusted strings to HTML/XML markup." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -651,7 +624,6 @@ files = [ name = "mccabe" version = "0.7.0" description = "McCabe checker, plugin for flake8" -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -663,7 +635,6 @@ files = [ name = "mdurl" version = "0.1.2" description = "Markdown URL utilities" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -675,7 +646,6 @@ files = [ name = "mergedeep" version = "1.3.4" description = "A deep merge function for 🐍." -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -687,7 +657,6 @@ files = [ name = "mkdocs" version = "1.5.2" description = "Project documentation with Markdown." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -719,7 +688,6 @@ min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-imp name = "mkdocs-autorefs" version = "0.5.0" description = "Automatically link across pages in MkDocs." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -735,7 +703,6 @@ mkdocs = ">=1.1" name = "mkdocs-material" version = "9.1.15" description = "Documentation that simply works" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -758,7 +725,6 @@ requests = ">=2.26" name = "mkdocs-material-extensions" version = "1.3.1" description = "Extension pack for Python Markdown and MkDocs Material." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -770,7 +736,6 @@ files = [ name = "mkdocs-version-annotations" version = "1.0.0" description = "MkDocs plugin to add custom admonitions for documenting version differences" -category = "dev" optional = false python-versions = ">=3.7,<4.0" files = [ @@ -782,7 +747,6 @@ files = [ name = "mkdocstrings" version = "0.22.0" description = "Automatic documentation from sources, for MkDocs." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -809,7 +773,6 @@ python-legacy = ["mkdocstrings-python-legacy (>=0.2.1)"] name = "mkdocstrings-python" version = "1.5.2" description = "A Python handler for mkdocstrings." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -825,7 +788,6 @@ mkdocstrings = ">=0.20" name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." -category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -837,7 +799,6 @@ files = [ name = "packaging" version = "23.2" description = "Core utilities for Python packages" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -849,7 +810,6 @@ files = [ name = "pathspec" version = "0.11.2" description = "Utility library for gitignore style pattern matching of file paths." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -861,7 +821,6 @@ files = [ name = "pbr" version = "6.0.0" description = "Python Build Reasonableness" -category = "dev" optional = false python-versions = ">=2.6" files = [ @@ -873,7 +832,6 @@ files = [ name = "platformdirs" version = "4.1.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -889,7 +847,6 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-co name = "pluggy" version = "1.3.0" description = "plugin and hook calling mechanisms for python" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -905,7 +862,6 @@ testing = ["pytest", "pytest-benchmark"] name = "pygments" version = "2.17.2" description = "Pygments is a syntax highlighting package written in Python." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -921,7 +877,6 @@ windows-terminal = ["colorama (>=0.4.6)"] name = "pylint" version = "3.0.2" description = "python code static checker" -category = "dev" optional = false python-versions = ">=3.8.0" files = [ @@ -934,8 +889,8 @@ astroid = ">=3.0.1,<=3.1.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\""}, {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, + {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, ] isort = ">=4.2.5,<6" mccabe = ">=0.6,<0.8" @@ -952,7 +907,6 @@ testutils = ["gitpython (>3)"] name = "pymdown-extensions" version = "10.5" description = "Extension pack for Python Markdown." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -971,7 +925,6 @@ extra = ["pygments (>=2.12)"] name = "pytest" version = "7.4.3" description = "pytest: simple powerful testing with Python" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -994,7 +947,6 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no name = "pytest-cookies" version = "0.7.0" description = "The pytest plugin for your Cookiecutter templates. 🍪" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1010,7 +962,6 @@ pytest = ">=3.9.0" name = "python-dateutil" version = "2.8.2" description = "Extensions to the standard Python datetime module" -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ @@ -1025,7 +976,6 @@ six = ">=1.5" name = "python-slugify" version = "8.0.1" description = "A Python slugify application that also handles Unicode" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1043,7 +993,6 @@ unidecode = ["Unidecode (>=1.1.1)"] name = "pyyaml" version = "6.0.1" description = "YAML parser and emitter for Python" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -1093,7 +1042,6 @@ files = [ name = "pyyaml-env-tag" version = "0.1" description = "A custom YAML tag for referencing environment variables in YAML files. " -category = "dev" optional = false python-versions = ">=3.6" files = [ @@ -1108,7 +1056,6 @@ pyyaml = "*" name = "regex" version = "2023.10.3" description = "Alternative regular expression module, to replace re." -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1206,7 +1153,6 @@ files = [ name = "requests" version = "2.31.0" description = "Python HTTP for Humans." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -1228,7 +1174,6 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] name = "rich" version = "13.7.0" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -1244,38 +1189,10 @@ typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9 [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] -[[package]] -name = "ruff" -version = "0.1.7" -description = "An extremely fast Python linter and code formatter, written in Rust." -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7f80496854fdc65b6659c271d2c26e90d4d401e6a4a31908e7e334fab4645aac"}, - {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:1ea109bdb23c2a4413f397ebd8ac32cb498bee234d4191ae1a310af760e5d287"}, - {file = "ruff-0.1.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b0c2de9dd9daf5e07624c24add25c3a490dbf74b0e9bca4145c632457b3b42a"}, - {file = "ruff-0.1.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:69a4bed13bc1d5dabf3902522b5a2aadfebe28226c6269694283c3b0cecb45fd"}, - {file = "ruff-0.1.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:de02ca331f2143195a712983a57137c5ec0f10acc4aa81f7c1f86519e52b92a1"}, - {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:45b38c3f8788a65e6a2cab02e0f7adfa88872696839d9882c13b7e2f35d64c5f"}, - {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c64cb67b2025b1ac6d58e5ffca8f7b3f7fd921f35e78198411237e4f0db8e73"}, - {file = "ruff-0.1.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9dcc6bb2f4df59cb5b4b40ff14be7d57012179d69c6565c1da0d1f013d29951b"}, - {file = "ruff-0.1.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2bb4bb6bbe921f6b4f5b6fdd8d8468c940731cb9406f274ae8c5ed7a78c478"}, - {file = "ruff-0.1.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:276a89bcb149b3d8c1b11d91aa81898fe698900ed553a08129b38d9d6570e717"}, - {file = "ruff-0.1.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:90c958fe950735041f1c80d21b42184f1072cc3975d05e736e8d66fc377119ea"}, - {file = "ruff-0.1.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6b05e3b123f93bb4146a761b7a7d57af8cb7384ccb2502d29d736eaade0db519"}, - {file = "ruff-0.1.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:290ecab680dce94affebefe0bbca2322a6277e83d4f29234627e0f8f6b4fa9ce"}, - {file = "ruff-0.1.7-py3-none-win32.whl", hash = "sha256:416dfd0bd45d1a2baa3b1b07b1b9758e7d993c256d3e51dc6e03a5e7901c7d80"}, - {file = "ruff-0.1.7-py3-none-win_amd64.whl", hash = "sha256:4af95fd1d3b001fc41325064336db36e3d27d2004cdb6d21fd617d45a172dd96"}, - {file = "ruff-0.1.7-py3-none-win_arm64.whl", hash = "sha256:0683b7bfbb95e6df3c7c04fe9d78f631f8e8ba4868dfc932d43d690698057e2e"}, - {file = "ruff-0.1.7.tar.gz", hash = "sha256:dffd699d07abf54833e5f6cc50b85a6ff043715da8788c4a79bcd4ab4734d306"}, -] - [[package]] name = "six" version = "1.16.0" description = "Python 2 and 3 compatibility utilities" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -1287,7 +1204,6 @@ files = [ name = "smmap" version = "5.0.1" description = "A pure Python implementation of a sliding window memory map manager" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1299,7 +1215,6 @@ files = [ name = "stevedore" version = "5.1.0" description = "Manage dynamic plugins for Python applications" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1314,7 +1229,6 @@ pbr = ">=2.0.0,<2.1.0 || >2.1.0" name = "text-unidecode" version = "1.3" description = "The most basic Text::Unidecode port" -category = "main" optional = false python-versions = "*" files = [ @@ -1326,7 +1240,6 @@ files = [ name = "tomli" version = "2.0.1" description = "A lil' TOML parser" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1338,7 +1251,6 @@ files = [ name = "tomlkit" version = "0.12.3" description = "Style preserving TOML library" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1350,7 +1262,6 @@ files = [ name = "types-python-dateutil" version = "2.8.19.14" description = "Typing stubs for python-dateutil" -category = "main" optional = false python-versions = "*" files = [ @@ -1362,7 +1273,6 @@ files = [ name = "typing-extensions" version = "4.8.0" description = "Backported and Experimental Type Hints for Python 3.8+" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1374,7 +1284,6 @@ files = [ name = "urllib3" version = "2.1.0" description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1391,7 +1300,6 @@ zstd = ["zstandard (>=0.18.0)"] name = "watchdog" version = "3.0.0" description = "Filesystem events monitoring" -category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1431,7 +1339,6 @@ watchmedo = ["PyYAML (>=3.10)"] name = "yamllint" version = "1.33.0" description = "A linter for YAML files." -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1450,7 +1357,6 @@ dev = ["doc8", "flake8", "flake8-import-order", "rstcheck[sphinx]", "sphinx"] name = "zipp" version = "3.17.0" description = "Backport of pathlib-compatible object wrapper for zip files" -category = "dev" optional = false python-versions = ">=3.8" files = [ @@ -1465,4 +1371,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "c6888a3d2992e347915f8faa4510bb22a1070f2933aff5625ea3d65eaa0ecc39" +content-hash = "4831e88c2875b222dc4de91f4afc367052d2a709b32841e51d4262856a68a2d1" diff --git a/pyproject.toml b/pyproject.toml index aa1b547..b8a0ce2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ isort = "*" pylint = "*" pytest = "*" pytest-cookies = "*" -ruff = "*" yamllint = "*" Markdown = "*" # Rendering docs to HTML diff --git a/tasks.py b/tasks.py index d4c9f97..ce77688 100644 --- a/tasks.py +++ b/tasks.py @@ -23,7 +23,8 @@ def is_truthy(arg): """Convert "truthy" strings into Booleans. - Examples: + Examples + -------- >>> is_truthy('yes') True Args: @@ -96,6 +97,7 @@ def docker_compose(context, command, **kwargs): """Helper function for running a specific docker compose command with all appropriate parameters and environment. Args: + ---- context (obj): Used to run specific commands command (str): Command string to append to the "docker compose ..." command, such as "build", "up", etc. **kwargs: Passed through to the context.run() call. @@ -360,6 +362,7 @@ def yamllint(context): """Run yamllint to validate formatting adheres to NTC defined YAML standards. Args: + ---- context (obj): Used to run specific commands """ command = "yamllint . --format standard" @@ -393,11 +396,10 @@ def unittest(context, label="", failfast=False, pattern="", verbose=False): @task( help={ "failfast": "fail as soon as a single test fails don't run the entire test suite. (default: False)", - "keepdb": "Save and re-use test database between test runs for faster re-testing. (default: False)", "lint-only": "Only run linters; unit tests will be excluded. (default: False)", } ) -def tests(context, failfast=False, keepdb=False, lint_only=False): +def tests(context, failfast=False, lint_only=False): """Run all tests for this app.""" # If we are not running locally, start the docker containers so we don't have to for each test if not is_truthy(context.cookiecutter_nautobot_app.local):