orite - an opinionated Python rsync wrapper
Project description
orite
A persistant rsync wrapper written in Python
Save a config file and then synchronise your remote and local folders/files. This project is an effort to centralise a sync approach, configure once, add options, and make it simple.
To do this using orite run:
orite -^
To do this using rsync run:
rsync --human-readable --info=flist --stats --archive --verbose --partial -ic --progress --dry-run /Users/username/Documents/websites/site_name/stack/folder/ username@127.68.551.54:/home/stack/folder --exclude-from="exclude.txt"
ōrite is a Māori word for ʻthe same’
It's pronounced like this rather than ‘oh-right’.
The problem
FTP apps like Transmit and Cyberduck are good apps and can synchronise content, but they are slow.
The CLI tool rsync is brilliant for this purpose in that it is lightning quick. The problem is that there is a lot to type in. There are a lot of flags to remember, as well as the username, IP address, the remote path, and the exclude file path. I also find it hard to remember to include a slash on the local and exclude a slash on the remote path. Meaning one can copy the entire repo into the wrong folder or just loose amongst your other stuff.
I used to do this kind of thing using Git and a Python library called fabric. Running the fabfile would commit, push, login to the remote server and then pull and restart. Whilst it was accurate it was a little clunky and again not super fast. I moved on from that to running a straight shell script. I ended up with variations of this script in each folder I made.
This is where orite came in.
Installation
pip3 install orite
Or download the orite folder and alias orite.py in your bash profile.
alias orite='python3 path-to-orite-folder/orite.py'
If you don’t have pip.
sudo easy_install pip
You will also be required to have Python 3 installed.
Update
pip3 install orite --upgrade --no-cache-dir
How to run?
Run orite in the directory above the folder that you would like to sync.
If you haven't used orite in this directory you will be prompted to lay down a config file and a exclude file.
To upload
orite -^
To download
orite -v
By default, orite will run in dry-run mode. Use the -r
flag to override this and do a sync for real.
The help menu can be seen using
orite -h
This will output the following optional arguments:
-h, --help show this help message and exit
-s, --sections Print the section of the config file to the screen
-v, --remote_to_local
Download. Sync the remote folder to the local folder.
Think of -v as a down arrow.
-^, --local_to_remote
Upload. Sync the local folder to the remote folder.
Think of -^ as an up arrow.
-d, --dry_run Do a dry run. This is the default
-r, --for_real Not a dry run, do it for real
--ssh Login using SSH
--sftp Login using SFTP
-C, --initial_copy Copy the local folder for use in diff.
-R, --remote_to_remote_copy
Sync the remote folder to the local remote copy
-D, --diff Compare the local folder to the local remote copy
Multiple servers – one config file
You can enable the config file to have more than one server or folder location. For example, my DEFAULT folder is my Django install and in a very separate location is my CSS folder.
orite -^
will upload (in dry-run mode) to my DEFAULT setting, and
orite CSS -^
will upload to my CSS section settings.
Open the config file in your text editor. Add a section label at the bottom like so
[CSS]
Then add the path_to_local_folder = /path/
on the next line and path_to_remote_folder = /path/
to the line after. If your CSS settings are on the same server as your DEFAULT settings then you don't need to add those details again. Needless to say that if they are on a different server than add those settings to this section too.
Add as many sections as you like.
Run orite -s
to get a print out of all the sections in your config file.
Improvements/enhancements
Use orite with watch
and have it watch a local directory for changes.
watch -d 'ls path-to-dir/css/ | orite CSS -^'
If you are on a Mac and don't have watch in your CLI. Install it with Homebrew.
brew install watch
For a brief overview of watch use watch -h
and read something like this
For more issues and suggested enhancements check out the issues tab.
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.
Source Distribution
Built Distribution
File details
Details for the file orite-0.0.18.tar.gz
.
File metadata
- Download URL: orite-0.0.18.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 512b732c61a65c57c908a580111620d31081031d888bc2924f778962ff230d44 |
|
MD5 | ad91e5b10f8401c9a94a5e2a906a6d0a |
|
BLAKE2b-256 | 1a32a7d2dcb6c4b82262404b6af01a73e98555b26b7f0d8244c79097db54f35d |
File details
Details for the file orite-0.0.18-py3-none-any.whl
.
File metadata
- Download URL: orite-0.0.18-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4827c7293ba414393a072706226d0b9aaf063ac9f46dfa04fb27c9fc5d26e59 |
|
MD5 | d022ace2355dca36078f4f628e126e2c |
|
BLAKE2b-256 | 8c08fc80aafbc2ee85f58c3ded9d6b09889ee6c89fe30c39b99ced989c918152 |