From 39ccefb7e13b3ce316f0f675ab7c3d55082213ed Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Fri, 25 Oct 2024 14:36:25 -1000 Subject: [PATCH] feat: replaced vulture with deptry (#459) --- .pre-commit-config.yaml | 7 +++-- README.md | 2 +- poetry.lock | 30 +++++++++++++++++-- pyproject.toml | 7 +---- .../.pre-commit-config.yaml | 6 ++-- {{cookiecutter.package_name}}/pyproject.toml | 7 +---- .../{{ cookiecutter.package_name }}.py | 5 ++++ 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db30d9f4..0e5c52fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,7 +67,8 @@ repos: hooks: - id: typos args: ["--config", "_typos.toml", "--force-exclude"] - - repo: https://github.com/jendrikseipp/vulture - rev: v2.11 + - repo: https://github.com/fpgmaas/deptry.git + rev: "0.20.0" hooks: - - id: vulture + - id: deptry + args: ["--ignore", "DEP001,DEP002"] diff --git a/README.md b/README.md index 43fd37e4..4f1bd647 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ template is the tool that will help you do just that. - selectable theme - [`pdb++`](https://github.com/pdbpp/pdbpp) for debugging - [`konch`](http://konch.readthedocs.org/en/latest/) for shell configuration w/ [`ipython`](https://ipython.org) support -- [`pre-commit`](https://pre-commit.com) hooks with various hooks (mypy / black / [`ruff`](https://github.com/astral-sh/ruff)) +- [`pre-commit`](https://pre-commit.com) hooks with various hooks (mypy / black / [`ruff`](https://github.com/astral-sh/ruff) / [`deptry`](https://github.com/fpgmaas/deptry)) - [`dockerfile`](https://www.docker.com/) for development, testing, and production - [`dunamai`](https://github.com/mtkennerly/dunamai) for versioning - custom [`Justfile`](https://github.com/casey/just) (run `just`) diff --git a/poetry.lock b/poetry.lock index 9745081d..d817e03c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. [[package]] name = "alabaster" @@ -423,6 +423,32 @@ tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.1 [package.extras] toml = ["tomli"] +[[package]] +name = "deptry" +version = "0.20.0" +description = "A command line utility to check for unused, missing and transitive dependencies in a Python project." +optional = false +python-versions = ">=3.8" +files = [ + {file = "deptry-0.20.0-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:41434d95124851b83cb05524d1a09ad6fea62006beafed2ef90a6b501c1b237f"}, + {file = "deptry-0.20.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:b3b4b22d1406147de5d606a24042126cd74d52fdfdb0232b9c5fd0270d601610"}, + {file = "deptry-0.20.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:012fb106dbea6ca95196cdcd75ac90c516c8f01292f7934f2e802a7cf025a660"}, + {file = "deptry-0.20.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8ce3920e2bd6d2b4427ab31ab8efb94bbef897001c2d395782bc30002966d12d"}, + {file = "deptry-0.20.0-cp38-abi3-win_amd64.whl", hash = "sha256:0c90ce64e637d0e902bc97c5a020adecfee9e9f09ee0bf4c61554994139bebdb"}, + {file = "deptry-0.20.0-cp38-abi3-win_arm64.whl", hash = "sha256:6886ff44aaf26fd83093f14f844ebc84589d90df9bbad9a1625e8a080e6f1be2"}, + {file = "deptry-0.20.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:ace3b39b1d0763f357c79bab003d1b135bea2eb61102be539992621a42d1ac7b"}, + {file = "deptry-0.20.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d1a00f8c9e6c0829a4a523edd5e526e3df06d2b50e0a99446f09f9723df2efad"}, + {file = "deptry-0.20.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e233859f150df70ffff76e95f9b7326fc25494b9beb26e776edae20f0f515e7d"}, + {file = "deptry-0.20.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f92e7e97ef42477717747b190bc6796ab94b35655af126d8c577f7eae0eb3a9"}, + {file = "deptry-0.20.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:f6cee6005997791bb77155667be055333fb63ae9a24f0f103f25faf1e7affe34"}, + {file = "deptry-0.20.0.tar.gz", hash = "sha256:62e9aaf3aea9e2ca66c85da98a0ba0290b4d3daea4e1d0ad937d447bd3c36402"}, +] + +[package.dependencies] +click = ">=8.0.0,<9" +colorama = {version = ">=0.4.6", markers = "sys_platform == \"win32\""} +tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} + [[package]] name = "distlib" version = "0.3.8" @@ -1770,4 +1796,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "dd62ba9f9364439bf014f8ab3be50c896728dc3932b1fd490fe9f453decf4c36" +content-hash = "7861c9ff9b951059bffa9a983948f3dec7670abb8fd7cfc36fd842e207a9ec80" diff --git a/pyproject.toml b/pyproject.toml index 2aa3eb78..a43762ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ mypy = "^1.12.1" pytest-cov = "^5.0.0" pytest-xdist = "^3.6.1" ruff = "^0.7.0" +deptry = "^0.20.0" [tool.poetry.group.docs] optional = true @@ -142,12 +143,6 @@ known_first_party = "{{ cookiecutter.package_name }}" sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER" skip = "tests" -[tool.vulture] -make_whitelist = true -min_confidence = 80 -paths = ["hooks", "tests"] -sort_by_size = true - [tool.ruff] extend-exclude = ['[{][{]cookiecutter.package_name[}][}]/tests', '[{][{]cookiecutter.package_name[}][}]/docs', 'docs'] line-length = 79 diff --git a/{{cookiecutter.package_name}}/.pre-commit-config.yaml b/{{cookiecutter.package_name}}/.pre-commit-config.yaml index c787a889..e5dc74ca 100644 --- a/{{cookiecutter.package_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.package_name}}/.pre-commit-config.yaml @@ -63,7 +63,7 @@ repos: hooks: - id: typos args: ["--config", "_typos.toml", "--force-exclude"] - - repo: https://github.com/jendrikseipp/vulture - rev: v2.7 + - repo: https://github.com/fpgmaas/deptry.git + rev: "0.20.0" hooks: - - id: vulture + - id: deptry diff --git a/{{cookiecutter.package_name}}/pyproject.toml b/{{cookiecutter.package_name}}/pyproject.toml index a6632f3f..262f4b14 100644 --- a/{{cookiecutter.package_name}}/pyproject.toml +++ b/{{cookiecutter.package_name}}/pyproject.toml @@ -32,6 +32,7 @@ black = "^23.1" hypothesis = "^6.68.2" mutmut = "^2.4.3" ruff = "^0.1.3" +deptry = "^0.20.0" [tool.poetry.group.docs] optional = true @@ -146,12 +147,6 @@ default_section = "THIRDPARTY" known_first_party = "{{ cookiecutter.package_name }}" sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER" -[tool.vulture] -make_whitelist = true -min_confidence = 80 -paths = ["./src/{{ cookiecutter.package_name }}/", "./tests/"] -sort_by_size = true - [tool.ruff] line-length = 79 extend-exclude = ["docs"] diff --git a/{{cookiecutter.package_name}}/src/{{cookiecutter.package_name}}/{{ cookiecutter.package_name }}.py b/{{cookiecutter.package_name}}/src/{{cookiecutter.package_name}}/{{ cookiecutter.package_name }}.py index 163e6387..11d5bdd4 100644 --- a/{{cookiecutter.package_name}}/src/{{cookiecutter.package_name}}/{{ cookiecutter.package_name }}.py +++ b/{{cookiecutter.package_name}}/src/{{cookiecutter.package_name}}/{{ cookiecutter.package_name }}.py @@ -6,6 +6,11 @@ """Default module for {{ cookiecutter.package_name }}.""" +import structlog + + +LOGGER = structlog.get_logger(__name__) + def hello_world() -> str: return "Hello World"