Skip to content

CLI reference

machyon [download] SOURCE [-o DIR] [options]
machyon retry [-o DIR] [--all] [options]
machyon names SOURCE [--names TEMPLATE] [--limit N | --output FILE]
machyon doctor URL [--referer URL] [--header 'Name: value']
machyon ui [--output-dir DIR] [--port PORT] [--no-browser] [--max-upload-mb MB]

download is the default, so machyon urls.csv -o images/ works. The help text below is captured from the installed version (1.2.4) when this site is built.

machyon download

Downloads every URL in SOURCE into the output folder (default images). Prints a summary, explains each kind of failure once, and tells you where the ledger is.

usage: machyon download [-h] [--url-col URL_COL] [--name-col NAME_COL] [--names NAMES]
                        [-o OUTPUT] [--start START] [--end END]
                        [--concurrency CONCURRENCY] [--max-concurrency MAX_CONCURRENCY]
                        [--retries RETRIES] [--timeout TIMEOUT] [--no-adaptive]
                        [--no-hedge] [--header 'Name: value'] [--referer REFERER]
                        [--verify-existing] [--tls-trust {native,certifi,python}]
                        [--insecure] [--no-validate] [--no-progress] [--metrics DIR]
                        [--log DIR] [--config INI] [--strict]
                        source

positional arguments:
  source                CSV, TSV, TXT, JSON, JSONL or Parquet file of image URLs

options:
  -h, --help            show this help message and exit
  --url-col URL_COL     column with the URLs (auto-detected if omitted)
  --name-col NAME_COL   column with ready-made filenames
  --names NAMES         filename template, e.g. '{index}_{hash}{ext}'. Keys: index, hash,
                        stem, ext, host, and any column name. Default: {hash}{ext}
  -o, --output OUTPUT   folder to save into (default: images)
  --start START         first row to download
  --end END             stop before this row

tuning (defaults are fine for almost everyone):
  --concurrency CONCURRENCY
                        starting in-flight requests (adapts automatically)
  --max-concurrency MAX_CONCURRENCY
                        ceiling for in-flight requests
  --retries RETRIES     retries per image after the first attempt
  --timeout TIMEOUT     connect / read-stall timeout in seconds
  --no-adaptive         fixed concurrency
  --no-hedge            don't race duplicate requests against stragglers
  --header 'Name: value'
                        extra request header
  --referer REFERER     Referer header to send
  --verify-existing     check files already on disk are real images
  --tls-trust {native,certifi,python}
                        CA source for HTTPS: native = OS store, like your browser
                        (default)
  --insecure            do NOT verify HTTPS certificates (only for hosts you trust; see
                        `machyon doctor`)
  --no-validate         keep non-image responses too
  --no-progress         no progress bar
  --metrics DIR         append a run summary to DIR/metrics_json_info.json
  --log DIR             write DIR/machyon.log
  --config INI          load settings from an INI file ([SETTINGS] section)
  --strict              exit with status 1 if anything failed

machyon retry

