From 47288456a5aa8b76daef57b16fa587f0ef58151f Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Mon, 22 May 2023 09:33:10 -0400 Subject: [PATCH] build(deps): bump dependencies --- .pre-commit-config.yaml | 2 +- poetry.lock | 101 ++++++++++++---------- pyproject.toml | 9 +- scripts/update_dependencies.py | 150 +++++++++++++++++++++++++++++++++ 4 files changed, 217 insertions(+), 45 deletions(-) create mode 100755 scripts/update_dependencies.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4e4081..b17b3cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: "https://github.com/commitizen-tools/commitizen" - rev: 3.0.1 + rev: 3.2.2 hooks: - id: "commitizen" diff --git a/poetry.lock b/poetry.lock index 0cd2284..f2c19cf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,19 +1,19 @@ -# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. [[package]] name = "ansible" -version = "7.4.0" +version = "7.5.0" description = "Radically simple IT automation" category = "main" optional = false python-versions = ">=3.9" files = [ - {file = "ansible-7.4.0-py3-none-any.whl", hash = "sha256:c9b5cae2ff8168b3dc859fff12275338cd7c84ef37f62889076f82846bb4beb5"}, - {file = "ansible-7.4.0.tar.gz", hash = "sha256:0964d6ec7b363d2d559f245c39b01798c720a85b207672ec2c9d83cf61564b90"}, + {file = "ansible-7.5.0-py3-none-any.whl", hash = "sha256:a2deadeb8a199abfbd7c1960bc126697be517ac4310b2f59eb2190706e6a2637"}, + {file = "ansible-7.5.0.tar.gz", hash = "sha256:4f08ca25bb29005c1afc4125e837882ad7a2c67ff0cc9d1a361b89ad09cf8c44"}, ] [package.dependencies] -ansible-core = ">=2.14.4,<2.15.0" +ansible-core = ">=2.14.5,<2.15.0" [[package]] name = "ansible-core" @@ -36,14 +36,14 @@ resolvelib = ">=0.5.3,<0.9.0" [[package]] name = "ansible-lint" -version = "6.15.0" +version = "6.16.2" description = "Checks playbooks for practices and behavior that could potentially be improved" category = "main" optional = false python-versions = ">=3.9" files = [ - {file = "ansible-lint-6.15.0.tar.gz", hash = "sha256:4ce790cf0006760ba01d8b946d80303702fc7454bd19c6b3079dd98d40517e6f"}, - {file = "ansible_lint-6.15.0-py3-none-any.whl", hash = "sha256:e5a3b7bd1ebe3cc1c574d1bd3de756bdf157110559024c50d34b5479d47290ba"}, + {file = "ansible-lint-6.16.2.tar.gz", hash = "sha256:93ad8a04adcda6025d4ff218a10694120fe70cb91da8ac9f85c5dc82b32456e4"}, + {file = "ansible_lint-6.16.2-py3-none-any.whl", hash = "sha256:086306d5962639100d03701fce589c85549fe1c23e359abc52c91e07f0108e5b"}, ] [package.dependencies] @@ -54,15 +54,15 @@ jsonschema = ">=4.10.0" packaging = ">=21.3" pyyaml = ">=5.4.1" rich = ">=12.0.0" -"ruamel.yaml" = ">=0.17.21,<0.18" +"ruamel.yaml" = ">=0.17.0,<0.18" subprocess-tee = ">=0.4.1" wcmatch = ">=8.1.2" yamllint = ">=1.30.0" [package.extras] docs = ["mkdocs-ansible[lock] (>=0.1.4)", "pipdeptree (>=2.4.0)"] -lock = ["ansible-core (==2.14.4)", "attrs (==23.1.0)", "black (==23.3.0)", "bracex (==2.3.post1)", "cffi (==1.15.1)", "click (==8.1.3)", "cryptography (==40.0.2)", "filelock (==3.11.0)", "jinja2 (==3.1.2)", "jsonschema (==4.17.3)", "markdown-it-py (==2.2.0)", "markupsafe (==2.1.2)", "mdurl (==0.1.2)", "mypy-extensions (==1.0.0)", "packaging (==23.1)", "pathspec (==0.11.1)", "platformdirs (==3.2.0)", "pycparser (==2.21)", "pygments (==2.15.0)", "pyrsistent (==0.19.3)", "pyyaml (==6.0)", "resolvelib (==0.8.1)", "rich (==13.3.4)", "ruamel-yaml (==0.17.21)", "setuptools (==67.6.1)", "subprocess-tee (==0.4.1)", "tomli (==2.0.1)", "typing-extensions (==4.5.0)", "wcmatch (==8.4.1)", "yamllint (==1.30.0)"] -test = ["black", "coverage-enable-subprocess", "coverage[toml] (>=6.4.4)", "jmespath", "mypy", "netaddr", "psutil", "pylint", "pytest (>=7.2.2)", "pytest-mock", "pytest-plus (>=0.2)", "pytest-xdist (>=2.1.0)", "spdx-tools (>=0.7.1)", "types-jsonschema", "types-pyyaml"] +lock = ["ansible-core (==2.15.0)", "attrs (==23.1.0)", "black (==23.3.0)", "bracex (==2.3.post1)", "cffi (==1.15.1)", "click (==8.1.3)", "cryptography (==40.0.2)", "filelock (==3.12.0)", "importlib-resources (==5.0.7)", "jinja2 (==3.1.2)", "jsonschema (==4.17.3)", "markdown-it-py (==2.2.0)", "markupsafe (==2.1.2)", "mdurl (==0.1.2)", "mypy-extensions (==1.0.0)", "packaging (==23.1)", "pathspec (==0.11.1)", "platformdirs (==3.5.1)", "pycparser (==2.21)", "pygments (==2.15.1)", "pyrsistent (==0.19.3)", "pyyaml (==6.0)", "rich (==13.3.5)", "ruamel-yaml (==0.17.26)", "subprocess-tee (==0.4.1)", "tomli (==2.0.1)", "typing-extensions (==4.5.0)", "wcmatch (==8.4.1)", "yamllint (==1.31.0)"] +test = ["black", "coverage-enable-subprocess", "coverage[toml] (>=6.4.4)", "jmespath", "mypy", "netaddr", "psutil", "pylint", "pytest (>=7.2.2)", "pytest-mock", "pytest-plus (>=0.2)", "pytest-xdist (>=2.1.0)", "ruamel-yaml-clib", "ruamel.yaml (>=0.17.26,<0.18)", "spdx-tools (>=0.7.1)", "types-jsonschema", "types-pyyaml"] [[package]] name = "argcomplete" @@ -277,6 +277,9 @@ files = [ {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, ] +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + [[package]] name = "colorama" version = "0.4.6" @@ -398,14 +401,14 @@ testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "p [[package]] name = "identify" -version = "2.5.22" +version = "2.5.24" description = "File identification library for Python" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "identify-2.5.22-py2.py3-none-any.whl", hash = "sha256:f0faad595a4687053669c112004178149f6c326db71ee999ae4636685753ad2f"}, - {file = "identify-2.5.22.tar.gz", hash = "sha256:f7a93d6cf98e29bd07663c60728e7a4057615068d7a639d132dc883b2d54d31e"}, + {file = "identify-2.5.24-py2.py3-none-any.whl", hash = "sha256:986dbfb38b1140e763e413e6feb44cd731faf72d1909543178aa79b0e258265d"}, + {file = "identify-2.5.24.tar.gz", hash = "sha256:0aac67d5b4812498056d28a9a512a483f5085cc28640b02b258a59dac34301d4"}, ] [package.extras] @@ -560,14 +563,14 @@ files = [ [[package]] name = "nodeenv" -version = "1.7.0" +version = "1.8.0" description = "Node.js virtual environment builder" category = "main" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" files = [ - {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, - {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, ] [package.dependencies] @@ -611,18 +614,18 @@ files = [ [[package]] name = "platformdirs" -version = "3.3.0" +version = "3.5.1" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.3.0-py3-none-any.whl", hash = "sha256:ea61fd7b85554beecbbd3e9b37fb26689b227ffae38f73353cbcc1cf8bd01878"}, - {file = "platformdirs-3.3.0.tar.gz", hash = "sha256:64370d47dc3fca65b4879f89bdead8197e93e05d696d6d1816243ebae8595da5"}, + {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, + {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] @@ -646,14 +649,14 @@ poetry-plugin = ["poetry (>=1.0,<2.0)"] [[package]] name = "pre-commit" -version = "3.2.2" +version = "3.3.2" description = "A framework for managing and maintaining multi-language pre-commit hooks." category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "pre_commit-3.2.2-py2.py3-none-any.whl", hash = "sha256:0b4210aea813fe81144e87c5a291f09ea66f199f367fa1df41b55e1d26e1e2b4"}, - {file = "pre_commit-3.2.2.tar.gz", hash = "sha256:5b808fcbda4afbccf6d6633a56663fed35b6c2bc08096fd3d47ce197ac351d9d"}, + {file = "pre_commit-3.3.2-py2.py3-none-any.whl", hash = "sha256:8056bc52181efadf4aac792b1f4f255dfd2fb5a350ded7335d251a68561e8cb6"}, + {file = "pre_commit-3.3.2.tar.gz", hash = "sha256:66e37bec2d882de1f17f88075047ef8962581f83c234ac08da21a0c58953d1f0"}, ] [package.dependencies] @@ -830,14 +833,14 @@ test = ["commentjson", "packaging", "pytest"] [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" 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 = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -849,18 +852,18 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "ruamel-yaml" -version = "0.17.21" +version = "0.17.26" description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" category = "main" optional = false python-versions = ">=3" files = [ - {file = "ruamel.yaml-0.17.21-py3-none-any.whl", hash = "sha256:742b35d3d665023981bd6d16b3d24248ce5df75fdb4e2924e93a05c1f8b61ca7"}, - {file = "ruamel.yaml-0.17.21.tar.gz", hash = "sha256:8b7ce697a2f212752a35c1ac414471dc16c424c9573be4926b56ff3f5d23b7af"}, + {file = "ruamel.yaml-0.17.26-py3-none-any.whl", hash = "sha256:25d0ee82a0a9a6f44683dcf8c282340def4074a4562f3a24f55695bb254c1693"}, + {file = "ruamel.yaml-0.17.26.tar.gz", hash = "sha256:baa2d0a5aad2034826c439ce61c142c07082b76f4791d54145e131206e998059"}, ] [package.dependencies] -"ruamel.yaml.clib" = {version = ">=0.2.6", markers = "platform_python_implementation == \"CPython\" and python_version < \"3.11\""} +"ruamel.yaml.clib" = {version = ">=0.2.7", markers = "platform_python_implementation == \"CPython\" and python_version < \"3.12\""} [package.extras] docs = ["ryd"] @@ -914,21 +917,33 @@ files = [ [[package]] name = "setuptools" -version = "67.7.2" +version = "67.8.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.7.2-py3-none-any.whl", hash = "sha256:23aaf86b85ca52ceb801d32703f12d77517b2556af839621c641fca11287952b"}, - {file = "setuptools-67.7.2.tar.gz", hash = "sha256:f104fa03692a2602fa0fec6c6a9e63b6c8a968de13e17c026957dd1f53d80990"}, + {file = "setuptools-67.8.0-py3-none-any.whl", hash = "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f"}, + {file = "setuptools-67.8.0.tar.gz", hash = "sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102"}, ] [package.extras] docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] +[[package]] +name = "sh" +version = "2.0.4" +description = "Python subprocess replacement" +category = "dev" +optional = false +python-versions = ">=3.8.1,<4.0" +files = [ + {file = "sh-2.0.4-py3-none-any.whl", hash = "sha256:14265a4cd1622429edcf300292ec98193530fb143fe642b3437024eca9bee8c5"}, + {file = "sh-2.0.4.tar.gz", hash = "sha256:a18920f0839991bc9dfddb6dcc006c360b1064ba96257359f0ea356e9fa75a60"}, +] + [[package]] name = "subprocess-tee" version = "0.4.1" @@ -973,14 +988,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -997,14 +1012,14 @@ files = [ [[package]] name = "virtualenv" -version = "20.22.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.22.0-py3-none-any.whl", hash = "sha256:48fd3b907b5149c5aab7c23d9790bea4cac6bc6b150af8635febc4cfeab1275a"}, - {file = "virtualenv-20.22.0.tar.gz", hash = "sha256:278753c47aaef1a0f14e6db8a4c5e1e040e90aea654d0fc1dc7e0d8a42616cc3"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] @@ -1014,7 +1029,7 @@ platformdirs = ">=3.2,<4" [package.extras] docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wcmatch" @@ -1065,4 +1080,4 @@ dev = ["doc8", "flake8", "flake8-import-order", "rstcheck[sphinx]", "sphinx"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "5ef9a5432b997e5178ae778d102fda95ca3792c0f21ea9b0b78146490b7ec82f" +content-hash = "1b7a947a7e186e00af3b6884941a659ca25491237343c7daae79df656aa18a7b" diff --git a/pyproject.toml b/pyproject.toml index d34d55f..4e91ecd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ version = "0.2.0" [tool.poetry.dependencies] - ansible = "^7.2.0" + ansible = "^7.5.0" ansible-lint = { version = "^6.12.1", markers = "platform_system != 'Windows'" } commitizen = "^2.40.0" poethepoet = "^0.18.1" @@ -15,10 +15,17 @@ python = "^3.9" yamllint = "^1.29.0" + [tool.poetry.group.dev.dependencies] + black = "^23.3.0" + sh = "^2.0.4" + [build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] +[tool.black] + line-length = 100 + [tool.commitizen] bump_message = "bump(release): v$current_version → v$new_version" tag_format = "v$version" diff --git a/scripts/update_dependencies.py b/scripts/update_dependencies.py new file mode 100755 index 0000000..479ab90 --- /dev/null +++ b/scripts/update_dependencies.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python +"""Script to update the pyproject.toml file with the latest versions of the dependencies.""" +from pathlib import Path +from textwrap import wrap + +try: + import tomllib +except ModuleNotFoundError: # pragma: no cover + import tomli as tomllib # type: ignore [no-redef] + +import sh +from rich.console import Console + +console = Console() + + +def dryrun(msg: str) -> None: + """Print a message if the dry run flag is set. + + Args: + msg: Message to print + """ + console.print(f"[cyan]DRYRUN | {msg}[/cyan]") + + +def success(msg: str) -> None: + """Print a success message without using logging. + + Args: + msg: Message to print + """ + console.print(f"[green]SUCCESS | {msg}[/green]") + + +def warning(msg: str) -> None: + """Print a warning message without using logging. + + Args: + msg: Message to print + """ + console.print(f"[yellow]WARNING | {msg}[/yellow]") + + +def error(msg: str) -> None: + """Print an error message without using logging. + + Args: + msg: Message to print + """ + console.print(f"[red]ERROR | {msg}[/red]") + + +def notice(msg: str) -> None: + """Print a notice message without using logging. + + Args: + msg: Message to print + """ + console.print(f"[bold]NOTICE | {msg}[/bold]") + + +def info(msg: str) -> None: + """Print a notice message without using logging. + + Args: + msg: Message to print + """ + console.print(f"INFO | {msg}") + + +def usage(msg: str, width: int = 80) -> None: + """Print a usage message without using logging. + + Args: + msg: Message to print + width (optional): Width of the message + """ + for _n, line in enumerate(wrap(msg, width=width)): + if _n == 0: + console.print(f"[dim]USAGE | {line}") + else: + console.print(f"[dim] | {line}") + + +def debug(msg: str) -> None: + """Print a debug message without using logging. + + Args: + msg: Message to print + """ + console.print(f"[blue]DEBUG | {msg}[/blue]") + + +def dim(msg: str) -> None: + """Print a message in dimmed color. + + Args: + msg: Message to print + """ + console.print(f"[dim]{msg}[/dim]") + + +# Load the pyproject.toml file +pyproject = Path(__file__).parents[1] / "pyproject.toml" + +if not pyproject.exists(): + console.print("pyproject.toml file not found") + raise SystemExit(1) + +with pyproject.open("rb") as f: + try: + data = tomllib.load(f) + except tomllib.TOMLDecodeError as e: + raise SystemExit(1) from e + + +# Get the latest versions of all dependencies +info("Getting latest versions of dependencies...") +packages: dict = {} +for line in sh.poetry("--no-ansi", "show", "--outdated").splitlines(): + package, current, latest = line.split()[:3] + packages[package] = {"current_version": current, "new_version": latest} + +if not packages: + success("All dependencies are up to date") + raise SystemExit(0) + + +dependencies = data["tool"]["poetry"]["dependencies"] +groups = data["tool"]["poetry"]["group"] + +for p in dependencies: + if p in packages: + notice( + f"Updating {p} from {packages[p]['current_version']} to {packages[p]['new_version']}" + ) + sh.poetry("add", f"{p}@latest", _fg=True) + + +for group in groups: + for p in groups[group]["dependencies"]: + if p in packages: + notice( + f"Updating {p} from {packages[p]['current_version']} to {packages[p]['new_version']}" + ) + sh.poetry("add", f"{p}@latest", "--group", group, _fg=True) + +sh.poetry("update", _fg=True) +success("All dependencies are up to date") +raise SystemExit(0)