I graduated with a degree in Printing and Packaging Technology and spent the last few years doing freelance graphic design branding, packaging, visual identity work. A few weeks ago, I started learning Python from scratch.
Somewhere around the "variables and f-strings" stage of my learning, I had an idea: every print/packaging designer I know does the same tedious math by hand, over and over โ converting units, calculating bleed, translating CMYK to RGB for screen previews. There wasn't a clean Python library for any of it.
So I decided to build one โ and publish it to PyPI as a way to actually use what I was learning instead of just doing tutorial exercises.
The result is pkgprint โ a small, zero-dependency library for print and packaging math.
What it does
bash
pip install pkgprint
python import pkgprint
Standard paper sizes, no more googling "A4 size in mm"
w, h = pkgprint.paper_size("A4")
print(w, h)
โ 210 297
Add bleed to a business card before sending to print
bleed_w, bleed_h = pkgprint.add_bleed(89, 51, bleed_mm=3)
print(bleed_w, bleed_h)
โ 95 57
Convert a brand color from CMYK to RGB for a screen mockup
rgb = pkgprint.cmyk_to_rgb(0, 100, 100, 0)
print(rgb)
โ (255, 0, 0)
Or straight to hex
print(pkgprint.rgb_to_hex(*rgb))
โ #FF0000
It covers four areas:
Unit conversions โ mm โ inches โ points, DPI/PPI
Color conversions โ CMYK โ RGB, hex โ RGB
Standard sizes โ ISO paper sizes, US sizes, common packaging box dimensions
Print production math โ bleed, safe margins, trim size calculations
What I learned building it
This was my first time going through the entire pipeline of shipping software, not just writing code that runs once:
Modules and packages โ how a folder of .py files with an init.py becomes one importable unit
Testing โ I wrote 100+ tests with pytest, including round-trip tests (e.g. converting RGB โ CMYK โ RGB and checking I get back roughly what I started with) โ these caught real edge cases I hadn't thought about, like pure black in CMYK causing a division-by-zero in my first draft of the RGB-to-CMYK formula
Packaging โ pyproject.toml, building with python -m build, and the difference between a source distribution and a wheel
The publish pipeline โ TestPyPI first (to catch mistakes safely), then the real PyPI
The most surprising part: writing the tests actually forced me to think harder about the domain logic than writing the functions did. A test like "business card size + 3mm bleed on each side should equal exactly this" makes you notice ambiguity you didn't know was there โ like the fact that "business card" means a different physical size in the US vs. ISO/European standards. That's a bug I only caught because a test forced me to be specific.
Try it / feedback welcome
PyPI: https://pypi.org/project/pkgprint/
Source: https://github.com/Rishabh55122/pkgprint
It's early (0.1.0), so if you work with print, packaging, or design-adjacent tooling and see something missing or wrong, I'd genuinely appreciate an issue or PR. And if you're also learning Python and thinking about building something โ my honest takeaway is: pick a problem you already understand deeply from a non-coding background. It made the "why" of testing and structuring code obvious in a way tutorials hadn't.
United States
NORTH AMERICA
Related News
Secret Claude Tracker Shocks Users After Anthropic's Anti-Surveillance Stance
12h ago
EV Batteries Defy Expectations, Last Hundreds of Thousands of Miles
1d ago
GBase 8a Performance Anomaly Case Study: How a Single Parameter Change Sparked a Chain Reaction
1d ago
Who Else Has Inherited a Codebase With Zero Comments and a Prayer?
1d ago
ๅฎ็พ็ๅนณๅบธ
3h ago