Skip to content

fields needs to be imported in examples#921

Merged
hynek merged 2 commits intopython-attrs:mainfrom
chsachs:patch-1
Mar 14, 2022
Merged

fields needs to be imported in examples#921
hynek merged 2 commits intopython-attrs:mainfrom
chsachs:patch-1

Conversation

@chsachs
Copy link
Copy Markdown
Contributor

@chsachs chsachs commented Feb 3, 2022

neither attrs as a whole nor field is imported from attrs. Therefore the example using field does not work if one goes through the examples step by step. either import fields from the beginning (as suggested) or in the example using fields.

Summary

Pull Request Check List

  • Added tests for changed code.
    Our CI fails if coverage is not 100%.
  • New features have been added to our Hypothesis testing strategy.
  • Changes or additions to public APIs are reflected in our type stubs (files ending in .pyi).
    • ...and used in the stub test file tests/typing_example.py.
    • If they've been added to attr/__init__.pyi, they've also been re-imported in attrs/__init__.pyi.
  • Updated documentation for changed code.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changes to the signature of @attr.s() have to be added by hand too.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      Find the appropriate next version in our __init__.py file.
  • Documentation in .rst files is written using semantic newlines.
  • Changes (and possible deprecations) have news fragments in changelog.d.
  • Consider granting push permissions to the PR branch, so maintainers can fix minor issues themselves without pestering you.

neither attrs as a whole nor field is imported from attrs. Therefore the example using field does not work if one goes through the examples step by step. either import fields from the beginning (as suggested) or in the example using fields.
@Tinche
Copy link
Copy Markdown
Member

Tinche commented Feb 3, 2022

I would prefer if you imported field when it's used for the first time. Think it keeps the flow better.

@hynek
Copy link
Copy Markdown
Member

hynek commented Mar 14, 2022

I would prefer if you imported field when it's used for the first time. Think it keeps the flow better.

I 100% agree in general, but I think it's fair enough to import the two most important functions at once.

@hynek hynek enabled auto-merge (squash) March 14, 2022 14:48
@hynek hynek merged commit 5c040f3 into python-attrs:main Mar 14, 2022
@hynek
Copy link
Copy Markdown
Member

hynek commented Mar 14, 2022

Thanks!

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.

3 participants