zoukankan      html  css  js  c++  java
  • How to package your python codes?

    Here is the detail introduction:

    https://packaging.python.org/distributing/

    Basicly, to create a python package, you just need to do the following steps:

    1. Create a setup.py and a setup.cfg (optional) file, here is an example:

    import re
    from distutils.core import setup
    
    setup(name='packageName',
          version='1.0.0.dev0',
          description='Package description',
          author='YourName',
          author_email='yourname@email.com',
          packages=['packageName'],
    install_requires=['Mako'], include_package_data
    =True, zip_safe = False )

    2. Create a MANIFEST.in file.

    include *.txt
    recursive-include docs *
    recursive-include folder_name *

    3. Run command.

    Python setup.py sdist

    To upload the package to your pypi server

    1. Create a .pypirc file in C:Users<yourname>, and refer to the example

    [distutils]
    index-servers:
       primary
       secondary
    [primary]
    repository: http://primary.domain
    username: whoami
    password: guessme
    [secondary]
    repository: http://secondary.domain
    username: whoami
    password: guessme

    2. Upload your package.

    Upload your package to primary pypi server, just use the command below:

    Python setup.py upload primary

    But the recommend way to upload your packages is using Twine.

    See https://packaging.python.org/distributing/#upload-your-distributions

    3. Also, you can create your own uploader, the best practice way to upload your package is

    Build Your package --> Test Your Package (Code Coverage, UT) --(If Test Pass)--> Upload to the Pypi repository.

  • 相关阅读:
    mingw 构建 Geos
    nmake构建Geos库
    使用Dlib来运行基于CNN的人脸检测
    DLib Http Server程序示例
    DLib压缩解压程序示例
    GDAL添加ECW格式支持
    Dlib机器学习指南图翻译
    DLib库Base64编解码示例
    Dlib三维点云示例
    Mingw编译DLib
  • 原文地址:https://www.cnblogs.com/kenfang/p/5736525.html
Copyright © 2011-2022 走看看