Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect dependency cycles beyond a depth = 2 #274

Merged
merged 3 commits into from
Jul 30, 2023

Conversation

kemzeb
Copy link
Collaborator

@kemzeb kemzeb commented Jul 30, 2023

Should resolve #191.

The previous implementation of cyclic_deps() only detected a dependency cycle when a dependency of a DistPackage was dependent on that DistPackage (e.g. a -> b -> a). Sadly, this did not bid well when you have a cycle such as a -> b -> c -> d -> e -> a (i.e. it has a depth > 2 with "a" as the root).

This CL reimplements it to use DFS, where we perform DFS on each DistPackage and just check to see if this DistPackage (think of it as the root node) was revisited (by comparing the current node's key that were are visiting to the root node's key).

@gaborbernat gaborbernat merged commit 1ca7fe7 into tox-dev:main Jul 30, 2023
@kemzeb kemzeb deleted the fix/cyclic-deps branch July 30, 2023 01:55
jankatins referenced this pull request in jankatins/pr-workflow-example Jul 30, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pipdeptree](https://togithub.com/tox-dev/pipdeptree)
([changelog](https://togithub.com/tox-dev/pipdeptree/blob/main/CHANGES.md))
| `2.11.0` -> `2.12.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/pipdeptree/2.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/pipdeptree/2.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/pipdeptree/2.11.0/2.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/pipdeptree/2.11.0/2.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>tox-dev/pipdeptree (pipdeptree)</summary>

###
[`v2.12.0`](https://togithub.com/tox-dev/pipdeptree/releases/tag/2.12.0)

[Compare
Source](https://togithub.com/tox-dev/pipdeptree/compare/2.11.0...2.12.0)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

- Detect dependency cycles beyond a depth = 2 by
[@&#8203;kemzeb](https://togithub.com/kemzeb) in
[https://github.com/tox-dev/pipdeptree/pull/274](https://togithub.com/tox-dev/pipdeptree/pull/274)

**Full Changelog**:
tox-dev/pipdeptree@2.11.0...2.12.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/jankatins/pr-workflow-example).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44LjExIiwidXBkYXRlZEluVmVyIjoiMzYuMjQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't detect dependency cycles
2 participants