How to Publish Your Python Package with Just 2 Commands

How to Publish Your Python Package with Just 2 Commands

Learn how to publish your Python library using Poetry. Also, learn how to test your packaging on the TestPyPI framework.

Packaging your Python library has never been easier now using Poetry. You may have a side project in Python that benefits others. You can publish it using Poetry. This post will show you how to build your own Python library and publish it on the most popular Python package repository PyPI.

I will use one of my recent Python projects, PyPocket: a Python library (wrapper) for Pocket (previously known as Read It Later).


1. Project environment

You need to have your project environment managed in Poetry since we will be using the pyproject.toml file to build our package and publish it.

You can check my post on how to set up your Python environment using Conda and Poetry. If you are not using Conda, you can follow the steps I provided in the post but instead use other environment management systems like Pipenv or Virtualenv.

2. Package repository

We will need a package repository to host the Python package; the most popular one is PyPI. So, if you want to publish your library on PyPI, you need to first create an account on PyPI.

packaging python

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

top 30 Python Tips and Tricks for Beginners

In this post, we'll learn top 30 Python Tips and Tricks for Beginners

Top 20 Most Useful Python Modules or Packages

In this post, we will learn the top 20 most useful python modules or packages and these modules every Python developer should know. Will definitely help you

Lambda, Map, Filter functions in python

You can learn how to use Lambda,Map,Filter function in python with Advance code examples. Please read this article

Python Tricks Every Developer Should Know

In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.

How to Remove all Duplicate Files on your Drive via Python

Today you're going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates. We gonna use Python OS remove( ) method to remove the duplicates on our drive. Well, that's simple you just call remove ( ) with a parameter of the name of the file you wanna remove done.