Search code examples
setuptoolssetup.pypypipython-packaging

Can I use attr: in description field of metadata in setup.cfg?


I try to use attr: in description but PyPi dispays attr: round_utils.__doc__ instead of value of that expression.

Docs says I cannot use attr: in description. Look at the Metadata table (link below): https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#metadata

But I had done like here: https://github.com/zifter/numeral-system-py, because I saw the package description works in PyPi https://pypi.org/project/numeral-system-py/.

Attaching my files and links:

setup.cfg

[metadata]
name = round-utils
version = 1.0.4
author = Marchenko Ilya
author_email = [email protected]
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 link: https://test.pypi.org/project/round-utils/

Github repo: https://github.com/IliyaZinoviev/round-utils


Solution

  • No, you can't use attr: for the description configuration value of setuptools' setup.cfg. As of setuptools 51.1.0 (today's newest version), it is not supported. The project you linked to as a reference has not seen a release since they changed to (incorrectly) using attr: for their description, and as can be seen here it does not seem to work (as expected).