chore(deps): drop unused mock and types-setuptools#1517
Conversation
Audit shows neither package is actually used: - mock (5.2.0): every test file imports `from unittest import mock` or `from unittest.mock import ...`, never the third-party backport. The third-party `mock` package is only needed for Python <3.3 which we dropped support for years ago. - types-setuptools (75.8.2.20250305): no `import setuptools`, `import pkg_resources`, or `import distutils` anywhere in the source, tests, or samples. Originally pulled in for typing the pkg_resources fallback in http_client.sdk_version, which was removed in the uv migration once we standardized on importlib.metadata for Python 3.9+. Removing these closes the renovate churn driven by these deps (#777, #776, #573, #567, #553 etc. — all types-setuptools bumps that have been failing CI for unrelated reasons). Also drops `Apache Software License` from pylic's safe_licenses since types-setuptools was the only package whose metadata used that long-form name; remaining Apache-licensed deps (coverage, cryptography) declare `Apache-2.0` which was already listed.
|
🐕 Review complete — View session on Shuni Portal 🐾 |
There was a problem hiding this comment.
🐕 Shuni's Review
Drops two unused dev/types deps (mock, types-setuptools) and the now-redundant Apache Software License safe-license alias.
No issues found — good bones! Verified:
- Zero
import mock/from mockin the tree (tests use stdlibunittest.mock) - Zero
setuptools/pkg_resources/distutilsimports Apache-2.0SPDX entry still covers remaining Apache deps aftertypes-setuptools(the loneApache Software Licenselong-form package) is gone
Woof! 🦴
There was a problem hiding this comment.
Pull request overview
Removes two unused development/type-checking dependencies (mock, types-setuptools) from the project’s dependency declarations and lockfile, and simplifies license allow-listing accordingly.
Changes:
- Drop
mockfrom thedevdependency group and fromuv.lock(tests useunittest.mockfrom the standard library). - Drop
types-setuptoolsfrom thetypesdependency group and fromuv.lock(nosetuptools/pkg_resourcesusage remains). - Remove the redundant
Apache Software Licenseentry from[tool.pylic].safe_licensesafter dependency cleanup.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pyproject.toml |
Removes unused deps from dependency groups and updates pylic safe license list. |
uv.lock |
Regenerates the lock to reflect removal of mock, types-setuptools, and the now-unneeded setuptools entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportThe coverage rate went from None of the new lines are part of the tested code. Therefore, there is no coverage data about them. |
Summary
Audit of every declared dependency vs actual import sites surfaced two packages that aren't used by anything in this repo. Drop them.
mock==5.2.0mock.Mock()/mock.patchcalls come fromfrom unittest import mock(stdlib). Zero^import mockor^from mockintests/,samples/, ordescope/. The third-partymockpackage is a backport for Python <3.3 — irrelevant since we require 3.9+.types-setuptools==75.8.2.20250305import setuptools,import pkg_resources,import distutilsanywhere. Was originally needed for typing thepkg_resourcesfallback inhttp_client.sdk_version, which was removed in #1453 once we standardized onimportlib.metadata.What stays
Verified each remaining dep is actually imported:
httpx—descope/http_client.pyetc. (4 src files)certifi—descope/http_client.py(certifi.where()for SSL CA bundle)pyjwt[crypto]—descope/auth.py,descope/jwt_common.py(imported asimport jwt)email-validator—descope/auth.pyFlask(extra) —descope/flask/__init__.py, samplespre-commit,ruff,mypy— actual CI/dev toolingcoverage[toml]— invoked directly in CI asuv run coverage run -m pytestpytest-cov— supports the--covform documented in README (intentionally added in refactor: migrate from poetry to uv #1453)Knock-on cleanup
Drops
Apache Software Licensefrom[tool.pylic].safe_licenses.types-setuptoolswas the only installed package whose metadata used that long-form name; remaining Apache-licensed deps (coverage,cryptography) declareApache-2.0which is already listed.Why this matters
Several open Renovate PRs are bumping
types-setuptools(#777 v82, #776 v81, #573 v80, #567 v79, #553 v78, etc). They've all been failing CI for unrelated reasons but they're also pure noise — the dep is unused. Closing this gap kills the noise at the source.Verification
uv sync --all-extras --locked— clean (60 → 60 - 3 packages)uv run ruff check ./ruff format --check— cleanuv run mypy descope tests samples— no issues (107 files)uv run pytest tests— 458 passed on Python 3.9 and 3.13uv run --with pylic pylic check— ✨ All licenses ok ✨