如何在setup.cfg中设置entry_points

时间:2018-02-20 11:56:55

标签: python python-3.x python-3.6 setuptools

我正在将我的配置从setup.py移动到setup.cfg并且在设置entry_points参数时遇到问题,有人可以告诉我什么是正确的语法?目前我正在使用混合方法,但是,我想将entry_points移动到setup.cfg。

来自

def setup_package():
setup(version=get_version(), entry_points={'console_scripts':['app=my_package.app.run:cli'],})

[metadata]
name = my-package
description = my-package
license = unlicensed
long-description = README.md
platforms = any
classifiers =
  Programming Language :: Python

[options]
zip_safe = False
packages = my_package,  my_package.app
include_package_data = True
package_dir =
  = .
tests_require = pytest; pytest-cov

[entry_points]
console_scripts =
  my-package = my_package.app.run:cli

由于

2 个答案:

答案 0 :(得分:10)

该部分必须为true。请参阅https://github.com/github/octodns/blob/4b44ab14b1f0a52f1051c67656d6e3dd6f0ba903/setup.cfg#L34

上的示例
[options.entry_points]

答案 1 :(得分:-3)

使用python 3.6和setuptools 39.0.1,我希望您将入口点从.py移动到.cfg

我的setup.py,专注于入口点声明:

from setuptools import setup

setup(
    entry_points={
        'pytest11': [
            'mytest = mytest.plugin',
        ],
    },
)

我最终完成了这项工作setup.cfg

... # other standard declarations

[options.entry_points]
pytest11 =
    mytest = mytest.plugin