Skip to main content

Dotpyle is a Python implementation of a dotfile system manager, allowing users to keep a secure copy of all program configurations remotely, create different profiles, etc.

Project description

logo

dotPyle

CI Status Coverage Status Code style: black License: MIT

Manage all your configuration files with different profiles remotely.
Made with ❤️ by Jorge Bodega and Perseo Gutierrez


dotPyle is a Python implementation of a dotfile system manager, allowing users to keep a secure copy of all program configurations remotely, create different profiles, etc.

Commands

Init

This will request a git url and a git token If it is the first time you use Dotpyle, you will need to create an empty repo on GitHub, GitLab, etc.

If you want to manage an existing repo you just need to input url and token

dotpyle init [--url <git url>]  [--protocol (git/https)] [--token (if repo is private)]

Add

  1. Copy file to repo location
  2. Delete file of path
  3. Generate symbolic link to path

Examples:

  1. Create program_name key
  2. Create profile (default by default)
  3. Set root and paths (optionally pre and post hooks)
    dotpyle add dotfile <program_name> [--profile <profile_name>] [--root
    <root_path>] [--path <dotfile_path1> [--path dotfile_path2>] ...] [--pre
    <pre_config_install_command> [--pre <...>]] [--post
    <post_config_install_command> [--post <...>]]

List

dotpyle list [--name <program_name>] [--profile <profile_name>]

Link

dotpyle install <program_name> [--profile <profile_name>]

Interacting with Git repository

User may avoid interacting directly with Dotpyle git repository

TODO: Considering only one dotpyle sync command for pulling && pussing

Pulling changes

This command will fetch new changes from the remote repository and check nothing will break

TODO

dotpyle pull

Pushing changes (TODO)

dotpyle push

Commiting changes

Commiting should be as granular and personal as possible so Dotpyle offers the granularity you may need.

dotpyle commit [-n <program_name> [--path=<path1> --path=<path2> ...]] [-p <profile_name>] -m <commit_message>

Examples:

  • General commit for all changes on all programs and profiles installed and managed by Dotpyle:

    dotpyle commit -m 'fix typo on vimrc'

  • Commit for all dotfiles of specific program (e.g. nvim):

    dotpyle commit -n nvim -m 'commit message'

  • Commit for all programs (and all configuration files) of a concrete profile (e.g. work):

    dotpyle commit -p work -m 'commit message'

  • Commit for specific program and specific dotfiles of that program for all profiles: (e.g. alacritty base configuration for all profiles which have alacritty)

    dotpyle commit -n alacritty --path=alacritty.yml -m 'commit message'

  • Commit for specific program and specific dotfiles of that program on specific profile: (e.g. i3 configuration for i3-resurrect and status bar on home profile)

    dotpyle commit -n i3 --path=i3-resurrect/config.json --path=i3status.conf -p home -m 'commit message'

Profiles

profile create

dotpyle profile create <profile_name>

Creates a new profile named <profile_name>, if it does not exist.

profile list

dotpyle profile list [<profile_name>]

profile change

dotpyle profile change <profile_name> [<program_name> ...]

This option will change the configuration file to the <profile_name> passed for:

  • all dotfiles if no <program_name> is passed
  • all <program_name>'s passed

Example:

dotpyle profile change work nvim git

Neovim work profile and Git work profile will be symlinked to its corresponding path.

dotpyle profile change home

All dotfiles which have a 'home' profile will be symlinked to its corresponding paths. Dotfiles which does not have a configuration for given profile will not be altered.

TBD

Configuration

check

dotpyle config check [<dotpyle_config_path>]

This command will analize Dotpyle configuration file, by default (XDG_CONFIG_HOME}/dotpyle/dotpyle.yml) (or <dotpyle_config_path>), returning descriptive errors.

Info: any other command will anayle the configuration file before executing. This command is useful and recomended whenever any manual change is made on dotpyle.yml.

dotpyle.yml example

Structure of yml (every thing inside [] are examples)

