Skip to content

chore: replace dpdm with rev-dep (faster alternative for circular imports check)#8955

Open
jayu wants to merge 2 commits intoinvoke-ai:mainfrom
jayu:jayu/rev-dep
Open

chore: replace dpdm with rev-dep (faster alternative for circular imports check)#8955
jayu wants to merge 2 commits intoinvoke-ai:mainfrom
jayu:jayu/rev-dep

Conversation

@jayu
Copy link

@jayu jayu commented Mar 9, 2026

Summary

Hi! I would like to propose replacing library dpdm that is used to lint frontend codebase against circular dependencies with much faster alternative tool rev-dep

Circular check with rev-dep takes around 150ms (without pnpm overhead) while dpdm needs around 5s

Disclaimer: I'm rev-dep author

Related Issues / Discussions

Rev-dep is also an alternative tool to knip.dev which is also used in the project. Rev-dep offers much faster check times which is useful for both humans and AI agents.

I can help integrating other rev-dep checks into codebase / replacing knip.

Rev-dep is not 1:1 replacement for knip, but it covers most important checks - unused exports, missing / unused dependencies, orphan files, unresolved imports.

Rev-dep timing is around 150ms while knip checks takes 5s+ . Example config :

image

QA Instructions

CI must be green

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added CI-CD Continuous integration / Continuous delivery Root frontend-deps PRs that change frontend dependencies frontend PRs that change frontend files docs PRs that change docs labels Mar 9, 2026
@Pfannkuchensack
Copy link
Collaborator

The changes cause the build to produce errors. (a lot)

@jayu
Copy link
Author

jayu commented Mar 10, 2026

I've fixed the issue with knip detecting rev-dep unused package/binary. I've successfully build the front-end app.
Do you have any other build issues?

@Pfannkuchensack
Copy link
Collaborator

Pfannkuchensack commented Mar 10, 2026

Build Performance Comparison: dpdm vs rev-dep

Metric main (dpdm) PR (rev-dep) Difference
Circular dependency check 8.23s 8.00s ~0.2s faster
Full build (lint + vite) 30.62s 30.34s ~0.3s faster

Summary: rev-dep is marginally faster (~0.3s on full build), but the difference is negligible. Both tools correctly detect zero circular dependencies in the src directory.

Note: The PR required two fixes to work correctly:

  1. A .rev-dep.config.jsonc with "path": "src" to exclude node_modules from scanning
  2. Changing the lint script to rev-dep config run (instead of rev-dep circular --ignore-type-imports)

I dont know if this is the right thing with the config, so if you have any change that removes more time then i am happy to test again.

@jayu
Copy link
Author

jayu commented Mar 11, 2026

It's strange that you get similar time for dpdm and rev-dep

Here are my measurements (done with hyperfine --runs 3 '<command>', I'm using Mac M1 2020)

Run from InvokeAI/invokeai/frontend/web

Metric main (dpdm) PR (rev-dep) Difference
Circular dependency check pnpm run lint:dpdm/circular 4.623 s 469.8 ms 4.154 s faster
Full build (lint + vite) ` 56.914 s 54.090 s 2.824 s faster

rev-dep.config.jsonc is a separate thing, in this PR I propose to drop-in replace library for checking circular imports.

Integrating rev-dep config and replacing knip comes with changes to what those tools covers, rev-dep does not detect unused enum members, unused namespace types and exports, unused class members etc.
But on the other hand rev-dep can detect usage of dev dependencies in production code.

So tools have some common features, but knip cannot be fully replaced with rev-dep. I can help with changing knip to rev-dep but maintainers needs to agree for that before I commit my time into it :)

rev-dep is much faster than knip, we can expect similar difference like between dpdm and rev-dep from the table above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-CD Continuous integration / Continuous delivery docs PRs that change docs frontend PRs that change frontend files frontend-deps PRs that change frontend dependencies Root

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants