Package: dep-check
dep-checkdep-checkis a Python dependency checker. It lets you write rules to define what each module can import,dep-checkcan then parse each source file in your project to verify everything is in order. You can also use it to draw a dependency graph for your project.Free software:MIT licenseSupported languagesPythonBy default, the tool assumes it's operating on a Python project.InstallationTo installdep-check, run this command:pipinstalldep-checkThis is the preferred method to installdep-check, as it always
installs the most recent stable release.If you don't havepipinstalled, thisPython installation guidecan guide you through the process.You can also seeother installation methods.UsageBuild your configuration filedep_checkbuild<ROOT_DIR>[-oconfig.yaml][--langLANG]ArgumentDescriptionOptionalDefaultROOT_DIRThe project root directory, containing the source files:x:N/A-o / --outputThe output file (yaml format):heavy_check_mark:dependency_config.yaml--langThe language the project is written in:heavy_check_mark:pythonThis command lists the imports of each module in a yaml file. Use this file as a starting point to write dependency rules on which module can import what, using wildcards.Here is an example of additional rules added to the initial yaml file:---dependency_rules:'*':-dep_check.models-dep_check.dependency_finder-dep_check.checkerdep_check.infra.io:-dep_check.use_cases%-jinja2-yamldep_check.infra.std_lib_filter:-dep_check.use_cases.interfacesdep_check.use_cases%:-dep_check.use_cases.app_configuration-dep_check.use_cases.interfacesdep_check.main:-'*'lang:pythonlocal_init:falseUse*to include any string, even an empty one.Use%after a module name (e.g.my_module%) to include this module along with its sub-modules.Here, for instance, the configuration file defines thatdep_check.infra.iocan importdep_check.use_cases, along withdep_check.use_cases.build,dep_check.use_cases.check, and so on.To see all the supported wildcards, check theUser Manual.Check your configurationOnce your config file is ready, rundep_checkcheck<ROOT_DIR>[-cconfig.yaml][--langLANG]ArgumentDescriptionOptionalDefaultROOT_DIRThe project root directory, containing the source files:x:N/A-c / --configThe yaml file in which you wrote the dependency rules:heavy_check_mark:dependency_config.yaml--langThe language the project is written in:heavy_check_mark:pythonThe command reads the configuration file, and parses each source file. It then verifies, for each file, that everyimportis authorized by the rules defined in the configuration file.When it's done, it writes a report on the console, listing import errors by module and unused rules:Draw a dependency graphYou need to have graphviz installed to run this commanddep_checkgraph<ROOT_DIR>[-ofile.svg/dot][-cconfig.yaml][--langLANG]ArgumentDescriptionOptionalDefaultROOT_DIRThe project root directory, containing the source files:x:N/A-o / --outputThe output file you want (svg or dot format):heavy_check_mark:dependency_graph.svg-c / --configThe graph configuration file containing options (yaml format):heavy_check_mark:None--langThe language the project is written in:heavy_check_mark:pythonNote : if you generate a svg file, a dot file is also created in/tmp/graph.dotA lot of options are available to customize your graph (hide some modules, add layers etc.). Check theUser Manualfor more information.ContributingIf you want to make a contribution, be sure to follow theContribution guide.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject templateAuthors & contributorsCheck out all theAuthors and contributorsof this project.CHANGELOG3.0.1(2023-03-28)BUGFIXUse OrderedSet instead of set, in order to have a deterministic runs3.0.0(2022-12-21)MAJORUpdate python support, tested on 3.9, 3.10, 3.11.Add support of dynamic rules (see doc)Support multiple files and directories in parameters.Droperror_on_unusedoption (replaced byunused_level).Addunused_leveloption to choose the raise an error when unused rules are detected.2.0.1(2022-06-02)MAJORDrop go compatibility.Update python support, tested on 3.8, 3.9, 3.10.Adderror_on_unusedoption to raise an error when unused rules are detected.1.0.3(2019-08-26)BUGFIXThe tool now works correctly with Go.1.0.0 (2019-08-20)ModifiedThe tool now writes a full report, displaying the number of errors, warnings and files.The commands have been simplified, to avoid too long command linesAddedThe tool now supports Go languageBetter documentation0.2.0 (2019-07-16)AddedYou can now add layers to your graph.The tool now warns you if a rule in your configuration file is not used.0.1.0 (2019-07-09)First release on PyPI.