Skip to main content

orite - an opinionated Python rsync wrapper

Project description

orite

An opinionated rsync wrapper written in Python

The purpose of orite is to synchronise folders and files between a remote and local server.

FTP apps like Transmit and Cyberduck 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 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 project is an effort to centralise a sync approach, add options, future functionality, and do it using Python.

ōrite is a Māori word for ʻthe same’

It's pronounced like this rather than ‘oh-right’.


Installation

I'm working on

pip install orite

In the meantime download the orite.py file and add an alias to your bash profile.

alias orite='python3 path-to-orite-folder/orite.py'

You will also need to download the _orite_exclude.txt and put it in the same location as orite.py.

How to run?

Run the following command preferably above the folder you are looking to copy.

orite -i

Will initialise two configuration files

orite -^ 

Will upload

orite -v

Will download. By default, orite will run in dry-run mode. Use the -r flag to override this.


Improvements

  • Change the settings.py file into a _orite_config.ini file. This will facilitate writing to config whilst running the app.

  • How does this directory differ from the remote one? Whilst we can run rsync with the dry run flag the feedback you get is unsatisfactory. rsync will tell you that files differ, but if you want to know exactly what the difference is, which lines, for example, you are out of luck.

    diff is great with this kind of thing, but getting diff to run over a network is slow.

    1. So the suggested solution is to make an invisible copy of the local folder to _orite_copy__<folder_name>
    2. Sync from the remote folder to the copy
    3. run diff -r -N <folder_name> _orite_copy__<folder_name>/ --exclude-from <path-to>/_orite_exclude.txt

    Potentially format the output so that it has a better hierarchy and is clearer. From here one could manually copy across the bits they want or possibly do it programmatically. Like:

    $ These are the file/folder/s that differ \1. filename \2. filename \3. whole_folder_name \4. all Which remote file/folder/s would you like to copy to your local folder? i.e 1 or [2, 3]

  • Enable the config file to have multiple servers. For example, I use one server to run Django and a different one for Nginx. I don't want two sets of config and exclude files. I won't be able to do: orite -^ which will upload to the default server and orite -^ css to the CSS one.

  • Investigate a safe mode? --backup flag and the scary delete after flag.

  • The --info=flist flag only works in rysnc that is >= 3.1 Think about how to implement it so that older versions work too.

  • Maybe there should be a rsync command flags option in the default config file. If it exists then the default command is overwritten.

  • If it there is trouble connecting orite could look for an RSA key. If it exists then copy it to the server. If it doesn't then make one and copy it to the server.

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

orite-0.0.8.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

orite-0.0.8-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file orite-0.0.8.tar.gz.

File metadata

  • Download URL: orite-0.0.8.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for orite-0.0.8.tar.gz
Algorithm Hash digest
SHA256 36fedb354f2a23000ecef6a56be8b69a79a4ce017396a8aafd1b839fb1eaf808
MD5 07ff5c3da90183ffb545fe97252ace48
BLAKE2b-256 cf9092c9161277ec23a1fa19db5e503e3ec9062082d003b527c2679f56c3ea90

See more details on using hashes here.

File details

Details for the file orite-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for orite-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9616fa6f5e678aaf453797b78eb4e534fc7e8d6e501bf5092a20c367325b43e3
MD5 adc48d0690d32434df4674b84f544df0
BLAKE2b-256 7ccb435deff0c0adc237c8fd7134d71f2c0afba612c5b3e55c3b5a07418318e7

See more details on using hashes here.

Supported by

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