Sync python dicts, strings ad modules to git repository.
Project description
syncgit
Sync python dicts, strings and modules to files in git repository.
NOTE: syncgit calls git using subprocess, setup git so it does not ask for username or password, otherwise you will get a timeout exception.
Installation
python -m pip install syncgit
Documentation
https://syncgit.readthedocs.io/en/latest/
Example
from typing import List
import time
from syncgit import Repo, SyncConfig
# This callback is called when changes are pushed to the repo
def update_callback(repo: Repo, changes: List[SyncConfig]) -> None:
print(f"Updated to commit {repo.commit_hash}")
for change in changes:
print(f"Updated {change.name}")
# Create repo class and import files from repository
rp = Repo("example_repo", "git@github.com:RainingComputers/syncgit-test.git", "main")
rp.set_config([
SyncConfig("about_alice", "alice.json", "json"),
SyncConfig("about_bob", "bob.yml"),
SyncConfig("text", "text_file.txt", "text"),
SyncConfig("hello_module", "say_hello.py")
])
# Register call back
rp.set_update_callback(update_callback)
# Start sync
rp.start_sync()
# Imported files will be available as attributes on the repo class
# Changes are reflected immediately on these attributes real time
try:
while True:
time.sleep(1)
print(rp.about_alice)
print(rp.about_bob)
print(rp.text)
rp.hello_module.say_hello("Alice")
except KeyboardInterrupt:
print("Stopping sync")
rp.stop_sync()
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
syncgit-0.4.4.tar.gz
(6.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file syncgit-0.4.4.tar.gz.
File metadata
- Download URL: syncgit-0.4.4.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeb31beea731990eba0ea72039b0e62fa78c9bb362b9440a6bd50870011a660b
|
|
| MD5 |
dfee08a071b53c438d953461799914d9
|
|
| BLAKE2b-256 |
2660b1e9d7e1afb6eb6d8ebe40721e2583c6d47ca5978c54110b896e71134f89
|
File details
Details for the file syncgit-0.4.4-py3-none-any.whl.
File metadata
- Download URL: syncgit-0.4.4-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3673c2ff0aa3ec34865032feb9d5ecc7abeea25d0d272c5c2a85a98e04e0ece5
|
|
| MD5 |
3e3067b18680c9f1d1707da855fa39e9
|
|
| BLAKE2b-256 |
9f2f059ede835be78c414f1108a2f88797e4aca581e9e1b658f1f3828f7b85a0
|