{"id":24859653,"url":"https://github.com/sstark/pydrink","last_synced_at":"2025-07-03T20:33:21.136Z","repository":{"id":228095070,"uuid":"773140420","full_name":"sstark/pydrink","owner":"sstark","description":"Distributed Reusage of Invaluable Nerd Kit (dotfile management)","archived":false,"fork":false,"pushed_at":"2024-06-15T21:16:30.000Z","size":179,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-27T14:39:22.847Z","etag":null,"topics":["dotfiles","dotfiles-manager","environment","git","management","python","python3","shell"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sstark.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-16T21:25:54.000Z","updated_at":"2024-06-15T21:15:59.000Z","dependencies_parsed_at":"2024-06-07T22:23:43.742Z","dependency_job_id":"be42479d-ef97-4fdc-a334-91079de6e0be","html_url":"https://github.com/sstark/pydrink","commit_stats":null,"previous_names":["sstark/pydrink"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sstark/pydrink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sstark%2Fpydrink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sstark%2Fpydrink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sstark%2Fpydrink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sstark%2Fpydrink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sstark","download_url":"https://codeload.github.com/sstark/pydrink/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sstark%2Fpydrink/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263399769,"owners_count":23460756,"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":["dotfiles","dotfiles-manager","environment","git","management","python","python3","shell"],"created_at":"2025-01-31T20:59:25.093Z","updated_at":"2025-07-03T20:33:21.108Z","avatar_url":"https://github.com/sstark.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pydrink\n=======\n\nSimple, low friction Python implementation of the *drink* dotfile management\nsystem. Almost no configuration required. Closely integrated with your shell.\n\nThis will maintain files in a git repository and create symlinks to them in\nappropriate places in your home directory. You will only need a single\nrepository for all your different environments. Drink will only symlink the\nfiles that are configured for a _target_.\n\nThe **interactive git menu** of drink provides a convenient way to manage and\ndistribute your shell environment. Using the git menu you can see which of your\ntracked files have changed and quickly decide to keep or discard those changes.\n\nA **colorful command line interface** is used to interact with the user.\n\nWith the drink git menu you can use the distributed content tracking of git\nwithout having to learn the git command line:\n\n![drink-menu](https://github.com/sstark/pydrink/assets/837918/b87a6b52-88a4-4df3-b4a9-1c6604705425)\n\n**This is prerelease software**. Please be careful and make sure you have\nunderstood the concept and have read the `README.md` file thoroughly. drink\nwill move around and symlink files in your home directory, and while many\nprecautions are implemented to not cause any harm, there is still the\npossibility of bugs. So let this be said until the 1.x.x release: **Do not use\npydrink without a backup of your home directory.**\n\n\nAudience\n--------\n\nThis program is for people who:\n\n  - want to have a tidy environment\n  - want to stay in control of their configuration files\n  - want to share settings and scripts between different locations\n  - want to use a central git repository as a distribution base\n  - like command line interfaces\n  - are not using one of the thousand similar programs already and, for some\n    reason, found pydrink and are convinced by a concept that the author has\n    been using daily for 16 years on ever changing systems (mostly Linux, but\n    also Mac and Windows), when it was just a simple zsh script\n  - are not afraid of many symlinks in their home directory\n\n\nConcepts\n--------\n\nA _target_ can be the name of a host, a shared file system or your company\nname, whatever makes sense to you in order to group your objects. The author\nuses a different target for each home directory. At work this is the same for\nall hosts, while at home this is different for all hosts.\n\nObjects are files. Supported kinds are: bin, zfunc, conf. They will be\nsymlinked into configurable places in your home.\n\n  - 'bin' are scripts or binaries, usually in `~/bin`\n  - 'zfuncs' are shell functions, usually in `~/.zfuncs`\n  - 'conf' are configuration files in your home, e. g. `~/.vimrc` or\n    `~/.config/hypr/hyprland.conf`\n\nKinds are the different types of objects, currently \"bin\", \"zfunc\" and \"conf\".\nA kind has a specific storage location in the drink repository, and it has a\ndedicated place where it will be linked to in the users home directory.\n\n(The _pydrink_ code is structured such that new kinds could be easily added. For\nexample, somebody might want to add a kind for storing bash aliases. Currently\nthis needs changes to the code, but with modest effort.)\n\n\nWhy Symlinks?\n-------------\n\n  - Symlinks make it very easy to see whether a file is managed by drink or\n    not.\n\n  - With symlinks it is extremely simple to check what has changed, because\n    everything just happens within the git repository.\n\n  - Saving space is probably not a point for everyone, since the kind of files\n    we are dealing with here are usually very small, but still it's a point.\n\n\nInterface\n---------\n\nScreenshot of the `drink --help` output:\n\n![drink-help](https://github.com/sstark/pydrink/assets/837918/11d8f0fa-4892-4113-b012-3bfb75cca3be)\n\n\nInstall\n-------\n\nThe recommended way is to use pipx:\n\n    pipx install pydrink\n\npip should also work.\n\nVisit the project page on pypi for all releases: https://pypi.org/project/pydrink/\n\n\nGetting Started\n----------------\n\nIf you have not used drink before, you need to create a configuration file\nand a repository. For both, drink offers you some assistance:\n\n     $ drink -b\n     New drinkrc created in /home/user/.config/drinkrc.\n     Please review or change the contents and run this command again.\n\nNow you can open `drinkrc` and customize it before proceeding. See next chapter\nfor details (and then jump back here). Most importantly you will want to make\nat least one of these changes to it before proceeding:\n\n  - Add a **DRINKBASEURL** parameter to it, if you want to use the distribution\n    features of drink.\n  - If you have a shared home directory (e. g. NFS) and your drink repository\n    is located on it, you likely want to adjust your **TARGET** parameter to\n    not use the hostname, but some broader term.\n  - Adjust the location where your drink repository will be created. For that,\n    change to **DRINKDIR** parameter to point to some (not yet existing)\n    directory. This can be relative to your home.\n\nIf you are happy with your `drinkrc`, run `drink -b` again:\n\n    $ drink -b\n    Configuration found in /home/user/.config/drinkrc, but the configured git repository does not exist yet.\n    Initializing git repository in /home/user/git/drink\n    Initialized empty Git repository in /home/user/git/drink/.git/\n    A drink repository has been created.\n    Configuring git remote.\n    Now you should be able to automerge from all remotes:\n\n      drink -g \u003c\u003c\u003c4\n\n    And add all (missing) symlinks:\n\n      drink -lv\n\nAt this point we have a fully operable drink setup.\n\nAbove process needs to be repeated in all locations where you want to use\ndrink. This does not apply to locations sharing your home directory.\n\n\nConfiguration File\n------------------\n\nThe only configuration file for _pydrink_ is in your home and must be located in\none of `$XDG_CONFIG_HOME/drinkrc`, `$HOME/.config/drinkrc` or `$HOME/.drinkrc`.\n\nExample drinkrc with the minimal settings:\n\n    TARGET=somestring\n    DRINKDIR=\"some/path/to/gitdir\"\n\nValues can be put in double quotes. Do not put spaces around the '=' if you\nwant to use the _drink zsh completion file.\n\nFor TARGET you should chose a value that is unique to the environment in which\nyou want to use a certain set of _pydrink_ objects. That could be your hostname\nor workplace name. _Pydrink_ will only link objects that are either in your\nconfigured target or in the special 'global' target.\n\nDRINKDIR must be a path to the directory where your _pydrink_ object repository\nis located. This contains all your files and it will be the place where\nsymlinked objects point to. If it is a relative path, $HOME will be prepended\nto it implicitly.\n\nDRINKBASEURL should contain the URL for your base repository. This should have\nread and write permissions for your user. It's beyond this document to describe\nall possible ways to create and reference another git repository, so here is\njust one simple example you could use:\n\n    ssh myserver\n    cd git\n    mkdir dotfiles\n    cd dotfiles\n    git init --bare\n\nAnd then use `ssh://myserver/~/git/dotfiles` as DRINKBASEURL.\n\nWith the `-u` switch, you can dump the current configuration file.\n\nWith no argument, the full config file will be printed, with values as set in\nthe configuration file. Variables which are not set in the configuration file\nwill be printed with their default values.\n\nWith argument, the value of only this variable will be printed. The value will\nbe expanded as it is used internally in drink. E. g. DRINKDIR will have $HOME\nprepended. Example usage:\n\n    hash -d drink=$(drink -u DRINKDIR)\n\nWith the above line in your `~/.zshrc` you can change to your drink\nrepository using the command `cd ~drink`.\n\n\nShell Integration\n-----------------\n\nWhen importing objects, shell completion is extremely helpful when using drink.\nFor zsh (https://zsh.org), a completion file is provided in **extras/_drink**.\nJust drop that somewhere in your fpath and enjoy. Of course import it into your\ndrink repository.\n\nFor adding drink information to your prompt you can use the $drink_prompt_info\nvariable. This is made available by putting **extras/drinkrefresh** in your\nfpath and add it as a precmd hook:\n\n    add-zsh-hook precmd drinkrefresh\n\n$drink_prompt_info will be usually empty. If there are change drink objects, it\nwill show the number. If your session is not in sync with the repository it will\nshow a \"!\". In that case you can run\n\n     drinkrefresh -r\n\nto re-exec zsh.\n\nUse a custom **starship** (https://starship.rs) variable to integrate the\nprompt into your starship configuration:\n\n    format = \"\"\"... $env_var ...\"\"\"\n    [env_var.drink_prompt_info]\n    format = '[$env_value]($style)'\n    default = ''\n    style = \"green\"\n\n\nHistory\n-------\n\nThis is yet another dotfile management system. I wrote this originally in zsh\n(first commit Mar 14 2008) and use it daily since then.\n\nThe zsh version was never published because it is too much entangeled with my\nactual shell environment. This rewrite in Python aims to fix that.\n\nConfiguration keywords (e. g. \"TARGET\") are still in upper case to be\ncompatible with the old shell version of drink. This might change in the future\nfor a more modern look, but has low priority.\n\n\nAuthor\n------\n\nSebastian Stark\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsstark%2Fpydrink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsstark%2Fpydrink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsstark%2Fpydrink/lists"}