# General settings for dotpyle
settings:

    # Defined profiles
    profiles:
        - default
        - [home]
        - [work]

    # TODO
    TBD

dotfiles:

    # Top level key, the name of the program for which store config files
    [program_name]:

        # Name of the profile (default profile: default)
        [profile_name]:

            # Bash commands to be executed before configuring 'profile_name'
            before:
                - [bash script 1]
                - [bash script 2]

            # Bash commands to be executed after configuring 'profile_name'
            after:
                - [bash script 1]
                - [bash script 2]

            # Base path for start storing 'paths' for 'program_name' (default $HOME)
            root: ~

            # Configuration files for 'program_name'. Subroutes will be created if they dont exist
            paths:
                - [.configuration]                # will symlink dotfiles/program_name/profile_name/.configuration => $HOME/.configuration
                - [subroute/.filerc]              # will symlink dotfiles/program_name/profile_name/subroute/.filerc => $HOME/subroute/.filerc
                - [subroute0/subroute1/filerc]    # will symlink dotfiles/program_name/profile_name/subroute0/subroute1/filerc => $HOME/subroute0/subroute1/filerc

Example of dotpyle.yml config file:

settings:
    profiles:
        - default
        - windows

dotfiles:
    git:
        default:
            before:
                - sudo pacman -S git
            paths:
                - .gitconfig

        windows:
            before:
                - choco install git.install
            root: C:\Users\usr
            paths:
                - .gitconfig

    nvim:
        default:
            before:
                - sudo pacman -S neovim node
            root: ~/.config/nvim
            paths:
                - init.vim
                - after/ftplugin/ada.vim

        windows:
            before:
                - choco install neovim --pre
            root: C:\AppData\Local\nvim
            paths:
                - init.vim
                - after/ftplugin/ada.vim

This will be the generated file structure on the repository:

dotfiles
|
|-> git
|   |-> default
|   |   |-> .gitconfig
|   |-> windows
|       |-> .gitconfig
|
|-> nvim
    |-> default
    |   |-> init.vim
    |   |-> after
    |       |-> ftplugin
    |           |-> ada.vim
    |
    |-> windows
        |-> init.vim
        |-> after
            |-> ftplugin
                |-> ada.vim

dotpyle.local.yml structure

Dotpyle needs to create a local configuration file in order to keep track of your configuration on the current machine.

This file will not be tracked by git so non conflicts will be derived when using Dotpyle on multiple computers.

Also, this file will be generated automatically by Dotpyle on 'init' command or whenever Dotpyle can't find it.

Structure of yml (every thing inside [] are examples)

installed:
    [program_name]:
        profile: [profile_name]
       # modified: [True|False]
        TBD
TBD

TODO

  • Decorator / global variable to instance parser and handlers
  • Print centralized service with colorful error / warning / correct output
  • Change uninstall name for on more intuitive
  • Run command to execute alone hooks
  • Create commit on uninstall dotfile
  • Force option on link command

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotpyle-0.1.4.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotpyle-0.1.4-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file dotpyle-0.1.4.tar.gz.

File metadata

  • Download URL: dotpyle-0.1.4.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.2.0

File hashes

Hashes for dotpyle-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8e8cbe1a8344d846982b3d8421f53dfb6781861c399f27b07f8a92aee093960c
MD5 735509824fd1139e2502eab6a16272b3
BLAKE2b-256 21c7ddb10e497f3fea12d3ba07cbcd488f1c333549dfc5035d8fcab51caccd71

See more details on using hashes here.

File details

Details for the file dotpyle-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: dotpyle-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 43.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.2.0

File hashes

Hashes for dotpyle-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4cbd02c2c6357e6d032915e61a48dd9341846ab2280e5ea9a6d44131e5fd671f
MD5 49e6b1dda0d9ea29db573ff6f9f74a37
BLAKE2b-256 4b170e8287a86a8c25d5117a9f4413310ca78714af565f97e57352ee7381d4ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page