In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to publish your open source project to the Pypi server", the content of the article is simple and clear, easy to learn and understand, please follow the editor's ideas slowly in depth, together to study and learn "how to publish your open source project to the Pypi server"!
As we all know, one of the most attractive things about the Python community is that it provides a wealth of third-party libraries to which anyone can submit their own open source toolkits. If you want users to download and install them directly through the pip command, as developers, we can upload their own open source code to the Pypi server.
In addition to all the package directories of the project, the directory structure also has setup.py files and dependent package files, requirements.txt, and README description files.
| |-- MANIFEST.in |-- README.md |-- third-party package on which the requirements.txt # project depends |-- setup.cfg |-- setup.py # configuration file `- zhihu # package directory |-- _ _ init__.py |-- auth.py |-- error.py |-- main.py |-- models |
The setup.py file must contain the parameters specified in the setup function:
#-*-encoding: UTF-8-*-from setuptools import setup, find_packagesimport ioVERSION = '0.2.4'with io.open ("README.md", encoding='utf-8') as f: long_description = f.read () install_requires = open ("requirements.txt"). Readlines () setup (name= "zhihu", # pip installation name version=VERSION, # current version Each update uploaded to pypi needs to modify author= "liuzhijun", author_email= "lzjun567@gmail.com", url= "https://github.com/lzjun567/zhihu-api", keyworads=" zhihu ", description=" zhihu api from humans ", long_description=long_description, packages=find_packages (exclude= ('tests',' tests.*')), include_package_data=True, license='MIT License', classifiers= [], install_requires=install_requires,)
You can also download the code directly. After local installation and configuration through python settup.py install, you need to register your account https://pypi.python.org/pypi on the Pypi website.
Before uploading files, create a new file .pypirc in the current user directory of the system, as follows, and specify the user name and password:
[distutils] index-servers = pypi [pypi] username:xxxxpassword:xxxx
Start uploading:
Python setup.py register sdist bdist_egg upload
After the upload is successful, test the effect with pip install zhihu. Found that there was an error IOError: [Errno 2] No such file or directory: 'README.md', said that the README.md file could not be found. In fact, a step has been ignored here. You need to add the MANIFEST.in file to the project and enter the readme and requirement files:
Include README.mdinclude requirements.txt thank you for reading, the above is the content of "how to publish your open source project to the Pypi server", after the study of this article, I believe you have a deeper understanding of how to publish your open source project to the Pypi server, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.