Skip to main content

pinforge

Build vertical 1000×1500 Pinterest pins from an image and a few lines of text, and work out what to publish first from a Google Search Console export — counted separately for every locale.

Two small things that turned out to matter when running a multilingual site's Pinterest account for a month.

pip install pinforge

Why per-locale ranking

If your site has several language versions, demand in each one is different. Summing impressions across the whole site and reusing that single order for every language sends your best material to the wrong audience.

Concrete example from the site this was written for — same 78 tarot cards, four languages, the most-searched card in each:

Locale Top item Impressions
Ukrainian Six of Wands 308
Russian Ten of Cups 270
English Four of Wands 158
French The Magician 19

Four different answers. Not the same list in a different order — different items.

from pinforge import rank_by_locale

queues = rank_by_locale(
    "pages.csv",                   # Pages export from Search Console
    item_pattern=r"/card/([^/?]+)$",
    locales=("ru", "uk", "fr"),    # anything else falls into default_locale
    default_locale="en",
)

for slug, impressions in queues["uk"][:5]:
    print(slug, impressions)

Works with the CSV as Search Console exports it, in any interface language — column names are detected, not hard-coded.

Composing a pin

from pinforge import PinStyle, compose

style = PinStyle(
    script_font="GreatVibes-Regular.ttf",   # brand name
    body_font="PlaypenSans.ttf",            # title and subtitle
    seed=7,                                 # same seed = same starfield
)

compose(
    out="pin.png",
    image="six-of-wands.jpg",
    title="Six of Wands",
    subtitle="Victory · Recognition · Success",
    footer="example.com",
    brand="Example",
    style=style,
)

Produces a dark, starfield-backed pin: brand at the top, the image framed and glowing in the middle, title and subtitle below, site address at the bottom. Colours, size, star density and fonts are all on PinStyle.

Fonts are optional — without them Pillow's default is used and the result is plain but valid.

Command line

pinforge compose --image card.jpg --title "Six of Wands" \
  --subtitle "Victory · Recognition · Success" \
  --footer example.com --brand Example --out pin.png

pinforge rank --pages pages.csv --pattern '/card/([^/?]+)$' \
  --locales ru,uk,fr --top 5

Where it came from

Written for tarot-magic.com, a tarot reference covering all 78 cards in English, Russian, Ukrainian and French. It generates the card pins for four language boards, and the ranking decides the order they go out in — which is how the per-locale difference above was discovered in the first place.

MIT licensed.

Metadata

Release files for pinforge 0.1.1

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

Source distribution (sdist)

Source distribution for pinforge 0.1.1
File Size Uploaded
pinforge-0.1.1.tar.gz 7.3 kB Details

Built distribution (wheel)

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

Total release size: 16.8 kB

Release files / pinforge-0.1.1.tar.gz

Download URL pinforge-0.1.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0ccff2c3f5f84020a63fceddc21d47cb5988e4737e6b95612659c7fc25824173
BLAKE2b-256 checksum
How to use checksums
ea1188bd802a9db7b3b67566273a0633fa53862a112c86d62af5677ed37f438a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / pinforge-0.1.1-py3-none-any.whl

Download URL pinforge-0.1.1-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6a76ec9ddfd3c0bfcd3ab637856083ad1aa2bbb68dc7a96293a0c74fcfb8ece
BLAKE2b-256 checksum
How to use checksums
b4928d0ca1bddd51c253f258ff3bf6832b0696b89832416a3955834942290d90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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