PW build Python code library

First, the code package

Python code is packaged using packaging tools setuptool

1 Create a file structure

crawlerCore/
├── Core
│ └── init.py
└── setup.py

2 is defined setup content

from setuptool import setup,find_packages
setup(
    name='Core',
    version='1.0.0',
    packages=find_packages()

)

* Note: setup.py inside the name must be found in the file directory structure.

3 snake egg production (packing)

carried out python setup.py bdist_egg

Re-enter crawlerCore will find more than three files
crawlerCore /
├── Build
├── Core.egg_info
├── dist
├── Core
│ └── the init .py
└── setup.py

Core.egg_info store basic information packets, when to install will use

dist python eggs are stored, once for each package will generate an egg, if you need to fall back to the previous version, enter dist / use easy_install *.egginstall any previous version

4 installation package

carried outpython setup.py install

  • Mounted to the corresponding environment site-packagesbelow

  • It can be managed by pip

5 uninstalled package

carried outpip uninstall Core

  • You can uninstall accordance with the normal flow of pip

6 version rollback

Enter crawlerCore / dist execute easy_install *.eggthe corresponding version of egg package overwrites the current version

Two, python, PW

The above is a simple package management locally,
on how to build a python PW, refer to the documentation: Python Tutorial build PW

Reproduced in: https: //www.jianshu.com/p/6e37f849c50a

Guess you like

Origin blog.csdn.net/weixin_34405557/article/details/91116203