pypa / pypa/setuptools

[FR] Accept dynamic description to come from an attribute.

Open
#3,848 4 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

What's the problem this feature will solve?

It would make it possible to keep the package description in sync with the package docstring.

Describe the solution you'd like

I propose to accept the following directives:

setup.cfg

description = attr: mypackage.__doc__

pyproject.toml

[tool.setuptools.dynamic]
description = {attr = "mypackage.__doc__"}
Alternative Solutions

The current option is either to rely on setup.py or to manually keep the __doc__ and description in sync which is prone to error.

Additional context

I think this feature would be fairly easy to implement, as it is mostly a copy-paste from version. I tried to implement it myself, but I did not find what to do with the generated _validate_pyproject code.

Moreover, this feature is found in flit.

Code of Conduct
  • I agree to follow the PSF Code of Conduct

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing version handling with the generated _validate_pyproject code, using the setup.cfg and pyproject.toml examples in the issue as the target configuration forms. Done means accepting description values from package attributes in both formats and validating the new pyproject.toml syntax consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.