<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rishabh</title>
    <description>The latest articles on DEV Community by Rishabh (@rishabh5512).</description>
    <link>https://dev.to/rishabh5512</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4016851%2F2b8aa0d0-fcda-4f50-b63d-4093f2e5ff28.jpg</url>
      <title>DEV Community: Rishabh</title>
      <link>https://dev.to/rishabh5512</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rishabh5512"/>
    <language>en</language>
    <item>
      <title>I Built and Published My First Python Library - pkgprint</title>
      <dc:creator>Rishabh</dc:creator>
      <pubDate>Mon, 06 Jul 2026 01:49:01 +0000</pubDate>
      <link>https://dev.to/rishabh5512/i-built-and-published-my-first-python-library-pkgprint-2on5</link>
      <guid>https://dev.to/rishabh5512/i-built-and-published-my-first-python-library-pkgprint-2on5</guid>
      <description>&lt;p&gt;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.&lt;br&gt;
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.&lt;br&gt;
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.&lt;br&gt;
The result is pkgprint — a small, zero-dependency library for print and packaging math.&lt;br&gt;
What it does&lt;br&gt;
bash&lt;br&gt;
pip install pkgprint&lt;br&gt;
python import pkgprint&lt;/p&gt;

&lt;h1&gt;
  
  
  Standard paper sizes, no more googling "A4 size in mm"
&lt;/h1&gt;

&lt;p&gt;w, h = pkgprint.paper_size("A4")&lt;br&gt;
print(w, h)&lt;/p&gt;

&lt;h1&gt;
  
  
  → 210 297
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Add bleed to a business card before sending to print
&lt;/h1&gt;

&lt;p&gt;bleed_w, bleed_h = pkgprint.add_bleed(89, 51, bleed_mm=3)&lt;br&gt;
print(bleed_w, bleed_h)&lt;/p&gt;

&lt;h1&gt;
  
  
  → 95 57
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Convert a brand color from CMYK to RGB for a screen mockup
&lt;/h1&gt;

&lt;p&gt;rgb = pkgprint.cmyk_to_rgb(0, 100, 100, 0)&lt;br&gt;
print(rgb)&lt;/p&gt;

&lt;h1&gt;
  
  
  → (255, 0, 0)
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Or straight to hex
&lt;/h1&gt;

&lt;p&gt;print(pkgprint.rgb_to_hex(*rgb))&lt;/p&gt;

&lt;h1&gt;
  
  
  → #FF0000
&lt;/h1&gt;

&lt;p&gt;It covers four areas:&lt;/p&gt;

&lt;p&gt;Unit conversions — mm ↔ inches ↔ points, DPI/PPI&lt;br&gt;
Color conversions — CMYK ↔ RGB, hex ↔ RGB&lt;br&gt;
Standard sizes — ISO paper sizes, US sizes, common packaging box dimensions&lt;br&gt;
Print production math — bleed, safe margins, trim size calculations&lt;/p&gt;

&lt;p&gt;What I learned building it&lt;br&gt;
This was my first time going through the entire pipeline of shipping software, not just writing code that runs once:&lt;/p&gt;

&lt;p&gt;Modules and packages — how a folder of .py files with an &lt;strong&gt;init&lt;/strong&gt;.py becomes one importable unit&lt;br&gt;
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&lt;br&gt;
Packaging — pyproject.toml, building with python -m build, and the difference between a source distribution and a wheel&lt;br&gt;
The publish pipeline — TestPyPI first (to catch mistakes safely), then the real PyPI&lt;/p&gt;

&lt;p&gt;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.&lt;br&gt;
Try it / feedback welcome&lt;/p&gt;

&lt;p&gt;PyPI: &lt;a href="https://pypi.org/project/pkgprint/" rel="noopener noreferrer"&gt;https://pypi.org/project/pkgprint/&lt;/a&gt;&lt;br&gt;
Source: &lt;a href="https://github.com/Rishabh55122/pkgprint" rel="noopener noreferrer"&gt;https://github.com/Rishabh55122/pkgprint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>beginners</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
