Metadata-Version: 2.4
Name: cesiumcloud
Version: 0.1.9
Summary: CesiumCloud cloud storage Python SDK and command-line client
Author: CesiumCloud
Project-URL: Homepage, https://cloud.cesiummc.space/
Project-URL: Documentation, https://api.cesiummc.space/docs
Keywords: cesiumcloud,cloud,storage,backup
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Classifier: Topic :: Internet
Classifier: Topic :: System :: Archiving :: Backup
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# CesiumCloud for Python

CesiumCloud cloud storage client for Python 3.10+.

## Installation

Install the latest version from PyPI:

    python -m pip install cesiumcloud

Or install the official wheel directly:

    python3 -m pip install https://cloud.cesiummc.space/clients/cesiumcloud-0.1.5-py3-none-any.whl

## Command-line use

    python -m cesiumcloud authenticate
    python -m cesiumcloud upload "/home/user/Documents"
    python -m cesiumcloud upload "/home/user/dogimages.zip"
    python -m cesiumcloud download "/home/user/Restored"
    python -m cesiumcloud whoami

The cesiumcloud command is equivalent to python3 -m cesiumcloud.

## Ubuntu 22.04, 24.04, 26.04 LTS and 26.10

Use Python 3.10 or newer. This Python client uses only the standard library
and does not require Node.js.

On Ubuntu, use a virtual environment instead of changing the system Python:

    sudo apt-get update
    sudo apt-get install -y python3 python3-venv
    python3 -m venv "$HOME/.local/share/cesiumcloud/venv"
    "$HOME/.local/share/cesiumcloud/venv/bin/python" -m pip install --upgrade https://cloud.cesiummc.space/clients/cesiumcloud-0.1.5-py3-none-any.whl
    "$HOME/.local/share/cesiumcloud/venv/bin/cesiumcloud" authenticate
    "$HOME/.local/share/cesiumcloud/venv/bin/cesiumcloud" upload "$HOME/Videos/My video.mp4"

The CLI accepts a single path containing spaces even when it is unquoted,
but quoting paths is still recommended. Authentication keeps the existing
~/.cesiumcloud/credentials.json.

Large uploads display transport-send progress in 256 KiB increments.
99% means data has been handed to the transport but may await server response;
100% appears only after the storage server commits the upload. The Python
client does not yet maintain resumable checkpoints across separate processes.

## Python SDK

    from cesiumcloud import CesiumCloudClient

    client = CesiumCloudClient()
    client.authenticate()
    client.upload("/home/user/dogimages.zip")
    files = client.list_files()
    print([file["name"] for file in files])
    client.download("/home/user/Restored")

Authentication uses your CesiumCloud account without copying an API key.
The Python implementation requires no Node.js runtime or third-party Python dependencies.

## Current limitations

Data is streamed directly from local files. The Python client does not yet maintain
restart-safe checkpoints across processes. Existing destination files are not
silently overwritten. Keep an independent backup of important data.

## Access management

Revoke credentials from the CesiumCloud dashboard. The logout command removes local credentials only.

## Existing accounts

CesiumCloud connects to the existing API and stores credentials in ~/.cesiumcloud/credentials.json. Existing CesiumCloud package installations are not modified.


### PowerShell filenames with parentheses
PowerShell treats unquoted parentheses as shell syntax and may remove them
before a program receives command arguments. Quote the **entire** path:

    cesiumcloud upload "E:\\Downloads\\Roblox 2026-10-18 13-37-47 (1).mp4"

The CLI joins unquoted fragments containing ordinary spaces, but cannot
reconstruct text that the shell has discarded. Version 0.1.5 displays
matching filenames and complete quoted examples when the supplied path
does not exist; it never guesses and uploads the wrong file.


## Reliable Python restore (0.1.5)

The Python CLI restores all committed files into a chosen directory.
Data is downloaded in bounded chunks, using authenticated HTTP byte-range
requests to resume incomplete or prematurely terminated file segments.
A successful restore checks every restored file's expected size.

If a previous restore stopped, use a NEW directory when retrying; partial
files in the old destination are left for inspection and are never deleted
silently. A restore is not a selective single-file fetch; it reconstructs
the account's committed backup set.

Only retry/download traffic changes; uploading still uses two Worker writes
per new pack, plus account and other metadata requests as applicable.


## Browse, search, rename, and permanently delete (0.1.6)

