【问题标题】:Can I use attr: in description field of metadata in setup.cfg?我可以在 setup.cfg 的元数据描述字段中使用 attr: 吗?
【发布时间】:2021-04-04 06:43:03
【问题描述】:

我尝试在描述中使用 attr:,但 PyPi 显示 attr: round_utils.__doc__ 而不是该表达式的值。

文档说我不能在描述中使用attr:。查看元数据表(下面的链接): https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#metadata

但我在这里做过这样的事情:https://github.com/zifter/numeral-system-py,因为我看到包描述在 PyPi https://pypi.org/project/numeral-system-py/ 中有效。

附加我的文件和链接:

setup.cfg

[metadata]
name = round-utils
version = 1.0.4
author = Marchenko Ilya
author_email = mrmar333@yandex.ru
home-page = https://github.com/IliyaZinoviev/round-utils.git
description = attr: round_utils.__doc__
license = MIT
license-file = LICENSE
platform = any
keywords = round, utils, number
classifiers =
    Intended Audience :: Developers
    License :: OSI Approved :: MIT License
    Programming Language :: Python
    Programming Language :: Python :: 3.8
    Operating System :: OS Independent

[options]
zip_safe = false
include_package_data = true
python_requires = >= 3.8
package_dir =
    round_utils=source/round_utils
    tests=source/tests
packages =
    round_utils
test_suite = tests
setup_requires =
    setuptools >=30.3.0     # minimal version for `setup.cfg`

[bdist_wheel]
universal = true

[check]
metadata = true
strict = true

[sdist]
formats = gztar

round_utils.__init__py

"""Package for rounding functions"""

from .round import round_up, round_down

__all__ = [
    'round_up',
    'round_down'
]

PyPi 链接:https://test.pypi.org/project/round-utils/

Github 仓库:https://github.com/IliyaZinoviev/round-utils

【问题讨论】:

  • 我认为你不能拥有setup_requires = setuptools >=30.3.0 。这可能不会产生预期的效果(我不确定)。现在最好使用pyproject.toml 来执行此操作。
  • @sinoroc,谢谢你的回答。我会试试的
  • 查看 setuptools 当前代码,description 似乎不支持 attr:。我不确定它是否真的在你提到的作为参考的其他项目中起作用,因为他们没有任何版本,因为他们 changed 那个 description 配置使用 attr:
  • @sinoroc,你完全正确!再次感谢你!我检查了最后一个软件包版本,它有同样的问题。 test.pypi.org/project/numeral-system-py/0.2.1a0

标签: setuptools setup.py pypi python-packaging


【解决方案1】:

不,您不能将attr: 用于setuptools'setup.cfgdescription 配置值。从 setuptools 51.1.0(今天的最新版本)开始,不支持它。您作为参考链接到的项目尚未发布,因为他们changed (错误地)使用attr: 作为他们的description,并且可以看出here 它似乎不起作用(如预期的那样) .

【讨论】:

    猜你喜欢
    • 2020-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-15
    • 2010-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多