cool hit counter [Songqin Software Automation Testing] How to Publish Your Python Modules_Intefrankly

[Songqin Software Automation Testing] How to Publish Your Python Modules


When we learn Python, besides installing some modules with pip, sometimes we download installers down from websites to install them, I also want to make such an installer for the modules I write, what should I do and how do I publish it?

Roughly, the following four steps are required.

1. First create a folder for the module.

As a simple chestnut, you have written an add.py module file with an add method to implement addition. This first step will require you to create a folder. and copy add.py into this folder, which we'll just name add for simplicity's sake

add

__add.py

2. Then create a file named "setup.py" in the new folder.

Edit this file and add the following code. This file contains metadata about the release, as in the following example, and the specific metadata can differ from the example.

3. Build a release file.

Now we have a folder containing two files: the module code in add.py and the relevant metadata in setup.py. Next we'll use Python's own publishing tool to create the publishing file.

Open a terminal in the add folder, or cmd command line cd to the add folder and execute the following command.

4. Install the release module into your local Python.

Still in the terminal you just opened, type the following command.

Look for the release message to appear on the screen to confirm that the installation was successful and the release is ready.

We end up with the following folder structure.

Of which.

- The file MANIFEST contains the list of files in the release

- Both buildlibadd.py and add.py in the root directory are code files

- distadd-1.0.0.tar.gz is the distribution package

- add.pyc is the compiled version code

- setup.py stores metadata


Recommended>>
1、30 years of electronic money from emoney to blockchain
2、A programmers guide to daily dislikeavi please open with caution product managers avoid it
3、AEM Racing Integrated Instrumentation
4、How does TCM Chain combine TCM with blockchain
5、Modeling Experience Early Learning

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号