Adding docstrings to classes created with `make_class`

Open
#1,309 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start with the make_class entry point and inspect how dynamically created classes are documented and tested. Determine whether docstring input should be supported, then consider the issue complete when a class created through make_class can expose the requested docstring with coverage for that behavior.

Written by the indexing model from the issue text.

Description

Feature

Hi there, I might have missed something. If I have my apologies.

My question is pretty basic: is there a way to add a docstring to class created with make_class? For example

from attrs import define

@define
class D:
    """
    Docstring
    """

# Prints out the docstring above
print(D.__doc__)

C = make_class("C", ["a", "b"])

# Prints None, which makes it seem like the docstring is unset.
# Is there a way to have the docstring be set when a class is created
# via `make_class`?
print(C.__doc__)

Thanks for any help

Dominant language
Python
Stars
5.8k
Forks
480
Avg merge
2h 15m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

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.

More from python-attrs/attrs

All issues in python-attrs/attrs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.