如何在 setup.cfg 中设置 entry_points [英] How to setup entry_points in setup.cfg

查看:81
本文介绍了如何在 setup.cfg 中设置 entry_points的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am moving my config from setup.py to setup.cfg and having issues setting up the entry_points param, could some tell me what is the correct syntax? At the moment I am using a hybrid approach which works, however, I would like to move the entry_points to 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

谢谢

推荐答案

该部分必须是 [options.entry_points].请参阅 https://github.com/github/octodns/blob 中的示例/4b44ab14b1f0a52f1051c67656d6e3dd6f0ba903/setup.cfg#L34

The section must be [options.entry_points]. See an example at https://github.com/github/octodns/blob/4b44ab14b1f0a52f1051c67656d6e3dd6f0ba903/setup.cfg#L34

[options.entry_points]
console_scripts =
    octodns-compare = octodns.cmds.compare:main
    octodns-dump = octodns.cmds.dump:main
    octodns-report = octodns.cmds.report:main
    octodns-sync = octodns.cmds.sync:main
    octodns-validate = octodns.cmds.validate:main

这篇关于如何在 setup.cfg 中设置 entry_points的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