Skip to content

docs: use modern field API in 'boilerplate' section.#1535

Merged
hynek merged 4 commits intopython-attrs:mainfrom
carltongibson:docs-updates
Mar 27, 2026
Merged

docs: use modern field API in 'boilerplate' section.#1535
hynek merged 4 commits intopython-attrs:mainfrom
carltongibson:docs-updates

Conversation

@carltongibson
Copy link
Copy Markdown
Contributor

Summary

Updates the text in the How does it work -> boilerplate section to use field rather than attr.ib.

Pull Request Check List

  • I acknowledge this project's AI policy.
  • This pull requests is not from my main branch.
  • There's tests for all new and changed code.
  • Changes or additions to public APIs are reflected in our type stubs (files ending in .pyi).
    • ...and used in the stub test file typing-examples/baseline.py or, if necessary, typing-examples/mypy.py.
    • If they've been added to attr/__init__.pyi, they've also been re-imported in attrs/__init__.pyi.
  • The documentation has been updated.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changes to the signatures of @attr.s() and @attrs.define() have to be added by hand too.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      The next version is the second number in the current release + 1.
      The first number represents the current year.
      So if the current version on PyPI is 26.2.0, the next version is gonna be 26.3.0.
      If the next version is the first in the new year, it'll be 27.1.0.
    • Documentation in .rst and .md files is written using semantic newlines.
  • Changes have news fragments in changelog.d.

Not sure if it needs a news item. I didn't add one (because likely not) but I didn't want to just tick it.

@hynek
Copy link
Copy Markdown
Member

hynek commented Mar 27, 2026

huh, that's really old and outdated since it ignores type annotations! I guess the sentence should go: searches the class object for type annotations and instances of `attrs.field`s.??

The second sentence is sadly still correct because I didn't dear to remove the counting logic because it would 100% break some code bases.

@carltongibson
Copy link
Copy Markdown
Contributor Author

Like 3f891cf? (Can squash if you like)

@hynek hynek enabled auto-merge March 27, 2026 10:12
@hynek hynek added this pull request to the merge queue Mar 27, 2026
Merged via the queue into python-attrs:main with commit 4885c5b Mar 27, 2026
17 checks passed
@carltongibson carltongibson deleted the docs-updates branch March 27, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants