Metadata-Version: 2.4
Name: sync_client
Version: 0.8.7
Summary: Sync Client
License: Closed
License-File: LICENSE
Author: Muhammad Ali
Author-email: ali.naeem@softwaredefinedautomation.io
Requires-Python: >=3.10,<3.15
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: boto3 (>=1.42.0,<2.0.0)
Requires-Dist: cryptography (>=50.0.0,<51.0.0)
Requires-Dist: pycognito (>=2024.5.1,<2025.0.0)
Requires-Dist: pynacl (>=1.6.2,<2.0.0)
Requires-Dist: pyside6-essentials (>=6.10.2,<7.0.0)
Requires-Dist: pywin32 (>=311,<312) ; sys_platform == "win32"
Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
Requires-Dist: requests (>=2.32.5,<3.0.0)
Requires-Dist: smbprotocol (>=1.16.1,<2.0.0)
Requires-Dist: truststore (>=0.10.4,<0.11.0)
Requires-Dist: websocket-client (>=1.8.0,<2.0.0)
Description-Content-Type: text/markdown

# Sync Client

Desktop synchronization client with a PySide6 UI, background sync service, and CLI. The project is managed with Poetry and can be run either as installed OS packages or directly from a local Poetry environment.

## What Runs

The application is split into three main entry points:

-   `sync-client`: Qt desktop UI
-   `sync-client-service`: background sync service
-   `sync-client-cli`: command-line client for status, configuration, and manual sync triggers

The UI and CLI talk to the service through the shared local service data directory. During development, use `SYNC_CLIENT_HOME` so all three processes read and write the same config, data, logs, and IPC token.

## Requirements

-   Python `>=3.10,<3.15`
-   Poetry

## Setup

From the project root:

```bash
poetry env use python3
poetry install
```

If your machine needs a specific Python binary:

```bash
poetry env use /usr/bin/python3.12
```

## Encrypted Logging Key

Encrypted logging is enabled by default. The service and UI will not start unless
the logging public key exists in the shared application data directory.

The repository contains the public key used by development and packaging:

```text
support_only/generated/log_public_key.b64
```

Copy this committed public key into the application data directory using the
runtime filename `logging_public_key.b64`.

For Linux or macOS development:

```bash
export SYNC_CLIENT_HOME="$PWD/.local-sync-client"
mkdir -p "$SYNC_CLIENT_HOME/data"
cp support_only/generated/log_public_key.b64 \
  "$SYNC_CLIENT_HOME/data/logging_public_key.b64"
```

For Windows PowerShell development:

```powershell
$env:SYNC_CLIENT_HOME = Join-Path $PWD ".local-sync-client"
$dataDir = Join-Path $env:SYNC_CLIENT_HOME "data"
New-Item -ItemType Directory -Force $dataDir | Out-Null
Copy-Item `
  "support_only\generated\log_public_key.b64" `
  (Join-Path $dataDir "logging_public_key.b64")
```

Use the same `SYNC_CLIENT_HOME` value whenever starting the service, UI, or CLI.
The standard `HOME` variable does not override Sync Client paths. Without
`SYNC_CLIENT_HOME`, installed paths are:

```text
Windows: %ProgramData%\Sync Client\data\logging_public_key.b64
Linux:   /var/lib/sync-client/logging_public_key.b64
```

The Windows and Linux installers copy the public key into these installed paths.
The manual copy above is for running directly from Poetry.

## Run Locally With Poetry

Start the service first:

```bash
export SYNC_CLIENT_HOME="$PWD/.local-sync-client"
poetry run sync-client-service
```

In a second terminal, start the UI with the same `SYNC_CLIENT_HOME`:

```bash
export SYNC_CLIENT_HOME="$PWD/.local-sync-client"
poetry run sync-client
```

Use the CLI from another terminal with the same environment:

```bash
export SYNC_CLIENT_HOME="$PWD/.local-sync-client"
poetry run sync-client-cli --status
poetry run sync-client-cli --show-settings
```

## First-Time Configuration

Configure API URL, username, password, local sync path, and sync frequency from the Settings window or with the CLI:

```bash
poetry run sync-client-cli --username alice --password secret --url https://api.example --local-path /path/to/sync --sync-frequency 30
```

Trigger a sync manually:

```bash
poetry run sync-client-cli --sync-now
```

`--sync-now` starts the sync request and returns quickly. Use `--status`, `--show-settings`, or the History window to inspect the result.

Installed Linux and Windows packages expose the CLI globally as:

```bash
sync-cli --status
sync-cli --show-settings
sync-cli --sync-now
```

## Environment Variables

`SYNC_CLIENT_HOME` is the main development variable. It points service, UI, and CLI at one shared local app directory. Its logging key is read from `SYNC_CLIENT_HOME/data/logging_public_key.b64`. Without it, Linux uses service-style paths under `/etc/sync-client`, `/var/lib/sync-client`, and `/var/log/sync-client`.

`SYNC_CLIENT_BRAND` is optional and is only needed when testing a branded UI:

```bash
export SYNC_CLIENT_BRAND=sew
```

## Verify PySide6

```bash
poetry run python -c "import PySide6; print(PySide6.__version__)"
```

If `python` is unavailable in your Poetry environment:

```bash
poetry run python3 -c "import PySide6; print(PySide6.__version__)"
```

## Tests

```bash
poetry run pytest
```

## Documentation

-   Run guide: `docs/run-project.md`
-   Windows user guide: `docs/windows-user-guide.md`
-   Linux user guide: `docs/linux-user-guide.md`
-   Service ownership: `docs/service-api.md`
-   OS services: `docs/os-services.md`
-   Design decisions: `docs/design-decisions.md`

Build the docs locally:

```bash
poetry run mkdocs build --strict
```

## License

Closed source (see project metadata).

