mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
535 stars 344 forks source link

How to list dependencies in pyang #741

Open bipinb1994 opened 3 years ago

bipinb1994 commented 3 years ago

Does pyang provide a way to list down the dependent yang models that should be installed before it's getting installed? Or any such info? Dependency tree kind of something?

fredgan commented 3 years ago

Hi, no, there's no such a way to provide the dependency tree.

I'd like to know what's your usage scenario. As much as I know, all the dependency for a YANG model is that the import statements.

When use pyang to check a YANG model file, it will check all the dependency models. If it is not installed or cannot find in the path, the error is throwed.

Santhoshexp commented 2 years ago

Hi, Is it possible to merge the yang files if it has import statement . Like I have to merge the file and it's dependent file.

wlupton commented 2 years ago

This dependency information should all be present in pyang's internal structures.

Perhaps it would be useful to look at the source code for the depend format? Perhaps take a look at the add_prereqs() function and see whether you can adjust it to do what you want.