METADATA 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. Metadata-Version: 2.1
  2. Name: attrs
  3. Version: 21.2.0
  4. Summary: Classes Without Boilerplate
  5. Home-page: https://www.attrs.org/
  6. Author: Hynek Schlawack
  7. Author-email: hs@ox.cx
  8. Maintainer: Hynek Schlawack
  9. Maintainer-email: hs@ox.cx
  10. License: MIT
  11. Project-URL: Documentation, https://www.attrs.org/
  12. Project-URL: Changelog, https://www.attrs.org/en/stable/changelog.html
  13. Project-URL: Bug Tracker, https://github.com/python-attrs/attrs/issues
  14. Project-URL: Source Code, https://github.com/python-attrs/attrs
  15. Project-URL: Funding, https://github.com/sponsors/hynek
  16. Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=pypi
  17. Project-URL: Ko-fi, https://ko-fi.com/the_hynek
  18. Keywords: class,attribute,boilerplate
  19. Platform: UNKNOWN
  20. Classifier: Development Status :: 5 - Production/Stable
  21. Classifier: Intended Audience :: Developers
  22. Classifier: Natural Language :: English
  23. Classifier: License :: OSI Approved :: MIT License
  24. Classifier: Operating System :: OS Independent
  25. Classifier: Programming Language :: Python
  26. Classifier: Programming Language :: Python :: 2
  27. Classifier: Programming Language :: Python :: 2.7
  28. Classifier: Programming Language :: Python :: 3
  29. Classifier: Programming Language :: Python :: 3.5
  30. Classifier: Programming Language :: Python :: 3.6
  31. Classifier: Programming Language :: Python :: 3.7
  32. Classifier: Programming Language :: Python :: 3.8
  33. Classifier: Programming Language :: Python :: 3.9
  34. Classifier: Programming Language :: Python :: 3.10
  35. Classifier: Programming Language :: Python :: Implementation :: CPython
  36. Classifier: Programming Language :: Python :: Implementation :: PyPy
  37. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  38. Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
  39. Description-Content-Type: text/x-rst
  40. Provides-Extra: dev
  41. Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'dev'
  42. Requires-Dist: hypothesis ; extra == 'dev'
  43. Requires-Dist: pympler ; extra == 'dev'
  44. Requires-Dist: pytest (>=4.3.0) ; extra == 'dev'
  45. Requires-Dist: six ; extra == 'dev'
  46. Requires-Dist: mypy ; extra == 'dev'
  47. Requires-Dist: pytest-mypy-plugins ; extra == 'dev'
  48. Requires-Dist: zope.interface ; extra == 'dev'
  49. Requires-Dist: furo ; extra == 'dev'
  50. Requires-Dist: sphinx ; extra == 'dev'
  51. Requires-Dist: sphinx-notfound-page ; extra == 'dev'
  52. Requires-Dist: pre-commit ; extra == 'dev'
  53. Provides-Extra: docs
  54. Requires-Dist: furo ; extra == 'docs'
  55. Requires-Dist: sphinx ; extra == 'docs'
  56. Requires-Dist: zope.interface ; extra == 'docs'
  57. Requires-Dist: sphinx-notfound-page ; extra == 'docs'
  58. Provides-Extra: tests
  59. Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'tests'
  60. Requires-Dist: hypothesis ; extra == 'tests'
  61. Requires-Dist: pympler ; extra == 'tests'
  62. Requires-Dist: pytest (>=4.3.0) ; extra == 'tests'
  63. Requires-Dist: six ; extra == 'tests'
  64. Requires-Dist: mypy ; extra == 'tests'
  65. Requires-Dist: pytest-mypy-plugins ; extra == 'tests'
  66. Requires-Dist: zope.interface ; extra == 'tests'
  67. Provides-Extra: tests_no_zope
  68. Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'tests_no_zope'
  69. Requires-Dist: hypothesis ; extra == 'tests_no_zope'
  70. Requires-Dist: pympler ; extra == 'tests_no_zope'
  71. Requires-Dist: pytest (>=4.3.0) ; extra == 'tests_no_zope'
  72. Requires-Dist: six ; extra == 'tests_no_zope'
  73. Requires-Dist: mypy ; extra == 'tests_no_zope'
  74. Requires-Dist: pytest-mypy-plugins ; extra == 'tests_no_zope'
  75. ======================================
  76. ``attrs``: Classes Without Boilerplate
  77. ======================================
  78. ``attrs`` is the Python package that will bring back the **joy** of **writing classes** by relieving you from the drudgery of implementing object protocols (aka `dunder <https://nedbatchelder.com/blog/200605/dunder.html>`_ methods).
  79. `Trusted by NASA <https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/personalizing-your-profile#list-of-qualifying-repositories-for-mars-2020-helicopter-contributor-badge>`_ for Mars missions since 2020!
  80. Its main goal is to help you to write **concise** and **correct** software without slowing down your code.
  81. .. teaser-end
  82. For that, it gives you a class decorator and a way to declaratively define the attributes on that class:
  83. .. -code-begin-
  84. .. code-block:: pycon
  85. >>> import attr
  86. >>> @attr.s
  87. ... class SomeClass(object):
  88. ... a_number = attr.ib(default=42)
  89. ... list_of_numbers = attr.ib(factory=list)
  90. ...
  91. ... def hard_math(self, another_number):
  92. ... return self.a_number + sum(self.list_of_numbers) * another_number
  93. >>> sc = SomeClass(1, [1, 2, 3])
  94. >>> sc
  95. SomeClass(a_number=1, list_of_numbers=[1, 2, 3])
  96. >>> sc.hard_math(3)
  97. 19
  98. >>> sc == SomeClass(1, [1, 2, 3])
  99. True
  100. >>> sc != SomeClass(2, [3, 2, 1])
  101. True
  102. >>> attr.asdict(sc)
  103. {'a_number': 1, 'list_of_numbers': [1, 2, 3]}
  104. >>> SomeClass()
  105. SomeClass(a_number=42, list_of_numbers=[])
  106. >>> C = attr.make_class("C", ["a", "b"])
  107. >>> C("foo", "bar")
  108. C(a='foo', b='bar')
  109. After *declaring* your attributes ``attrs`` gives you:
  110. - a concise and explicit overview of the class's attributes,
  111. - a nice human-readable ``__repr__``,
  112. - a complete set of comparison methods (equality and ordering),
  113. - an initializer,
  114. - and much more,
  115. *without* writing dull boilerplate code again and again and *without* runtime performance penalties.
  116. On Python 3.6 and later, you can often even drop the calls to ``attr.ib()`` by using `type annotations <https://www.attrs.org/en/latest/types.html>`_.
  117. This gives you the power to use actual classes with actual types in your code instead of confusing ``tuple``\ s or `confusingly behaving <https://www.attrs.org/en/stable/why.html#namedtuples>`_ ``namedtuple``\ s.
  118. Which in turn encourages you to write *small classes* that do `one thing well <https://www.destroyallsoftware.com/talks/boundaries>`_.
  119. Never again violate the `single responsibility principle <https://en.wikipedia.org/wiki/Single_responsibility_principle>`_ just because implementing ``__init__`` et al is a painful drag.
  120. .. -getting-help-
  121. Getting Help
  122. ============
  123. Please use the ``python-attrs`` tag on `StackOverflow <https://stackoverflow.com/questions/tagged/python-attrs>`_ to get help.
  124. Answering questions of your fellow developers is also a great way to help the project!
  125. .. -project-information-
  126. Project Information
  127. ===================
  128. ``attrs`` is released under the `MIT <https://choosealicense.com/licenses/mit/>`_ license,
  129. its documentation lives at `Read the Docs <https://www.attrs.org/>`_,
  130. the code on `GitHub <https://github.com/python-attrs/attrs>`_,
  131. and the latest release on `PyPI <https://pypi.org/project/attrs/>`_.
  132. It’s rigorously tested on Python 2.7, 3.5+, and PyPy.
  133. We collect information on **third-party extensions** in our `wiki <https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs>`_.
  134. Feel free to browse and add your own!
  135. If you'd like to contribute to ``attrs`` you're most welcome and we've written `a little guide <https://www.attrs.org/en/latest/contributing.html>`_ to get you started!
  136. ``attrs`` for Enterprise
  137. ------------------------
  138. Available as part of the Tidelift Subscription.
  139. The maintainers of ``attrs`` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications.
  140. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
  141. `Learn more. <https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo>`_
  142. Release Information
  143. ===================
  144. 21.2.0 (2021-05-07)
  145. -------------------
  146. Backward-incompatible Changes
  147. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  148. - We had to revert the recursive feature for ``attr.evolve()`` because it broke some use-cases -- sorry!
  149. `#806 <https://github.com/python-attrs/attrs/issues/806>`_
  150. - Python 3.4 is now blocked using packaging metadata because ``attrs`` can't be imported on it anymore.
  151. To ensure that 3.4 users can keep installing ``attrs`` easily, we will `yank <https://pypi.org/help/#yanked>`_ 21.1.0 from PyPI.
  152. This has **no** consequences if you pin ``attrs`` to 21.1.0.
  153. `#807 <https://github.com/python-attrs/attrs/issues/807>`_
  154. `Full changelog <https://www.attrs.org/en/stable/changelog.html>`_.
  155. Credits
  156. =======
  157. ``attrs`` is written and maintained by `Hynek Schlawack <https://hynek.me/>`_.
  158. The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_.
  159. A full list of contributors can be found in `GitHub's overview <https://github.com/python-attrs/attrs/graphs/contributors>`_.
  160. It’s the spiritual successor of `characteristic <https://characteristic.readthedocs.io/>`_ and aspires to fix some of it clunkiness and unfortunate decisions.
  161. Both were inspired by Twisted’s `FancyEqMixin <https://twistedmatrix.com/documents/current/api/twisted.python.util.FancyEqMixin.html>`_ but both are implemented using class decorators because `subclassing is bad for you <https://www.youtube.com/watch?v=3MNVP9-hglc>`_, m’kay?