Retries the failures recorded in the output folder's failed_downloads.jsonl, under their original filenames. You don't need the source file. Permanent failures (a 404, a page that isn't an image) are skipped unless you pass --all.

usage: machyon retry [-h] [-o OUTPUT] [--all] [--concurrency CONCURRENCY]
                     [--max-concurrency MAX_CONCURRENCY] [--retries RETRIES]
                     [--timeout TIMEOUT] [--no-adaptive] [--no-hedge]
                     [--header 'Name: value'] [--referer REFERER] [--verify-existing]
                     [--tls-trust {native,certifi,python}] [--insecure] [--no-validate]
                     [--no-progress] [--metrics DIR] [--log DIR] [--config INI] [--strict]

options:
  -h, --help            show this help message and exit
  -o, --output OUTPUT   folder that was downloaded into
  --all                 also retry permanent failures (404, not an image, ...)

tuning (defaults are fine for almost everyone):
  --concurrency CONCURRENCY
                        starting in-flight requests (adapts automatically)
  --max-concurrency MAX_CONCURRENCY
                        ceiling for in-flight requests
  --retries RETRIES     retries per image after the first attempt
  --timeout TIMEOUT     connect / read-stall timeout in seconds
  --no-adaptive         fixed concurrency
  --no-hedge            don't race duplicate requests against stragglers
  --header 'Name: value'
                        extra request header
  --referer REFERER     Referer header to send
  --verify-existing     check files already on disk are real images
  --tls-trust {native,certifi,python}
                        CA source for HTTPS: native = OS store, like your browser
                        (default)
  --insecure            do NOT verify HTTPS certificates (only for hosts you trust; see
                        `machyon doctor`)
  --no-validate         keep non-image responses too
  --no-progress         no progress bar
  --metrics DIR         append a run summary to DIR/metrics_json_info.json
  --log DIR             write DIR/machyon.log
  --config INI          load settings from an INI file ([SETTINGS] section)
  --strict              exit with status 1 if anything failed

machyon names

Shows the URL-to-filename mapping a template produces, without downloading anything. Use it to check a template before a long run.

Preview filenames
$ machyon names urls.csv --names {label}/{index}_{hash}{ext} --limit 5
url,filename
http://cdn.example.test/img/0.jpg,cats/0_d1e3c34fa02486a3.jpg
http://cdn.example.test/img/1.jpg,dogs/1_510873ebf99d1821.jpg
http://cdn.example.test/img/2.jpg,birds/2_a03a7f5097a3ea2a.jpg
http://cdn.example.test/img/3.jpg,cats/3_7a14df47744ec9b3.jpg
http://cdn.example.test/img/4.jpg,dogs/4_cea8ca3f3ee32a42.jpg

Recorded from Machyon 1.1.0 against the local test CDN (tools/record_casts.py).

usage: machyon names [-h] [--url-col URL_COL] [--name-col NAME_COL] [--names NAMES]
                     [--limit LIMIT] [--output OUTPUT]
                     source

positional arguments:
  source               CSV, TSV, TXT, JSON, JSONL or Parquet file of image URLs

options:
  -h, --help           show this help message and exit
  --url-col URL_COL    column with the URLs (auto-detected if omitted)
  --name-col NAME_COL  column with ready-made filenames
  --names NAMES        filename template, e.g. '{index}_{hash}{ext}'. Keys: index, hash,
                       stem, ext, host, and any column name. Default: {hash}{ext}
  --limit LIMIT        rows to show (default: 20)
  --output OUTPUT      write the full mapping to this CSV instead

machyon doctor

Explains why one URL fails: Python and library versions, the proxy in use, DNS, a request through each TLS trust source, and a plain-language verdict. Troubleshooting with the doctor

usage: machyon doctor [-h] [--referer REFERER] [--header 'Name: value'] url

positional arguments:
  url                   one image URL from your list

options:
  -h, --help            show this help message and exit
  --referer REFERER     Referer header to send
  --header 'Name: value'
                        extra request header

machyon ui

Opens Machyon in your browser: a local app, served from this computer to this computer only, for pasting links or uploading a manifest, choosing names and settings, and watching the download. Every run is saved in its own folder inside the workspace, so the history is still there after a restart. The workspace is the folder you last chose in the app (Change folder), or ~/machyon-downloads until you choose one. --output-dir uses another folder for that launch only, and leaves the folder chosen in the app as it is.

usage: machyon ui [-h] [--output-dir OUTPUT_DIR] [--port PORT] [--no-browser]
                  [--max-upload-mb MAX_UPLOAD_MB]

options:
  -h, --help            show this help message and exit
  --output-dir OUTPUT_DIR
                        the workspace, the folder that holds every run, for this launch
                        only (default: the folder last chosen in the app, else ~/machyon-
                        downloads)
  --port PORT           port on 127.0.0.1 (default: 8765, or a free one if it's taken)
  --no-browser          don't open a browser; just print the link
  --max-upload-mb MAX_UPLOAD_MB
                        largest manifest you can upload, in MB (default: 256; plain .json:
                        50)

It listens on 127.0.0.1 only, on port 8765, or on a free port if 8765 is taken (a port you choose with --port must be free). The link it prints carries a key for this session; the app answers nothing without it. Stop it with Ctrl+C: a download that is still running stops cleanly and can be resumed.

Machyon fetches the links from your computer, as the other commands do, so a manifest can name addresses on your own network, and redirects are followed. Use manifests you trust.

A manifest called ui

machyon <file> is short for machyon download <file>. For a file literally named ui, write machyon download ui.

Exit status

Status Meaning
0 The command finished. Failures are recorded in the ledger but don't change the status unless you pass --strict
1 --strict was given and at least one row failed (download), or is still failing (retry)
2 Invalid arguments, or machyon ui can't listen on the --port you chose