How to Create and Publish a Python Package on PyPI

Publishing your first Python package on PyPI (Python Package Index) feels like sending your code off to college—it’s out there in the world, ready to make you proud (and maybe help someone too). In my case, I was working on my own version of mkdocs-material. Initially, I was all about the UI—just trying to get it to look good and work as intended. After some effort, I had something usable and thought, "Alright, let's figure out the deployment." The original mkdocs uses a Python package for its installer, so you can just pip install mkdocs, mkdocs new ., and then mkdocs build to convert markdown files into HTML. It’s simple, elegant, and works like a charm. I wanted the same experience for my project—an easy pip install setup to make deploying my version of mkdocs-material. So, it was my time to learn how to build my own Python package and publish it. And that’s exactly what we’ll do here, step by step. Don’t worry—it’s easier than debugging a Friday night code bug XD Step 1: Structure

Jan 22, 2025 - 20:41
 0
How to Create and Publish a Python Package on PyPI

Publishing your first Python package on PyPI (Python Package Index) feels like sending your code off to college—it’s out there in the world, ready to make you proud (and maybe help someone too).

In my case, I was working on my own version of mkdocs-material.

Initially, I was all about the UI—just trying to get it to look good and work as intended. After some effort, I had something usable and thought, "Alright, let's figure out the deployment."

The original mkdocs uses a Python package for its installer, so you can just pip install mkdocs, mkdocs new ., and then mkdocs build to convert markdown files into HTML.

It’s simple, elegant, and works like a charm.

I wanted the same experience for my project—an easy pip install setup to make deploying my version of mkdocs-material.

So, it was my time to learn how to build my own Python package and publish it. And that’s exactly what we’ll do here, step by step.

Don’t worry—it’s easier than debugging a Friday night code bug XD

Step 1: Structure

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow