Package: depz
depzCommand-line tool for symlinking directories with reusable source code into the project.Language-agnostic.WhyReusing codeshould be simple. If I have the needed code in adirectory on a local drive,
I just want toinclude itin the project. Without packaging it as a library
for distribution or messing with IDE settings.My first thought is tocreate a symlink:$ln-s/abc/libs/mylib/abc/project/mylibNowprojectseesmylibas a local directoryproject/mylib. I can edit bothprojectandmylibwhile working on theproject.But here problems arise:Portability. How do I make the symlinks easy to recreate on another system?Recursive local dependencies. How to include not onlymylib, but all the dependencies ofmylib?The answer isdepz. It reduces these tasks to a one-line command.InstallGet a workingPython≥3.7 andpip. You may also need a computer. Then:$pip3installdepzMake sure that it is installed:$depz--helpUpgrade it later:$pip3installdepz--upgradeUseSpecify dependencies indepz.txtRun the commanddepzSpecify dependenciesFilexxx/depz.txtlists dependencies forxxx:/abc/myproject/depz.txtformyproject/abc/libs/mylib/depz.txtformylibThedepz.txtformat:# lines that specify local directory# names are LOCAL dependencies/absolute/path/to/mylib1
../libs/mylib2
~/path/mylib3# lines that cannot be resolved to an existing# directory are considered EXTERNAL dependenciesrequests
numpyRun$cd/abc/myproject
$depzThis recursively scans/abc/myproject/depz.txtand prints all the found dependencies. Doesn't make any changes to the file system.$cd/abc/myproject
$depz--relinkRemoves all the symlinks found in/abc/myproject. Adds new symlinks to the local dependent directories. Prints external dependencies.Local dependenciesThey are recursiveWhen a project depends on localmylib, it means, it also depends on all
the dependencies ofmylib. So after scanningmyproject/depz.txtwe will also
scanmylib/depz.txtto include its dependencies too.Paths are relative to the current depz.txtWhen we scan/abc/myproject/depz.txt, the paths are relative to/abc/myproject. Then we found a link
tomyliband started scanning/abc/mylib/depz.txt. The paths found there are relative to/abc/mylib.But all the symlinks will go directly into/abc/myproject.The following examples show how the directories will be linked when runningdepzfor/abc/project:Default behaviorFileLineResolves toCreates symlink/abc/project/depz.txt/abc/libs/aaa/abc/libs/aaa/abc/project/aaa/abc/project/depz.txt../libs/bbb/abc/libs/bbb/abc/project/bbb/abc/libs/aaa/depz.txt../ccc/abc/libs/ccc/abc/project/cccWith--mode=layoutFileLineResolves toCreates symlink/abc/project/depz.txt/abc/libs/aaa/abc/libs/aaa/src/abc/libs/aaa/test/abc/project/src/aaa/abc/project/test/aaa/abc/project/depz.txt../libs/aaa/abc/libs/bbb/src/abc/libs/bbb/test/abc/project/src/bbb/abc/project/test/bbb/abc/libs/aaa/depz.txt../ccc/abc/libs/ccc/src/abc/libs/ccc/test/abc/project/src/ccc/abc/project/test/cccThis is useful for frameworks with strict directory structures such as Flutter.External dependenciesBy default, the list of all external dependencies is simply printed to the terminal like that:$ depz

Depz file: /abc/myproject/depz.txt
...
External dependencies: pandas numpy requestsThe-eargument causes the command to print only the list of dependencies.Print in one line:$ depz -e line

pandas numpy requests[click to open] This can be useful for installing Python external dependencies$ pip3 install $(depz -e line)Or install external dependencies and symlink local ones:$ pip3 install $(depz -e line --relink)Print one per line:$ depz -e multi

pandas
numpy
requests[click to open] Sample usage for creating requirements.txt for Python$ depz -e multi > requirements.txt