Record the process of making pypi package for the first time


1. Create a project folder

mkdir dada_openapi_python
cd dada_openapi_python

2. Create package folder

A folder of dada open API client is being created in it. The name of this folder is intentionally different from that of the upper directory to avoid misunderstanding. This folder is actually the package name

mkdir dada_openapi_client
cd dada_openapi_client

3. Write package code

According to the respective business scenarios, here is a list of the

Make PyPI package

Now that the project logic has been completed, the package of PyPI is started

1. Create the file

In the dada OpenAPI Python folder, create the configuration file, fill in the configuration, and paste my configuration below

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/1/6 15:41
# @Author  : Weiqiang.long
# @Site    : 
# @File    :
# @Software: PyCharm
# @Description:

import setuptools

with open("", "r", encoding="utf-8") as fh:
    long_description =

    name = "dada_openapi_client",
    version = "1.0.3",
    author = "Weiqiang.long",
    description = "Dada signature data encapsulation",
    long_description = long_description,
    url = "",
    packages = setuptools.find_packages(),
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",


For the specific meaning of each field in the above configuration, please refer to Official website documents 2.8 of


Run this command in the dada OpenAPI Python folder

python sdist bdist_wheel


python -m twine upload dist/*
  • Successfully uploaded as follows:
Uploading distributions to
Uploading dada_openapi_client-1.0.3-py3-none-any.whl
███████████████| 7.88k/7.88k [00:00<00:00, 10.6kB/s]
Uploading dada_openapi_client-1.0.3.tar.gz
███████████████| 6.23k/6.23k [00:01<00:00, 4.43kB/s]

Possible problems

Upload failed (403): Invalid or non-existent authentication information.

Wrong user authentication information, you need to create a user authentication file ~ /. pypirc

Create user authentication file ~ /. pypirc

Create a new blank file named. pypirc in your own user directory. The content is as follows:


[pypi]repository =
username = XXX
password = XXX

Upload failed (403): You are not allowed to edit 'xxx' package information

You need to register your package before you can start uploading

Server response (401): Incomplete registration; check your email

Your PyPI account hasn't completed the email verification yet. You need to register your email to find a verification email to complete the verification and then try the failed step again.

Server response (400): Invalid classifier "Topic :: Software Development :: Utilities"

The classifier information in your file is incorrect. Please press Official website The correct classification of writing classifier

error: No dist file created in earlier command

You started to upload the command before you packed it

Upload failed (400): File already exists

The file already exists. You should update the version number every time.

Reference documents:

Tags: Python Pycharm encoding github

Posted on Tue, 07 Jan 2020 02:48:00 -0800 by jikishlove