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