filetailor
Update: Below are two similar programs to filetailor that are much more mature. I recommend using one of them instead. Although personally, I am still using filetailor to manage my files.
- Chezmoi: Supports sync without symbolic links but requires templates.
- Yolk: Supports sync without templates but requires symbolic links.
filetailor is a peer-based configuration management utility for plain-text files (and directories) such as dotfiles without using symbolic links or templates. Files are backed up to a specified directory using filetailor, copied to another device using tools such as Nextcloud, Syncthing, or Git, and then copied to other devices using filetailor again.
During the backup and restore process, filetailor can modify the file contents and path for the specific device according to variables and line-specific controls defined in YAML without the use of templates. See list of features.
Table of Contents generated with DocToc
Example Usage
Here's how to sync a file to use dev1home on "device1" and dev2home on "device2" for the alias MYHOME.
.bashrc on "device1":
alias MYHOME='/home/dev1home/' #{filetailor device1}
# alias MYHOME='/home/dev2home/' #{filetailor device2}
[user@device1 ~]$ filetailor add .bashrc
[user@device1 ~]$ filetailor backup
During backup from "device1" to the sync directory, the first line gets commented out because the tag matches the device name. Sync the sync directory with the backed-up version of the file using your preferred method of choice to "device2" then restore with filetailor. During restore on "device2", the second line gets uncommented (again, because the tag matches the device name).
[user@device2 ~]$ filetailor restore
.bashrc on "device2":
# alias MYHOME='/home/dev1home/' #{filetailor device1}
alias MYHOME='/home/dev2home/' #{filetailor device2}
Getting Started
Installation
filetailor requires Python 3.6+ and pip. Install by running the following commands:
$ pip install filetailor
$ filetailor init
# Update the newly created "filetailor.ini" with your desired locations for synced files and configuration YAML
$ filetailor init
# Accept confirmations to create directories
To sync filetailor between devices, sync the sync_dir and yaml_dir directories created in the above steps using Git, Syncthing, etc.
See Alternative Installs for other installation methods.
Configuration
filetailor.yaml ("the YAML") controls which files sync to which devices.
You can add/remove files to and from the YAML by running filetailor add PATHS and filetailor remove PATHS (local paths are okay). Alternatively, you can update the YAML manually by following the comments within.
The YAML also defines variables, which are strings to replace when restoring to a specific device, such as a path to a file that differs between devices. See the FAQ in the wiki for examples.
Usage
To backup all files defined in the YAML from the local device to the sync directory, run filetailor backup. Lines/blocks matching the device name will be commented out as they are copied to the sync directory.
To restore all files defined in the YAML from the sync directory to the local device, run filetailor restore. Lines/blocks matching the device name will be uncommented as they are copied to the local device.
To list all available commands, run filetailor --help. For command details, run filetailor COMMAND --help.
Line-Specific Control
You can control the contents of individual files by device with line-specific controls such as the Example Usage above. There are two types of line-specific controls: single-line and multi-line.
To use a single-line control, append a tag to the line you want to be commented out on other devices. During backup, any lines tagged for the current device will be commented out. During restore, lines tagged for the current device will be uncommented. Single-line control tag format:
(Code being controlled) COMMENT_SYM{filetailor DEVICES...}
COMMENT_SYM is any symbol(s) used for comments and must be preceded by at least one space.
To control a block of lines, see Multi-line Controls.
Example: single-line control
How the code should be written on "desktop":
export $device_type="desktop" #{filetailor desktop}
# export $device_type="laptop" #{filetailor laptop1 laptop2}
After backing up the file through filetailor and then restoring to "laptop1" or "laptop2", the code would appear like this:
# export $device_type="desktop" #{filetailor desktop}
export $device_type="laptop" #{filetailor laptop1 laptop2}
How the code would look on any other device and in the filetailor sync directory:
# export $device_type="desktop" #{filetailor desktop}
# export $device_type="laptop" #{filetailor laptop1 laptop2}
Diff Programs
Before backing up or restoring files, filetailor will show a diff of the changes. To set the diff programs for filetailor, add the following option to filetailor.ini.
[TOOLS]
diff_pager = YOUR_FAVORITE_DIFF_PROGRAM # for viewing diff in terminal
difftool = YOUR_FAVORITE_DIFFTOOL # for making edits during diff in external tool
If diff_pager is not set, filetailor will use core.pager (from Git config, git-config docs) if defined, otherwise uses diff.
If difftool is not set, filetailor will use diff.tool (from Git config, git-difftool docs) if defined, otherwise uses diff.
One popular supported diff pager is Delta. To install, follow the installation instructions in the link.
Run the following command to set Delta as your default pager for Git (and thus filetailor):
$ git config --global core.pager delta
More Help
See FAQ in the wiki for more help and examples.
Links:
Contributing
Feedback is welcome! Ways to contribute include:
- Report a bug
- Recommendations on new features
- Suggestions to improve documentation and print statement readability
Pull requests are welcome as well, but please open an issue first describing the change. When submitting PRs, please try to conform to the following style guides:
- Python code style: PEP8
- Man page formatting: man-pages(7)
- Commit message formatting: How to Write a Git Commit Message
- Packaging: Python Packaging User Guide
- Release versioning: Semantic Versioning
Metadata
Release files for filetailor 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| filetailor-0.3.0.tar.gz | 346.5 kB | Without provenance | Details for filetailor-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| filetailor-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for filetailor-0.3.0-py3-none-any.whl |
Total release size: 376.5 kB
Release files / filetailor-0.3.0.tar.gz
| Download URL | filetailor-0.3.0.tar.gz |
|---|---|
| Size | 346.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b05cab247780b83677ce80acbfe2847034b8c53f7e3dd33e2a9c03a47ca7bde
|
|
BLAKE2b-256 checksum How to use checksums |
8acff6a33482b481a946dcd788ff8fad8e27a232d33ba3cd8025fa989c2fe2f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / filetailor-0.3.0-py3-none-any.whl
| Download URL | filetailor-0.3.0-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05a778d258fc53133bb8718c47fa4a9957b7ddd072f55a4ce25a9d1ec8d0c025
|
|
BLAKE2b-256 checksum How to use checksums |
58e7c0b4bcf4d69979c79e810ddced6cc8247695c3b470d561867c975dc782fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for filetailor 0.3.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.