Skip to main content

checkdeps

It's really easy to accidentally use your transitive deps by accident. This project allows you to check (given a working venv) that everything you import actually comes from either relative imports, your explicit first-order deps, or stdlib.

Usage:

# Run within a working venv
# For CI
$ python -m checkdeps checkdeps

# If you use non-relative imports for your own project's code, also add
$ python -m checkdeps checkdeps --allow-names checkdeps

# For humans, pass -v
$ python -m checkdeps -v checkdeps/cli.py
checkdeps/cli.py:
  click available from ['click']
  pathlib.Path stdlib
  stdlibs.stdlib_module_names available from ['stdlibs']
  sys stdlib
  trailrunner available from ['trailrunner']
  typing.Dict stdlib
  typing.List stdlib
  typing.Optional stdlib
  typing.Set stdlib

Exits nonzero if there are any issues.

But what if I don't want to run it from the same venv

Make sure you specify --installed-path to the site-packages dir and run from the same python version. A parent of your target_dir should be obviously the root of your project (pyproject.toml, .git, etc), which is what the requirements are relative to.

But aren't there projects that do this already?

I've looked at them, and I don't like the assumptions they make about top-level names, stdlib, or namespace packages. I think this project is more correct and more self-contained.

Future work

  • Read project metadata instead of requirements
  • Ensure metadata and requirements match
  • Offer to add missing deps
  • Better handling of version-dependent deps in an if or try/except

License

checkdeps is copyright Tim Hatch, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

Release files for checkdeps 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for checkdeps 0.9.0
File Size Uploaded
checkdeps-0.9.0.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for checkdeps 0.9.0
File Interpreter ABI Platform
checkdeps-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / checkdeps-0.9.0.tar.gz

Download URL checkdeps-0.9.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b4382c1dbada0f5b7aa458402af4fa0003d3cb54c7c83cd2661d441e0c416973
BLAKE2b-256 checksum
How to use checksums
04fe318ee5fb06a9cc5e5e0c6d7a30bd961efd23ea5ba7c1f2068c8911f6ced4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / checkdeps-0.9.0-py3-none-any.whl

Download URL checkdeps-0.9.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15cec29977a08bcc57d029307b4250b3f97f99aa45d932c8322b3cd0a4059c2f
BLAKE2b-256 checksum
How to use checksums
6394d80517af39ea2e7b079187f280dae12dbc8a6252a0860f7d0adbfb49b127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page