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

Provide an option to ignore circular dependencies that are outside the distribution being analyzed #6

Open
gforcada opened this issue Oct 15, 2023 · 3 comments

Comments

@gforcada
Copy link
Member

gforcada commented Oct 15, 2023

Use case: a distribution (plone.app.testing) has a GHA with pipforester that fails due to plone.app.multilingual and Products.CMFPlone having a circular dependency.

It is 100% accurate to report such a circular dependency, but it is outside of plone.app.testing control to break that dependency. No changes on the plone.app.testing code base will fix that circular dependency.

In such cases, it would be great to have an option in pipforester to only fail if the circular dependencies found also involve the given distribution.

i.e. right now in the GHA to check for circular dependencies looks like this:

pip install pipdeptree pipforester
pipdeptree -j > forest.json
# Generate a DOT graph with the circular dependencies, if any
pipforester -i forest.json -o forest.dot --cycles
# Report if there are any circular dependencies, i.e. error if there are any
pipforester -i forest.json --check-cycles -o /dev/null

If we had another parameter (-s ?) then we could update the last command to be:

pipforester -s plone.app.testing -i forest.json --check-cycles -o /dev/null

And despite reporting that plone.app.multilingual and Products.CMFPlone have a circular dependency problem, as that one does not involve plone.app.testing pipforester would return a 0 exit status code, i.e. that all good 👍🏾

Does that make sense? 🤔

@mauritsvanrees
Copy link
Member

Yes, I am hoping for something like this as well.

And then we could still have a circular-full gh-action check on one central package, like CMFPlone, that does not use this potential new option, so we have at one package where it still breaks if there is any circular dependency anywhere in the stack.

@gforcada
Copy link
Member Author

Yes, I'm delaying the CMFPlone conversion to plone/meta to iron out a bit more the other packages, but we could start with the linting & QA tools first and add tests and circular later as we see that they work on it 👍🏾

@jensens
Copy link
Member

jensens commented Nov 17, 2023

Probably easy to achieve: After reading of the source graph, remove some given packages and its edges, then proceed as usual. Like after this line

deptreedata = json.load(input)

call a new function like so:

deptreedata = remove_nodes_and_their_edges(deptreedata, list_of_nodes_by_name)

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

No branches or pull requests

3 participants