Skip to main content

dbkp - dotfiles backup

dbkp simply backups and restores dotfiles using rsync -La. You can use it with any version control or backup strategy you want.

Instalation

Install with pip:

pip3 install dbkp

Usage

Put the file dbkp.json on a folder and configure it as you want. Then either run dbkp backup from the folder or pass the path to the configuration file as dbkp backup /path/to/dbkp.json. A folder named dotfiles in the same folder as the configuration file will be created and all dotfiles will be synced inside it. Use dbkp restore in the same way to rsync the files from the dotfiles folder into their places.

Configuration example

The configuration is a list of files to backup, or objects that adds some features to the specific dotfile.

A string will backup the folder/file. This will backup the file ~/.vimrc:

["~/.vimrc"]

It is the same as

[
  {
    "path": "~/.vimrc",
    "alias": "vimrc"
  }
]

alias is the name the file/folder will have inside the dotfiles folder. By default it is the name of the file/folder without a leading dot.

It is also possible to exclude subfiles/subfolders from a folder. The complete folder will be synced and then the files/folders will be deleted. You can specify both only and exclude, but exclude will be ignored in this case. only will remove all files but the ones listed and exclude will only exclude the ones listed.

[
  {
    "path": "~/.config/fish",
    "only": ["functions"],
    "exclude": ["completions"]
  }
]

The links options allows to create symlinks after restoring. It is a list of either strings or lists of 2 string elements. If the element is a string, then a symlink will be created pointing to path. If it a list of 2 strings, the second is the symlink and will point to path/first element. In the example, ~/.vimrc will point to ~/.config/nvim/init.nvim and ~/neovim will point to ~/.config/nvim.

[
  {
    "path": "~/.config/nvim",
    "links": ["~/neovim", ["init.vim", "~/.vimrc"]]
  }
]

It is also possible to run commands to do the backup/restore.

[
  {
    "backup": "brew leaves",
    "restore": "xargs brew install",
    "alias": "brew.leaves"
  }
]

This is the same as backing up with

brew leaves > brew.leaves

and then restoring with

cat brew.leaves | xargs brew install

The current working directory is changed to the folder containing the configuration file before executing anything, so if you want to specify files in the command line, remember that: you need to quote file paths if they contain spaces and your alias file is in dotfiles/:alias".

LICENSE

The MIT License (MIT)

Copyright (c) 2021 Álan Crístoffer e Sousa

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for dbkp 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbkp 1.0.5
File Size Uploaded Provenance
dbkp-1.0.5.tar.gz 5.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dbkp 1.0.5
File Interpreter ABI Platform
dbkp-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / dbkp-1.0.5.tar.gz

Download URL dbkp-1.0.5.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8a026e2323f4feaecb24339e9fd924145d80eb884bad0656ed7217a6553d0470
BLAKE2b-256 checksum
How to use checksums
98a599f4970ac56ef5573c4ac50401cecd3347425a84c682bf7ea33312666ea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.7 Linux/6.1.52-valve10

Release files / dbkp-1.0.5-py3-none-any.whl

Download URL dbkp-1.0.5-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
918d50b5942ec9a6ada962634e990d8d48df1cea408ed58e5e7b8fd804e50668
BLAKE2b-256 checksum
How to use checksums
769ce6386bdabce5674f87a6912a67480e5cbc5d020f7dccac55ed8902adf699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.7 Linux/6.1.52-valve10

Security for dbkp 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page