METADATA 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. Metadata-Version: 2.1
  2. Name: attrs
  3. Version: 21.4.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. License-File: LICENSE
  41. License-File: AUTHORS.rst
  42. Provides-Extra: dev
  43. Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'dev'
  44. Requires-Dist: hypothesis ; extra == 'dev'
  45. Requires-Dist: pympler ; extra == 'dev'
  46. Requires-Dist: pytest (>=4.3.0) ; extra == 'dev'
  47. Requires-Dist: six ; extra == 'dev'
  48. Requires-Dist: mypy ; extra == 'dev'
  49. Requires-Dist: pytest-mypy-plugins ; extra == 'dev'
  50. Requires-Dist: zope.interface ; extra == 'dev'
  51. Requires-Dist: furo ; extra == 'dev'
  52. Requires-Dist: sphinx ; extra == 'dev'
  53. Requires-Dist: sphinx-notfound-page ; extra == 'dev'
  54. Requires-Dist: pre-commit ; extra == 'dev'
  55. Requires-Dist: cloudpickle ; (platform_python_implementation == "CPython") and extra == 'dev'
  56. Provides-Extra: docs
  57. Requires-Dist: furo ; extra == 'docs'
  58. Requires-Dist: sphinx ; extra == 'docs'
  59. Requires-Dist: zope.interface ; extra == 'docs'
  60. Requires-Dist: sphinx-notfound-page ; extra == 'docs'
  61. Provides-Extra: tests
  62. Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'tests'
  63. Requires-Dist: hypothesis ; extra == 'tests'
  64. Requires-Dist: pympler ; extra == 'tests'
  65. Requires-Dist: pytest (>=4.3.0) ; extra == 'tests'
  66. Requires-Dist: six ; extra == 'tests'
  67. Requires-Dist: mypy ; extra == 'tests'
  68. Requires-Dist: pytest-mypy-plugins ; extra == 'tests'
  69. Requires-Dist: zope.interface ; extra == 'tests'
  70. Requires-Dist: cloudpickle ; (platform_python_implementation == "CPython") and extra == 'tests'
  71. Provides-Extra: tests_no_zope
  72. Requires-Dist: coverage[toml] (>=5.0.2) ; extra == 'tests_no_zope'
  73. Requires-Dist: hypothesis ; extra == 'tests_no_zope'
  74. Requires-Dist: pympler ; extra == 'tests_no_zope'
  75. Requires-Dist: pytest (>=4.3.0) ; extra == 'tests_no_zope'
  76. Requires-Dist: six ; extra == 'tests_no_zope'
  77. Requires-Dist: mypy ; extra == 'tests_no_zope'
  78. Requires-Dist: pytest-mypy-plugins ; extra == 'tests_no_zope'
  79. Requires-Dist: cloudpickle ; (platform_python_implementation == "CPython") and extra == 'tests_no_zope'
  80. .. image:: https://www.attrs.org/en/stable/_static/attrs_logo.png
  81. :alt: attrs logo
  82. :align: center
  83. ``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 methods <https://www.attrs.org/en/latest/glossary.html#term-dunder-methods>`_).
  84. `Trusted by NASA <https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/personalizing-your-profile#list-of-qualifying-repositories-for-mars-2020-helicopter-contributor-badge>`_ for Mars missions since 2020!
  85. Its main goal is to help you to write **concise** and **correct** software without slowing down your code.
  86. .. teaser-end
  87. For that, it gives you a class decorator and a way to declaratively define the attributes on that class:
  88. .. -code-begin-
  89. .. code-block:: pycon
  90. >>> from attrs import asdict, define, make_class, Factory
  91. >>> @define
  92. ... class SomeClass:
  93. ... a_number: int = 42
  94. ... list_of_numbers: list[int] = Factory(list)
  95. ...
  96. ... def hard_math(self, another_number):
  97. ... return self.a_number + sum(self.list_of_numbers) * another_number
  98. >>> sc = SomeClass(1, [1, 2, 3])
  99. >>> sc
  100. SomeClass(a_number=1, list_of_numbers=[1, 2, 3])
  101. >>> sc.hard_math(3)
  102. 19
  103. >>> sc == SomeClass(1, [1, 2, 3])
  104. True
  105. >>> sc != SomeClass(2, [3, 2, 1])
  106. True
  107. >>> asdict(sc)
  108. {'a_number': 1, 'list_of_numbers': [1, 2, 3]}
  109. >>> SomeClass()
  110. SomeClass(a_number=42, list_of_numbers=[])
  111. >>> C = make_class("C", ["a", "b"])
  112. >>> C("foo", "bar")
  113. C(a='foo', b='bar')
  114. After *declaring* your attributes ``attrs`` gives you:
  115. - a concise and explicit overview of the class's attributes,
  116. - a nice human-readable ``__repr__``,
  117. - a equality-checking methods,
  118. - an initializer,
  119. - and much more,
  120. *without* writing dull boilerplate code again and again and *without* runtime performance penalties.
  121. **Hate type annotations**!?
  122. No problem!
  123. Types are entirely **optional** with ``attrs``.
  124. Simply assign ``attrs.field()`` to the attributes instead of annotating them with types.
  125. ----
  126. This example uses ``attrs``'s modern APIs that have been introduced in version 20.1.0, and the ``attrs`` package import name that has been added in version 21.3.0.
  127. The classic APIs (``@attr.s``, ``attr.ib``, plus their serious business aliases) and the ``attr`` package import name will remain **indefinitely**.
  128. Please check out `On The Core API Names <https://www.attrs.org/en/latest/names.html>`_ for a more in-depth explanation.
  129. Data Classes
  130. ============
  131. On the tin, ``attrs`` might remind you of ``dataclasses`` (and indeed, ``dataclasses`` are a descendant of ``attrs``).
  132. In practice it does a lot more and is more flexible.
  133. For instance it allows you to define `special handling of NumPy arrays for equality checks <https://www.attrs.org/en/stable/comparison.html#customization>`_, or allows more ways to `plug into the initialization process <https://www.attrs.org/en/stable/init.html#hooking-yourself-into-initialization>`_.
  134. For more details, please refer to our `comparison page <https://www.attrs.org/en/stable/why.html#data-classes>`_.
  135. .. -getting-help-
  136. Getting Help
  137. ============
  138. Please use the ``python-attrs`` tag on `Stack Overflow <https://stackoverflow.com/questions/tagged/python-attrs>`_ to get help.
  139. Answering questions of your fellow developers is also a great way to help the project!
  140. .. -project-information-
  141. Project Information
  142. ===================
  143. ``attrs`` is released under the `MIT <https://choosealicense.com/licenses/mit/>`_ license,
  144. its documentation lives at `Read the Docs <https://www.attrs.org/>`_,
  145. the code on `GitHub <https://github.com/python-attrs/attrs>`_,
  146. and the latest release on `PyPI <https://pypi.org/project/attrs/>`_.
  147. It’s rigorously tested on Python 2.7, 3.5+, and PyPy.
  148. We collect information on **third-party extensions** in our `wiki <https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs>`_.
  149. Feel free to browse and add your own!
  150. If you'd like to contribute to ``attrs`` you're most welcome and we've written `a little guide <https://github.com/python-attrs/attrs/blob/main/.github/CONTRIBUTING.md>`_ to get you started!
  151. ``attrs`` for Enterprise
  152. ------------------------
  153. Available as part of the Tidelift Subscription.
  154. 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.
  155. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
  156. `Learn more. <https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo>`_
  157. Release Information
  158. ===================
  159. 21.4.0 (2021-12-29)
  160. -------------------
  161. Changes
  162. ^^^^^^^
  163. - Fixed the test suite on PyPy3.8 where ``cloudpickle`` does not work.
  164. `#892 <https://github.com/python-attrs/attrs/issues/892>`_
  165. - Fixed ``coverage report`` for projects that use ``attrs`` and don't set a ``--source``.
  166. `#895 <https://github.com/python-attrs/attrs/issues/895>`_,
  167. `#896 <https://github.com/python-attrs/attrs/issues/896>`_
  168. `Full changelog <https://www.attrs.org/en/stable/changelog.html>`_.
  169. Credits
  170. =======
  171. ``attrs`` is written and maintained by `Hynek Schlawack <https://hynek.me/>`_.
  172. The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_.
  173. A full list of contributors can be found in `GitHub's overview <https://github.com/python-attrs/attrs/graphs/contributors>`_.
  174. It’s the spiritual successor of `characteristic <https://characteristic.readthedocs.io/>`_ and aspires to fix some of it clunkiness and unfortunate decisions.
  175. 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?