Skip to main content

DocSync

doc is a Python CLI that syncs one Google Doc's tabs to local Markdown files and back using incremental Google Docs API patches.

Current feature scope

  • doc pull: materialize tabs as Markdown files and store sync metadata in .docsync_state.json.
  • doc push: strict mode, aborts if remote revision changed since last pull.
  • doc push -f: best-effort mode with a safe rebase policy; aborts on unsafe overlap.
  • doc push -f --dry-run: preview operations and conflicts without writing.

Safety model

  • Strict mode never writes when revision drift is detected.
  • Force mode only applies minimal incremental edits (no full-document replacement).
  • Force mode aborts with conflict reports for overlapping/unsafe edits.

Assumptions for v1

  • Tabs are textual and representable by the implemented Markdown subset.
  • Simultaneous edits are uncommon; strict mode is default.
  • Authentication uses Application Default Credentials (ADC).

Google authentication

The CLI uses the standard Google ADC flow from google-auth.

You have two common options:

  1. User OAuth (great for local development):

    Important for now: to request Docs/Drive scopes, you need your own OAuth client ID file. The default gcloud auth application-default login client can be blocked for non-Cloud scopes. See Google's ADC troubleshooting guidance: https://docs.cloud.google.com/docs/authentication/troubleshoot-adc#access_blocked_when_using_scopes

    Steps:

    • Create an OAuth client in Google Cloud Console (Desktop app client is fine for local dev).

    • Download the client JSON file.

    • Run:

      gcloud auth application-default login \
        --client-id-file=/absolute/path/to/client_secret.json \
        --scopes="https://www.googleapis.com/auth/documents,https://www.googleapis.com/auth/drive.readonly,openid,https://www.googleapis.com/auth/userinfo.email"
      

    This is a temporary setup requirement until the project is reviewed/published and can use a simpler default flow.

  2. Service account key (great for automation/CI):

    • Create a service account and JSON key in Google Cloud.
    • Share the target Google Doc with that service account email.
    • Point ADC to the key file via GOOGLE_APPLICATION_CREDENTIALS.

You can export that variable in your shell:

export GOOGLE_APPLICATION_CREDENTIALS="/absolute/path/to/service-account.json"

Or use a local .env file (loaded automatically by the CLI):

GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/service-account.json

Required scope used by this tool: https://www.googleapis.com/auth/documents.

Quickstart

  1. Install:

    poetry install
    
  2. Authenticate with Google APIs (Application Default Credentials).

  3. Pull:

    poetry run doc pull <DOC_ID> --workspace .
    
  4. Edit generated .md files.

  5. Push:

    poetry run doc push <DOC_ID> --workspace .
    

Force mode:

poetry run doc push <DOC_ID> --workspace . -f

PyPI and pipx

After publishing to PyPI, users can install globally with:

pipx install docsync

For maintainers, build and verify locally before upload:

poetry check
poetry build
poetry run python -m twine check dist/*

Publishing auth options:

  • Preferred: PyPI Trusted Publishing (OIDC in CI; no local token needed).

  • Alternative: PyPI API token (pypi-...) configured for Poetry:

    poetry config pypi-token.pypi <YOUR_PYPI_TOKEN>
    poetry publish
    

Do not upload credential files (.env, OAuth client secrets, service account keys).

Metadata

Release files for docsync 0.1.282050

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docsync 0.1.282050
File Size Uploaded
docsync-0.1.282050.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docsync 0.1.282050
File Interpreter ABI Platform
docsync-0.1.282050-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / docsync-0.1.282050.tar.gz

Download URL docsync-0.1.282050.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
86b4474f8fe2984b0e14fa0a80f8256e294920e76c10cecf15a063ca02356920
BLAKE2b-256 checksum
How to use checksums
a5bdf786d146deee8b270394bb5552968089632b7d513f21ddc3db94fdfad817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 28, 2026.

Transparency log

Release files / docsync-0.1.282050-py3-none-any.whl

Download URL docsync-0.1.282050-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38d2131e610b7fd9e6a6ffb68f053eb49164707433d8d77de10fdfe25e757c89
BLAKE2b-256 checksum
How to use checksums
0cf5395f12389444bdf210d7148594e9504522911e76c5b27a584a68b10c413d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.1.282050 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page