将setuptools setup.py转换为setup.cfg

setuptools-py2cfg的Python项目详细描述


Latest version released on PyPiBuild statusBSD 3-Clause

从版本30.3.0开始,setuptools supports通过 setup.cfg文件。这个脚本有助于将现有的 setup.cfg采用setuptools所需的格式。

用法

只需将setuptools-py2cfg指向setup.py文件或在目录中运行它 包含setup.py。例如,给定以下setup.py

fromsetuptoolsimportsetup,find_packagesclassifiers=['Development Status :: 5 - Production/Stable','Programming Language :: Python :: 2.7','Programming Language :: Python :: 3','Programming Language :: Python :: 3.3','Programming Language :: Python :: 3.4','Programming Language :: Python :: 3.5','Programming Language :: Python :: 3.6','Intended Audience :: Developers','Topic :: Software Development :: Libraries','License :: OSI Approved :: BSD License',]extras_require={'tests':['tox >= 2.6.0','pytest >= 3.0.3',],'devel':['check-manifest >= 0.35','readme-renderer >= 16.0',]}kw={'name':'ansimarkup','version':'1.3.0','description':'Produce colored terminal text with an xml-like markup','long_description':open('README.rst').read(),'author':'Georgi Valkov','author_email':'georgi.t.valkov@gmail.com','license':'Revised BSD License','keywords':'ansi terminal markup','url':'https://github.com/gvalkov/python-ansimarkup','classifiers':classifiers,'install_requires':'colorama','extras_require':extras_require,'packages':find_packages(),'zip_safe':True,}if__name__=='__main__':setup(**kw)

运行setuptools-py2cfg.py将打印:

[metadata]name=ansimarkupversion=1.3.0author=Georgi Valkovauthor_email=georgi.t.valkov@gmail.comlicense=Revised BSD Licensedescription=Produce colored terminal text with an xml-like markupkeywords=ansi, terminal, markupurl=https://github.com/gvalkov/python-ansimarkuplong_description=file: README.rstclassifiers=
    Development Status :: 5 - Production/Stable
    Programming Language :: Python :: 2.7
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3.3
    Programming Language :: Python :: 3.4
    Programming Language :: Python :: 3.5
    Programming Language :: Python :: 3.6
    Intended Audience :: Developers
    Topic :: Software Development :: Libraries
    License :: OSI Approved :: BSD License[options]packages=find:zip_safe=Trueinstall_requires=colorama[options.extras_require]tests=
    tox >= 2.6.0
    pytest >= 3.0.3devel=
    check-manifest >= 0.35
    readme-renderer >= 16.0

有几个非必需的选项可以控制生成的ini文件的格式:

usage: setuptools-py2cfg.py [-h] [-t int] [-i int] [-a] [path]

converts an existing setup.py file to a setup.cfg in the format expected by
setuptools

positional arguments:
  path                  path to setup.py file (default: ./setup.py)

optional arguments:
  -h, --help            show this help message and exit
  -t int, --dangling-list-threshold int
                        lists longer than this many characters are converted
                        to a dangling list (default: 40)
  -i int, --dangling-list-indent int
                        number of spaces to use when indenting dangling lists
                        (default: 4)
  -a, --always-use-dangling-lists
                        use dangling lists everywhere (default: False)

请记住,setup.py文件只需调用 ^将所有元数据迁移到setup.cfg后仍需要{tt10}$。

安装

最新稳定版本的setuptools-py2cfg可以从pypi安装:

$ pip install setuptools-py2cfg

待办事项

  • 以ini格式处理entry_scripts
  • 写一两个测试。

许可证

根据Revised BSD License条款发布。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android Studio:我的短信应用程序不是默认短信应用程序的选项之一   java处理字符串问题   java为什么我的程序打印“null”而不是字符串?   java为什么要创建一个无限循环?   java循环在一段时间后将布尔值更改为false?   java Android Rest Api Post 400错误请求   java调用另一个方法以获取resultset并正确关闭连接?   java我想在2d数组中添加一行   Java:我需要从outputstream中获取字节数组   C语言中Java元注释的等价物#   java如何在从web下载图像时保持原始图像的dpi?   java中基于输入值的spring boot动态值   java从请求中获取主机名   java可以复制Swing代码并在intelliJ中的designer中查看它吗   spring如何使用java配置多个ldap   安卓如何在Java中使用具有多个类似参数的JSON请求/响应循环?   java LIbGDX如何在语言更改时翻译所有文本?