Skip to main content

Printify Automation Python Package

A modular, extensible Python package and CLI automation suite for Printify. Dynamically configure image path, image size/scale, placement (x, y, angle), pricing markups, color variants, and AI metadata generation to create Printify products.

Based on production TypeScript automation scripts and converted into an idiomatic, reusable Python package.


Sizing Modes & Resolution

Sizing Modes (--size-mode)

  • fit (default): Proportional safe fit (scale: 0.85, centered x: 0.5, y: 0.5). Prevents edge cropping.
  • center: Classic chest placement with comfortable margins (scale: 0.80, centered x: 0.5, y: 0.5).
  • stretch: Full-bleed maximum printable width (scale: 0.98, edge-to-edge).
  • custom: Explicit manual --scale, --x, and --y values.

Output Resolutions (--resolution)

  • Options: original (default), 1800px, 2400px, 3600px, 4500px.
  • High-quality Lanczos resampling maintains exact aspect ratios and caches resized files in .cache/resized/.

Test-1-First Gate (--test-first)

When processing batches, test 1 product first before running all images:

  1. Creates the first sample product in Printify.
  2. Displays the direct Printify Dashboard review URL.
  3. Asks user to confirm mockup quality before processing remaining images.
# Batch with Test-1-First and Fit mode
printify-batch --folder /path/to/art --size-mode fit --resolution 2400px --test-first
  • Single & Batch Product Creation: Create one product or batch process entire artwork directories with automatic progress tracking (sweatshirt_progress.json), resume capability, and rate-limiting delays.
  • Smart Upload Caching: Disk-backed cache (.cache/printify_uploads.json) calculates file SHA256 hashes to prevent redundant image uploads.
  • Variant Filtering & Markup: Auto-filters catalog variants by allowed color palettes (e.g. Comfort Colors: Pepper, Blue Spruce, Seafoam, Terracotta...) and applies dynamic profit markups (e.g. 1.5 = +50%).
  • Interactive Wizard & CLI: Run with an interactive terminal wizard or execute directly via command-line flags.
  • AI-Powered Copywriting (Optional): Automatically generates SEO-optimized product titles, descriptions, and tags using local Ollama (Llava/Vision models) with dependable rule-based fallbacks.
  • Product Utilities: Bulk-update product variants or move products between stores.

Installation

cd printify-python

# Install package in editable mode
pip install -e .

Environment Configuration

Create a .env or .env.local file:

PRINTIFY_API_TOKEN=your_printify_api_token
PRINTIFY_SHOP_ID=your_shop_id

# Optional: Local Ollama for AI metadata generation
OLLAMA_URL=http://localhost:11434/api/generate
OLLAMA_MODEL=llava

Quick Start (Interactive Wizard)

Run the wizard without arguments to be prompted for inputs dynamically:

printify-automation
# or:
python scripts/create_product.py

The wizard prompts you for:

  1. Shop ID (or select from your connected shops)
  2. Mode (Single Image or Batch Directory)
  3. Product preset (Sweatshirt, T-shirt, Hoodie, or custom blueprint)
  4. Image placement & scale (e.g., 0.8, x: 0.5, y: 0.5)
  5. Price markup multiplier
  6. Metadata (Manual or AI generated)

CLI Usage

1. Create a Single Product Dynamically

# Basic creation with dynamic image and custom scale
printify-create --image /path/to/design.png --scale 0.85 --title "Sunset Beach Sweatshirt"

# Advanced with custom placement, shop, and color filters
printify-create \
  --image /path/to/design.png \
  --scale 0.8 \
  --x 0.5 --y 0.48 \
  --shop-id 12345678 \
  --blueprint-id 1296 \
  --provider-id 39 \
  --markup 1.5 \
  --colors "pepper,blue spruce,seafoam,white" \
  --ai

2. Batch Create from Folder

printify-batch \
  --folder /path/to/artwork_folder \
  --scale 0.8 \
  --markup 1.5 \
  --progress-file sweatshirt_progress.json \
  --delay 2.0

3. List Shops & Blueprints

# List all connected shops
printify-automation shops

# Inspect variants for a blueprint & provider
printify-automation variants --blueprint-id 1296 --provider-id 39

4. Move Products Between Shops

printify-automation move --from-shop 12345678 --to-shop 87654321 --filter "hoodie"

Python API Usage

You can also use the package inside your own Python code:

from printify_automation import ProductBuilder, ImagePlacement, PrintifyClient

client = PrintifyClient(api_token="your_token")
builder = ProductBuilder(client=client)

# Define custom placement dynamically
placement = ImagePlacement(
    x=0.5,
    y=0.48,
    scale=0.82,
    position="front"
)

product = builder.create(
    image="/path/to/artwork.png",
    shop_id="12345678",
    blueprint_id=1296,        # Comfort Colors Sweatshirt
    print_provider_id=39,     # SwiftPOD
    placement=placement,
    price_markup=1.5,
    allowed_colors=["pepper", "seafoam", "white"],
    title="Coastal Comfort Sweatshirt",
    description="Heavyweight garment-dyed sweatshirt with premium graphic print."
)

print(f"Created product: {product['id']}")

Project Structure

printify-python/
├── printify_automation/          # Main package
│   ├── __init__.py
│   ├── client.py                 # Printify REST API client
│   ├── image_utils.py            # Image metadata & dynamic placement calculation
│   ├── cache.py                  # Disk cache for uploads
│   ├── ai.py                     # Ollama / Llava metadata generator & fallback
│   ├── builder.py                # High-level product orchestrator
│   ├── batch.py                  # Directory batch processor & progress tracking
│   └── cli.py                    # Interactive wizard & CLI subcommands
├── scripts/
│   ├── create_product.py         # Standalone single product runner
│   ├── batch_create.py           # Standalone batch runner
│   └── update_variants.py        # Bulk variant updater
├── tests/
│   └── test_automation.py        # Automated test suite
├── pyproject.toml
└── README.md

Running Tests

python -m unittest discover tests

Metadata

Release files for printify-automation 0.1.0

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

Source distribution (sdist)

Source distribution for printify-automation 0.1.0
File Size Uploaded Provenance Actions
printify_automation-0.1.0.tar.gz 26.9 kB Without provenance Details for printify_automation-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for printify-automation 0.1.0
File Interpreter ABI Platform Actions
printify_automation-0.1.0-py3-none-any.whl Python 3 none any Details for printify_automation-0.1.0-py3-none-any.whl

Total release size: 52.2 kB

Release files / printify_automation-0.1.0.tar.gz

Download URL printify_automation-0.1.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5c98715c88235f083e6328d14549f623926adb93c549562008b22a56be7804a3
BLAKE2b-256 checksum
How to use checksums
94ff148cfa543bbb511f8574b8521cb78cb12f8b653fe4ef6d285498d52959e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / printify_automation-0.1.0-py3-none-any.whl

Download URL printify_automation-0.1.0-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffa06d5be50b03543236dba1ce0a56a8cebd7616e9e84724abe0bfd96be2e4bb
BLAKE2b-256 checksum
How to use checksums
a350221c30ae0233726d1aa7485e112c604b8d158311f3814e1798059413bcb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for printify-automation 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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