METADATA 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. Metadata-Version: 2.1
  2. Name: attrs
  3. Version: 18.1.0
  4. Summary: Classes Without Boilerplate
  5. Home-page: http://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. Keywords: class,attribute,boilerplate
  12. Platform: UNKNOWN
  13. Classifier: Development Status :: 5 - Production/Stable
  14. Classifier: Intended Audience :: Developers
  15. Classifier: Natural Language :: English
  16. Classifier: License :: OSI Approved :: MIT License
  17. Classifier: Operating System :: OS Independent
  18. Classifier: Programming Language :: Python
  19. Classifier: Programming Language :: Python :: 2
  20. Classifier: Programming Language :: Python :: 2.7
  21. Classifier: Programming Language :: Python :: 3
  22. Classifier: Programming Language :: Python :: 3.4
  23. Classifier: Programming Language :: Python :: 3.5
  24. Classifier: Programming Language :: Python :: 3.6
  25. Classifier: Programming Language :: Python :: 3.7
  26. Classifier: Programming Language :: Python :: Implementation :: CPython
  27. Classifier: Programming Language :: Python :: Implementation :: PyPy
  28. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  29. Provides-Extra: tests
  30. Provides-Extra: docs
  31. Provides-Extra: dev
  32. Provides-Extra: dev
  33. Requires-Dist: coverage; extra == 'dev'
  34. Requires-Dist: hypothesis; extra == 'dev'
  35. Requires-Dist: pympler; extra == 'dev'
  36. Requires-Dist: pytest; extra == 'dev'
  37. Requires-Dist: six; extra == 'dev'
  38. Requires-Dist: zope.interface; extra == 'dev'
  39. Requires-Dist: sphinx; extra == 'dev'
  40. Requires-Dist: zope.interface; extra == 'dev'
  41. Provides-Extra: docs
  42. Requires-Dist: sphinx; extra == 'docs'
  43. Requires-Dist: zope.interface; extra == 'docs'
  44. Provides-Extra: tests
  45. Requires-Dist: coverage; extra == 'tests'
  46. Requires-Dist: hypothesis; extra == 'tests'
  47. Requires-Dist: pympler; extra == 'tests'
  48. Requires-Dist: pytest; extra == 'tests'
  49. Requires-Dist: six; extra == 'tests'
  50. Requires-Dist: zope.interface; extra == 'tests'
  51. .. image:: http://www.attrs.org/en/latest/_static/attrs_logo.png
  52. :alt: attrs Logo
  53. ======================================
  54. ``attrs``: Classes Without Boilerplate
  55. ======================================
  56. .. image:: https://readthedocs.org/projects/attrs/badge/?version=stable
  57. :target: http://www.attrs.org/en/stable/?badge=stable
  58. :alt: Documentation Status
  59. .. image:: https://travis-ci.org/python-attrs/attrs.svg?branch=master
  60. :target: https://travis-ci.org/python-attrs/attrs
  61. :alt: CI Status
  62. .. image:: https://codecov.io/github/python-attrs/attrs/branch/master/graph/badge.svg
  63. :target: https://codecov.io/github/python-attrs/attrs
  64. :alt: Test Coverage
  65. .. teaser-begin
  66. ``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).
  67. Its main goal is to help you to write **concise** and **correct** software without slowing down your code.
  68. .. -spiel-end-
  69. For that, it gives you a class decorator and a way to declaratively define the attributes on that class:
  70. .. -code-begin-
  71. .. code-block:: pycon
  72. >>> import attr
  73. >>> @attr.s
  74. ... class SomeClass(object):
  75. ... a_number = attr.ib(default=42)
  76. ... list_of_numbers = attr.ib(default=attr.Factory(list))
  77. ...
  78. ... def hard_math(self, another_number):
  79. ... return self.a_number + sum(self.list_of_numbers) * another_number
  80. >>> sc = SomeClass(1, [1, 2, 3])
  81. >>> sc
  82. SomeClass(a_number=1, list_of_numbers=[1, 2, 3])
  83. >>> sc.hard_math(3)
  84. 19
  85. >>> sc == SomeClass(1, [1, 2, 3])
  86. True
  87. >>> sc != SomeClass(2, [3, 2, 1])
  88. True
  89. >>> attr.asdict(sc)
  90. {'a_number': 1, 'list_of_numbers': [1, 2, 3]}
  91. >>> SomeClass()
  92. SomeClass(a_number=42, list_of_numbers=[])
  93. >>> C = attr.make_class("C", ["a", "b"])
  94. >>> C("foo", "bar")
  95. C(a='foo', b='bar')
  96. After *declaring* your attributes ``attrs`` gives you:
  97. - a concise and explicit overview of the class's attributes,
  98. - a nice human-readable ``__repr__``,
  99. - a complete set of comparison methods,
  100. - an initializer,
  101. - and much more,
  102. *without* writing dull boilerplate code again and again and *without* runtime performance penalties.
  103. This gives you the power to use actual classes with actual types in your code instead of confusing ``tuple``\ s or `confusingly behaving <http://www.attrs.org/en/stable/why.html#namedtuples>`_ ``namedtuple``\ s.
  104. Which in turn encourages you to write *small classes* that do `one thing well <https://www.destroyallsoftware.com/talks/boundaries>`_.
  105. 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.
  106. .. -testimonials-
  107. Testimonials
  108. ============
  109. **Amber Hawkie Brown**, Twisted Release Manager and Computer Owl:
  110. Writing a fully-functional class using attrs takes me less time than writing this testimonial.
  111. **Glyph Lefkowitz**, creator of `Twisted <https://twistedmatrix.com/>`_, `Automat <https://pypi.python.org/pypi/Automat>`_, and other open source software, in `The One Python Library Everyone Needs <https://glyph.twistedmatrix.com/2016/08/attrs.html>`_:
  112. I’m looking forward to is being able to program in Python-with-attrs everywhere.
  113. It exerts a subtle, but positive, design influence in all the codebases I’ve see it used in.
  114. **Kenneth Reitz**, author of `requests <http://www.python-requests.org/>`_, Python Overlord at Heroku, `on paper no less <https://twitter.com/hynek/status/866817877650751488>`_:
  115. attrs—classes for humans. I like it.
  116. **Łukasz Langa**, prolific CPython core developer and Production Engineer at Facebook:
  117. I'm increasingly digging your attr.ocity. Good job!
  118. .. -end-
  119. .. -project-information-
  120. Getting Help
  121. ============
  122. Please use the ``python-attrs`` tag on `StackOverflow <https://stackoverflow.com/questions/tagged/python-attrs>`_ to get help.
  123. Answering questions of your fellow developers is also great way to help the project!
  124. Project Information
  125. ===================
  126. ``attrs`` is released under the `MIT <https://choosealicense.com/licenses/mit/>`_ license,
  127. its documentation lives at `Read the Docs <http://www.attrs.org/>`_,
  128. the code on `GitHub <https://github.com/python-attrs/attrs>`_,
  129. and the latest release on `PyPI <https://pypi.org/project/attrs/>`_.
  130. It’s rigorously tested on Python 2.7, 3.4+, and PyPy.
  131. We collect information on **third-party extensions** in our `wiki <https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs>`_.
  132. Feel free to browse and add your own!
  133. If you'd like to contribute to ``attrs`` you're most welcome and we've written `a little guide <http://www.attrs.org/en/latest/contributing.html>`_ to get you started!
  134. Release Information
  135. ===================
  136. 18.1.0 (2018-05-03)
  137. -------------------
  138. Changes
  139. ^^^^^^^
  140. - ``x=X(); x.cycle = x; repr(x)`` will no longer raise a ``RecursionError``, and will instead show as ``X(x=...)``.
  141. `#95 <https://github.com/python-attrs/attrs/issues/95>`_
  142. - ``attr.ib(factory=f)`` is now syntactic sugar for the common case of ``attr.ib(default=attr.Factory(f))``.
  143. `#178 <https://github.com/python-attrs/attrs/issues/178>`_,
  144. `#356 <https://github.com/python-attrs/attrs/issues/356>`_
  145. - Added ``attr.field_dict()`` to return an ordered dictionary of ``attrs`` attributes for a class, whose keys are the attribute names.
  146. `#290 <https://github.com/python-attrs/attrs/issues/290>`_,
  147. `#349 <https://github.com/python-attrs/attrs/issues/349>`_
  148. - The order of attributes that are passed into ``attr.make_class()`` or the ``these`` argument of ``@attr.s()`` is now retained if the dictionary is ordered (i.e. ``dict`` on Python 3.6 and later, ``collections.OrderedDict`` otherwise).
  149. Before, the order was always determined by the order in which the attributes have been defined which may not be desirable when creating classes programatically.
  150. `#300 <https://github.com/python-attrs/attrs/issues/300>`_,
  151. `#339 <https://github.com/python-attrs/attrs/issues/339>`_,
  152. `#343 <https://github.com/python-attrs/attrs/issues/343>`_
  153. - In slotted classes, ``__getstate__`` and ``__setstate__`` now ignore the ``__weakref__`` attribute.
  154. `#311 <https://github.com/python-attrs/attrs/issues/311>`_,
  155. `#326 <https://github.com/python-attrs/attrs/issues/326>`_
  156. - Setting the cell type is now completely best effort.
  157. This fixes ``attrs`` on Jython.
  158. We cannot make any guarantees regarding Jython though, because our test suite cannot run due to dependency incompatabilities.
  159. `#321 <https://github.com/python-attrs/attrs/issues/321>`_,
  160. `#334 <https://github.com/python-attrs/attrs/issues/334>`_
  161. - If ``attr.s`` is passed a *these* argument, it will not attempt to remove attributes with the same name from the class body anymore.
  162. `#322 <https://github.com/python-attrs/attrs/issues/322>`_,
  163. `#323 <https://github.com/python-attrs/attrs/issues/323>`_
  164. - The hash of ``attr.NOTHING`` is now vegan and faster on 32bit Python builds.
  165. `#331 <https://github.com/python-attrs/attrs/issues/331>`_,
  166. `#332 <https://github.com/python-attrs/attrs/issues/332>`_
  167. - The overhead of instantiating frozen dict classes is virtually eliminated.
  168. `#336 <https://github.com/python-attrs/attrs/issues/336>`_
  169. - Generated ``__init__`` methods now have an ``__annotations__`` attribute derived from the types of the fields.
  170. `#363 <https://github.com/python-attrs/attrs/issues/363>`_
  171. - We have restructured the documentation a bit to account for ``attrs``' growth in scope.
  172. Instead of putting everything into the `examples <http://www.attrs.org/en/stable/examples.html>`_ page, we have started to extract narrative chapters.
  173. So far, we've added chapters on `initialization <http://www.attrs.org/en/stable/init.html>`_ and `hashing <http://www.attrs.org/en/stable/hashing.html>`_.
  174. Expect more to come!
  175. `#369 <https://github.com/python-attrs/attrs/issues/369>`_,
  176. `#370 <https://github.com/python-attrs/attrs/issues/370>`_
  177. `Full changelog <http://www.attrs.org/en/stable/changelog.html>`_.
  178. Credits
  179. =======
  180. ``attrs`` is written and maintained by `Hynek Schlawack <https://hynek.me/>`_.
  181. The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_.
  182. A full list of contributors can be found in `GitHub's overview <https://github.com/python-attrs/attrs/graphs/contributors>`_.
  183. It’s the spiritual successor of `characteristic <https://characteristic.readthedocs.io/>`_ and aspires to fix some of it clunkiness and unfortunate decisions.
  184. 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 `sub-classing is bad for you <https://www.youtube.com/watch?v=3MNVP9-hglc>`_, m’kay?