Python and npm CLIs share an account-backed file catalog.

    cesiumcloud list                   # root, 15 items, size descending
    cesiumcloud list -10               # 10 items
    cesiumcloud list -a                # all files, recursively
    cesiumcloud list -100 images/dogs  # directory entries
    cesiumcloud list -next 15 images/dogs
    cesiumcloud list -sort name        # persistent for future lists
    cesiumcloud list -sort lastmodified
    cesiumcloud list -sort datecreated
    cesiumcloud list -sort reset       # size sorting
    cesiumcloud list -10 "images/dogs|images/cats"
    cesiumcloud search puppy
    cesiumcloud search .png            # extension
    cesiumcloud search ext:jpg
    cesiumcloud dir images/dogs        # enter directory
    cesiumcloud dir ..                 # parent
    cesiumcloud dir -                  # previous visited directory
    cesiumcloud dir /                  # root
    cesiumcloud rename images/dogs/a.png b      # keeps original .png
    cesiumcloud rename images/dogs/a.png b -ne  # drops extension
    cesiumcloud delete images/dogs/a.png
    cesiumcloud delete -resume

List shows file extensions, file sizes, last modified and upload timestamps
in local time. Creation timestamps are captured for new uploads when
the source filesystem provides them; older packs fall back to upload time.

Permanent delete is not hide-only. Files may share immutable backup packs,
so the CLI stages replacements for surviving files, cuts over to verified
replacements, and deletes the old Google Drive pack objects. The Worker
checks that removed Google Drive objects are absent before reclaiming
their storage accounting. Use delete -resume after an interrupted purge.
Deletion is irreversible and needs temporary free quota for replacement
packs. Folders are not deleted recursively by default.

For multiple directories, quote the complete expression with the pipe
character, since an unquoted pipe is shell syntax. The program accepts
separately quoted directory arguments too. ZIP archives are not expanded
by list: extract and upload a folder to browse inside it.


## Fast file listing in 0.1.7

Versions 0.1.6 and earlier reread two Google Drive index ranges from every
backup pack, sequentially, on every list/search/dir command. This could appear
to hang on an account containing many packs.

Version 0.1.7 uses an authenticated, account-isolated index stored in Cloudflare
D1: GET /v1/catalog/index?cursor=N. Immutable pack metadata is cached after
validation, including when new packs are committed. A first catalog read on an
older account may build this index; subsequent reads use D1. Cloud directories
and filenames remain identical to previous versions.

Navigation to /, .., and - is local; it does not need API access. Other
directory lookups use the indexed catalog. No user file contents are stored
in the D1 index (only paths, sizes, timestamps and pack segment locations).


## SQL-indexed file browsing (0.1.8)

All listing, searching, sorting, pagination and remote-directory existence
checks are now server-side SQL queries against Cloudflare D1.
A list -10 request returns only ten entries plus their directory count.
It does not loop through packs, download Google Drive metadata, load the
whole catalog into the CLI, or read any user file contents.

A persistent file_catalog_segments index is written at the same time
a new immutable backup pack's metadata is committed. Existing packs
are backfilled from the already-cached metadata, once, without downloading
the original packs. Physical Google Drive deletion and pack replacement
remain unchanged; visibility switches and pack deletion are reflected by
the indexed queries.

A file's stored byte size (including 64 GB or larger) does not change
the cost of browsing. Directory navigation to root, parent and history is
handled locally. The API uses /v1/catalog/browse with mode, dir,
sort, limit, offset and search as optional parameters.


## Readable terminal listings (0.1.9)

By default, list and search output an aligned, responsive terminal table with
filename, extension or directory marker, human-readable file size, and short
local timestamps, e.g. 2026-10-27 10:17. Repeated labels have been removed
from each file row.

The renderer adapts to 40- to 160-column terminals. On narrow consoles it
shows fewer columns rather than wrapping each entry; long names are clipped
in the middle while preserving their endings. To show the COMPLETE names
and metadata in multiple lines, run:

    cesiumcloud list -long
    cesiumcloud list -long 20 images
    cesiumcloud search .png -long

All of these commands list 20 items:

    cesiumcloud list 20
    cesiumcloud list -20
    cesiumcloud list -n 20
    cesiumcloud list --limit 20

Previously 'list 20' was mistakenly interpreted as the directory '/20' and
printed zero items. It is now accepted as a numeric limit.

The API-backed SQL listing, file contents, download behavior, physical
Drive deletion and authentication are unchanged. This is a CLI-only release.
