forgejo-sync-manager-core
Universal core library for Forgejo repository synchronization.
Universal core library for Forgejo repository synchronization.
pip install forgejo-sync-manager-core
Universal core library for Forgejo repository synchronization.
By using this software, you agree to the full disclaimer terms.
Summary: Software provided "AS IS" without warranty. You assume all risks.
Full legal disclaimer: See DISCLAIMER.md
forgejo-sync-manager-core is a reusable Python library that provides the core functionality for synchronizing Forgejo repositories. It is designed to be used by both CLI and GUI applications, ensuring code reuse and consistency across different interfaces.
This core library is used in the following projects:
| Project | Description | Repository |
|---|---|---|
| forgejo-sync-manager-cli | CLI tool for batch synchronization | GitHub |
| forgejo-sync-manager-gui | Desktop GUI tool for batch synchronization | GitHub |
| Class | Description |
|---|---|
ForgejoAuth |
Authentication container for server URL and token |
ForgejoAPIClient |
API client for Forgejo REST API |
ConfigManager |
Configuration file management (JSON) |
BaseSyncManager |
Abstract base class for sync operations |
| Class | Purpose |
|---|---|
GUISyncManager |
Lightweight manager for GUI applications (no console output) |
CLISyncManager |
Full-featured manager with console progress output |
git clone https://github.com/smartlegionlab/forgejo-sync-manager-core.git
cd forgejo-sync-manager-core
python -m venv venv
pip install -r requirements.txt
from forgejo_sync_manager_core.core.auth import ForgejoAuth
auth = ForgejoAuth(
token="your_token",
server_url="http://localhost:3000",
username="your_username"
)
from forgejo_sync_manager_core.core.api_client import ForgejoAPIClient
client = ForgejoAPIClient(auth)
user_info = client.get_user_info()
repositories = client.get_user_repos()
from forgejo_sync_manager_core.core.sync_manager_gui import GUISyncManager
sync_manager = GUISyncManager(auth)
sync_manager.ensure_directories()
for repo in repositories:
status = sync_manager.sync_repository(repo)
# status: "CLONED", "UPDATED", "FAILED"
from forgejo_sync_manager_core.core.sync_manager_cli import CLISyncManager
sync_manager = CLISyncManager(auth)
results = sync_manager.sync_all_repositories(repositories)
# results: {"cloned": 0, "updated": 0, "failed": 0}
from forgejo_sync_manager_core.core.sync_manager_cli import CLISyncManager
sync_manager = CLISyncManager(auth)
needs_update = sync_manager.check_updates(repositories)
print(f"Repositories needing update: {len(needs_update)}")
# Check if repository exists locally
exists = sync_manager.repo_exists_locally("repo-name")
# Get path to local repository
repo_path = sync_manager.get_repo_path("repo-name")
Configuration is stored in ~/forgejo-sync-manager/config.json:
{
"token": "your_access_token",
"server_url": "http://localhost:3000",
"username": "your_username"
}
| Status | Description |
|---|---|
CLONED |
Repository was successfully cloned |
UPDATED |
Existing repository was successfully updated |
RECLONED |
Repository was deleted and re-cloned |
FAILED |
Operation failed |
git fetch and compares HEAD with FETCH_HEAD~/forgejo-sync-manager/{username}/repositories/Copyright (©) 2026, Alexander Suvorov
All rights reserved.