Python program Packaging-Upload to PyPI

Source: Internet
Author: User

PyPI Registration and Configuration

On PyPI's official website: https://pypi.python.org/pypi
Sign up for your account
After activating the account, we also need to configure a file locally

To create a file at the user's root directory:.pypirc
Enter your own account number and password in the file.

$ nano ~/.pypirc  #  Create file [distutils]index-servers = Pypi[pypi]repository:https: //pypi.python.org/pypiusername: Your account password: your password

Once we've configured it, we're ready for it.

Configuring Setup Items

Because is the most basic record only need in the project root directory configuration setup.py file

 fromSetuptoolsImportsetupversion='0.0.1'URL='Https://github.com/Ehco1996/lazySpider'KEYWORDS='Spider headers MySQL'EMAIL='[email protected]'DESCRIPTION="Powerful spider Tools"long_description=" "Lazyspider is a powerful tools which can:help get request Header/cookie E asily help manipulate database in humanized" "REQUIRES= ['Pymysql']packages= ['Lazyspider']setup (Name='Lazyspider', author='Ehco1996', License='GPLv3', Zip_safe=False, url=URL, Version=VERSION, Description=DESCRIPTION, Long_description=long_description, Author_email=EMAIL, Keywords=KEYWORDS, Install_requires=REQUIRES, Packages=PACKAGES, classifiers=[        'Development Status:: 2-pre-alpha',        'programming Language:: Python:: 3.3',        'programming Language:: Python:: 3.4',        'programming Language:: Python:: 3.5',        'programming Language:: Python:: 3.6',    ],)

Explain the meaning of each item separately.

    • Name: Project names
    • Author: author
    • License: Open Source Agreement
    • URL: Project Address
    • Version: Revision number
    • Description: A sentence description
    • Long_description: Long Text description
    • Author_email: Author Email
    • Keywords: project keywords
    • Install_requires: Predecessor dependency,
    • Packages: folder included in this project (local)
Packaging projects

I recommend using wheel to package items.

If not installed, first:

pip install wheel

Packaging commands

python setup.py bdist_wheel

After the command executes successfully, our source files are in the dist/ folder.

Uploading items

It's also a line of command.python setup.py bdist_wheel upload

This will enable you to pypi see the uploaded program on your homepage.
Next you can install it directly with PyPI.

Original: http://www.ehcoblog.ml/post/101/

Python program Packaging-Upload to PyPI

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.