{"id":21206191,"url":"https://github.com/rtmigo/depz","last_synced_at":"2025-03-14T23:11:41.792Z","repository":{"id":62567732,"uuid":"344161484","full_name":"rtmigo/depz","owner":"rtmigo","description":"💻 Command-line tool for symlinking directories with reusable code into the project. Language-agnostic","archived":false,"fork":false,"pushed_at":"2021-03-05T06:00:58.000Z","size":99,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T02:37:43.488Z","etag":null,"topics":["dependencies","directories","files","library","library-management","local","package","package-management","programming","project","reusable-code","reusable-components","source-code","symlink"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/depz","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtmigo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-03T14:51:05.000Z","updated_at":"2021-03-08T04:18:13.000Z","dependencies_parsed_at":"2022-11-03T16:30:41.767Z","dependency_job_id":null,"html_url":"https://github.com/rtmigo/depz","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fdepz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fdepz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fdepz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Fdepz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtmigo","download_url":"https://codeload.github.com/rtmigo/depz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658273,"owners_count":20326467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependencies","directories","files","library","library-management","local","package","package-management","programming","project","reusable-code","reusable-components","source-code","symlink"],"created_at":"2024-11-20T20:54:44.696Z","updated_at":"2025-03-14T23:11:41.768Z","avatar_url":"https://github.com/rtmigo.png","language":"Python","readme":"# [depz](https://github.com/rtmigo/depz)\n\n[![Generic badge](https://img.shields.io/badge/ready_for_use-maybe-orange.svg)](#)\n[![PyPI version shields.io](https://img.shields.io/pypi/v/depz.svg)](https://pypi.python.org/pypi/depz/)\n[![Actions Status](https://github.com/rtmigo/depz/workflows/CI/badge.svg?branch=master)](https://github.com/rtmigo/depz/actions)\n[![Generic badge](https://img.shields.io/badge/CI_OS-MacOS,_Ubuntu-blue.svg)](#)\n[![Generic badge](https://img.shields.io/badge/CI_Python-3.7--3.9-blue.svg)](#)\n\n\nCommand-line tool for symlinking directories with reusable source code into the project.\n\nLanguage-agnostic. Works equally well for C++ and for HTML web-sites. \n\n# Why\n\n**Reusing code** should be simple. If I have the needed code in a **directory on a local drive**, \nI just want to **include it** in the project. Without packaging it as a library \nfor distribution or messing with IDE settings.\n\nMy first thought is to **create a symlink**:\n\n```bash\n$ ln -s /abc/libs/mylib /abc/project/mylib\n```\n\nNow `project` sees `mylib` as a local directory `project/mylib`. I can edit both `project` \nand `mylib` while working on the `project`.\n\nBut here problems arise:\n- **Portability**. How do I make the symlinks easy to recreate on another machine?\n- **Recursive local dependencies**. How do I include not only `mylib`, but all the dependencies of `mylib`, and the dependencies of those dependencies?\n\nThe answer is `depz`. It reduces these tasks to a one-line command.\n\n# Install\n\nGet a working [Python](https://www.python.org/) ≥3.7 and [pip](https://pip.pypa.io/en/stable/installing/). You may also need a computer. Then:\n\n```bash\n$ pip3 install depz\n```\n\nMake sure that it is installed:\n\n```bash\n$ depz --help\n```\n\nUpgrade it later:\n```bash\n$ pip3 install depz --upgrade\n```\n\n\n\n# Use\n\n- Specify dependencies in `depz.txt`\n- Run the command `depz`\n\n# Specify dependencies\n\nFile `xxx/depz.txt` lists dependencies for `xxx`:\n- `/abc/myproject/depz.txt` for `myproject`\n- `/abc/libs/mylib/depz.txt` for `mylib`\n\nThe `depz.txt` format:\n```sh\n# lines that specify local directory \n# names are LOCAL dependencies\n  \n/absolute/path/to/mylib1\n../libs/mylib2\n~/path/mylib3\n\n# lines that cannot be resolved to an existing \n# directory are considered EXTERNAL dependencies\n \nrequests\nnumpy\n```\n\n# Run\n\n```bash\n$ cd /abc/myproject\n$ depz\n```\n\nThis recursively scans `/abc/myproject/depz.txt` and prints all the found dependencies. Doesn't make any changes to the file system. \n\n---------\n\n```bash\n$ cd /abc/myproject\n$ depz --relink\n```\n\nRemoves all the symlinks found in `/abc/myproject`. Adds new symlinks to the local dependent directories. Prints external dependencies.\n \n\n# Local dependencies\n\n### They are recursive\n\nWhen a project depends on local `mylib`, it means, it also depends on all \nthe dependencies of `mylib`. So after scanning `myproject/depz.txt` we will also \nscan `mylib/depz.txt` to include its dependencies too.\n\n### Paths are relative to the current depz.txt\n\nWhen we scan `/abc/myproject/depz.txt`, the paths are relative to `/abc/myproject`. Then we found a link \nto `mylib` and started scanning `/abc/mylib/depz.txt`. The paths found there are relative to `/abc/mylib`.  \n\nBut all the symlinks will go directly into `/abc/myproject`.\n\nThe following examples show how the directories will be linked when running `depz` for `/abc/project`:\n\n#### Default behavior\n\n| File  | Line | Resolves to | Creates symlink |\n|--------------------|------------|---------------|--------|\n|/abc/project/depz.txt|/abc/libs/aaa|/abc/libs/aaa|/abc/project/aaa|\n|/abc/project/depz.txt|../libs/bbb|/abc/libs/bbb|/abc/project/bbb|\n|/abc/libs/aaa/depz.txt|../ccc|/abc/libs/ccc|/abc/project/ccc|\n\n#### With `--mode=layout`\n\n| File  | Line | Resolves to | Creates symlink |\n|--------------------|------------|---------------|--------|\n| /abc/project/depz.txt | /abc/libs/aaa|/abc/libs/aaa/src\u003cbr/\u003e/abc/libs/aaa/test|/abc/project/src/aaa\u003cbr/\u003e/abc/project/test/aaa |\n| /abc/project/depz.txt | ../libs/aaa|/abc/libs/bbb/src\u003cbr/\u003e/abc/libs/bbb/test|/abc/project/src/bbb\u003cbr/\u003e/abc/project/test/bbb |\n| /abc/libs/aaa/depz.txt | ../ccc|/abc/libs/ccc/src\u003cbr/\u003e/abc/libs/ccc/test|/abc/project/src/ccc\u003cbr/\u003e/abc/project/test/ccc |\n\nThis is useful for frameworks with strict directory structures such as Flutter.\n\n# External dependencies\n\nBy default, the list of all external dependencies is simply printed to the terminal like that:\n\n```txt\n$ depz\n\nDepz file: /abc/myproject/depz.txt\n...\nExternal dependencies: pandas numpy requests\n```\n\nThe `-e` argument causes the command to print only the list of dependencies.\n\n## Print in one line:\n\n```txt\n$ depz -e line\n\npandas numpy requests\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e[click to open] This can be useful for installing Python external dependencies\u003c/summary\u003e\u003cbr/\u003e\n\n```txt\n$ pip3 install $(depz -e line)\n```\n\nOr install external dependencies and symlink local ones:\n```txt\n$ pip3 install $(depz -e line --relink)\n```\n\n\u003c/details\u003e\n\n\n## Print one per line:\n```txt\n$ depz -e multi\n\npandas\nnumpy\nrequests\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e[click to open] Sample usage for creating requirements.txt for Python\u003c/summary\u003e\u003cbr/\u003e\n\n\n```txt\n$ depz -e multi \u003e requirements.txt\n```\n\u003c/details\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Fdepz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtmigo%2Fdepz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Fdepz/lists"}