pypi uploads its own projects

Keywords: Python Programming pip sudo

Upload and publish package files to PyPI

Create a PyPI account

Very simple, register directly through the official website https://pypi.python.org/pypi?. ... , but you need to verify the message and confirm activation.

Create user authentication file ~ /. pypirc

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

[distutils]
index-servers =
    pypi

[pypi]
repository: https://upload.pypi.org/legacy/
username: username
password: password

The user name and password are created in the previous step and are entered directly in clear text. If you think the clear text password is not secure, you can leave it blank. You will be prompted to enter it manually in the later upload process.

Install setuptools

Packaging mainly relies on a package called setuptools from python. Please use pip to install it before performing the following operations:

sudo pip install setuptools

Prepare the setup.py/setup.conf file

from __future__ import print_function
from setuptools import setup

setup(
    name="Lenovo-Ai-Client",
    version="1.0",
    author="Chen jie",
    author_email="chenjie32@lenovo.com",
    description="AI Lenovo",
    long_description=open("README.rst").read(),
    license="Apache License",
    url="",
    packages=['aiClient'],
    install_requires=[
        'requests',
        'simplejson',
        'opencv-python',
    ],
    classifiers=[
        "Environment :: Web Environment",
        "Intended Audience :: Developers",
        "Operating System :: OS Independent",
        "Topic :: Text Processing :: Indexing",
        "Topic :: Utilities",
        "Topic :: Internet",
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Programming Language :: Python",
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
    ],
)

Prepare the README.rst file for a project

python sdk

Pack

python setup.py sdist build

In this way, under the dist folder of the current directory, there will be another package ending with tar.gz:
Uploading
Use twine to upload, install twine first

twine upload dist/*

Pit: a 403 error has been reported all the time due to the registered account name. It is suggested that the user name should not be replaced by "use" - "

Only then

Use

pip install Lenovo-Ai-Client

Posted by stovellp on Thu, 28 Nov 2019 12:37:20 -0800