dotpy is a minimalist python script for managing dotfiles via symbolic links.
Project description
dotpy
dotpy is a minimalist python script for managing dotfiles via symbolic links. Inspired by bashdot, it supports multiple profiles and customizable file templates with variables. No external dependencies, just python 3.6+.
Install and Help
You can simply run directly from the repository:
git clone https://github.com/vincentqb/dotpy ~/dotpy
~/dotpy/dotpy --help
or run as module from the repository:
git clone https://github.com/vincentqb/dotpy ~/dotpy
PYTHONPATH=~/dotpy/ python -m dot --help
or build and install from source:
pip install git+https://github.com/vincentqb/dotpy
dotpy --help
or install with pip from pypi:
pip install dot.py
dotpy --help
and just make sure to use the corresponding command below.
Quick Start
-
Create your initial profile. For example, we create a directory called
default
.mkdir default
-
Add any files you would like linked into your home when this profile is linked.
echo 'set -o vi' > default/env
-
Link the profile. When you link, dotpy prepends a dot, in front of the original file name, to the linked file. Below,
default/env
will be linked to~/.env
.~/dotpy/dotpy link default
-
Continue adding your dotfiles to the default profile.
mv ~/.bashrc default/bashrc
-
You can safely re-run the link command to link newly added files. Store this profile in a cloud drive or source control. Repeat for additional profiles.
Templates
Values which need to be set in a file when dotpy is run can be placed in a template.
-
Append
.template
to any files which should be rendered. For example, assume you have a filedefault/env.template
containing:export SECRET_KEY=$ENV_SECRET_KEY
-
The rendered files will be created in the same directory, and have
.template
replaced with.rendered
. In the example, you can run the following to set the valueENV_SECRET_KEY
when linking the default profile:env ENV_SECRET_KEY=test1234 ~/dotpy/dotpy link default
-
The rendered file will be linked into the home with the
.rendered
suffix removed and a dot prepended. In the example, this will result in the rendered filedefault/env.rendered
being created and linked to~/.env
with the below contents.export SECRET_KEY=test1234
-
Be sure to include
**/*.rendered
in.gitignore
if you put your dotfiles into a git repository.
Development
For linting, building and testing, see the workflow.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.