You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

METADATA 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. Metadata-Version: 2.1
  2. Name: attrs
  3. Version: 19.3.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: Bug Tracker, https://github.com/python-attrs/attrs/issues
  13. Project-URL: Source Code, https://github.com/python-attrs/attrs
  14. Keywords: class,attribute,boilerplate
  15. Platform: UNKNOWN
  16. Classifier: Development Status :: 5 - Production/Stable
  17. Classifier: Intended Audience :: Developers
  18. Classifier: Natural Language :: English
  19. Classifier: License :: OSI Approved :: MIT License
  20. Classifier: Operating System :: OS Independent
  21. Classifier: Programming Language :: Python
  22. Classifier: Programming Language :: Python :: 2
  23. Classifier: Programming Language :: Python :: 2.7
  24. Classifier: Programming Language :: Python :: 3
  25. Classifier: Programming Language :: Python :: 3.4
  26. Classifier: Programming Language :: Python :: 3.5
  27. Classifier: Programming Language :: Python :: 3.6
  28. Classifier: Programming Language :: Python :: 3.7
  29. Classifier: Programming Language :: Python :: 3.8
  30. Classifier: Programming Language :: Python :: Implementation :: CPython
  31. Classifier: Programming Language :: Python :: Implementation :: PyPy
  32. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  33. Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
  34. Description-Content-Type: text/x-rst
  35. Provides-Extra: azure-pipelines
  36. Requires-Dist: coverage ; extra == 'azure-pipelines'
  37. Requires-Dist: hypothesis ; extra == 'azure-pipelines'
  38. Requires-Dist: pympler ; extra == 'azure-pipelines'
  39. Requires-Dist: pytest (>=4.3.0) ; extra == 'azure-pipelines'
  40. Requires-Dist: six ; extra == 'azure-pipelines'
  41. Requires-Dist: zope.interface ; extra == 'azure-pipelines'
  42. Requires-Dist: pytest-azurepipelines ; extra == 'azure-pipelines'
  43. Provides-Extra: dev
  44. Requires-Dist: coverage ; extra == 'dev'
  45. Requires-Dist: hypothesis ; extra == 'dev'
  46. Requires-Dist: pympler ; extra == 'dev'
  47. Requires-Dist: pytest (>=4.3.0) ; extra == 'dev'
  48. Requires-Dist: six ; extra == 'dev'
  49. Requires-Dist: zope.interface ; extra == 'dev'
  50. Requires-Dist: sphinx ; extra == 'dev'
  51. Requires-Dist: pre-commit ; extra == 'dev'
  52. Provides-Extra: docs
  53. Requires-Dist: sphinx ; extra == 'docs'
  54. Requires-Dist: zope.interface ; extra == 'docs'
  55. Provides-Extra: tests
  56. Requires-Dist: coverage ; extra == 'tests'
  57. Requires-Dist: hypothesis ; extra == 'tests'
  58. Requires-Dist: pympler ; extra == 'tests'
  59. Requires-Dist: pytest (>=4.3.0) ; extra == 'tests'
  60. Requires-Dist: six ; extra == 'tests'
  61. Requires-Dist: zope.interface ; extra == 'tests'
  62. .. image:: https://www.attrs.org/en/latest/_static/attrs_logo.png
  63. :alt: attrs Logo
  64. ======================================
  65. ``attrs``: Classes Without Boilerplate
  66. ======================================
  67. .. image:: https://readthedocs.org/projects/attrs/badge/?version=stable
  68. :target: https://www.attrs.org/en/stable/?badge=stable
  69. :alt: Documentation Status
  70. .. image:: https://attrs.visualstudio.com/attrs/_apis/build/status/python-attrs.attrs?branchName=master
  71. :target: https://attrs.visualstudio.com/attrs/_build/latest?definitionId=1&branchName=master
  72. :alt: CI Status
  73. .. image:: https://codecov.io/github/python-attrs/attrs/branch/master/graph/badge.svg
  74. :target: https://codecov.io/github/python-attrs/attrs
  75. :alt: Test Coverage
  76. .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
  77. :target: https://github.com/psf/black
  78. :alt: Code style: black
  79. .. teaser-begin
  80. ``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).
  81. Its main goal is to help you to write **concise** and **correct** software without slowing down your code.
  82. .. -spiel-end-
  83. For that, it gives you a class decorator and a way to declaratively define the attributes on that class:
  84. .. -code-begin-
  85. .. code-block:: pycon
  86. >>> import attr
  87. >>> @attr.s
  88. ... class SomeClass(object):
  89. ... a_number = attr.ib(default=42)
  90. ... list_of_numbers = attr.ib(factory=list)
  91. ...
  92. ... def hard_math(self, another_number):
  93. ... return self.a_number + sum(self.list_of_numbers) * another_number
  94. >>> sc = SomeClass(1, [1, 2, 3])
  95. >>> sc
  96. SomeClass(a_number=1, list_of_numbers=[1, 2, 3])
  97. >>> sc.hard_math(3)
  98. 19
  99. >>> sc == SomeClass(1, [1, 2, 3])
  100. True
  101. >>> sc != SomeClass(2, [3, 2, 1])
  102. True
  103. >>> attr.asdict(sc)
  104. {'a_number': 1, 'list_of_numbers': [1, 2, 3]}
  105. >>> SomeClass()
  106. SomeClass(a_number=42, list_of_numbers=[])
  107. >>> C = attr.make_class("C", ["a", "b"])
  108. >>> C("foo", "bar")
  109. C(a='foo', b='bar')
  110. After *declaring* your attributes ``attrs`` gives you:
  111. - a concise and explicit overview of the class's attributes,
  112. - a nice human-readable ``__repr__``,
  113. - a complete set of comparison methods (equality and ordering),
  114. - an initializer,
  115. - and much more,
  116. *without* writing dull boilerplate code again and again and *without* runtime performance penalties.
  117. 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>`_.
  118. 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.
  119. Which in turn encourages you to write *small classes* that do `one thing well <https://www.destroyallsoftware.com/talks/boundaries>`_.
  120. 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.
  121. .. -testimonials-
  122. Testimonials
  123. ============
  124. **Amber Hawkie Brown**, Twisted Release Manager and Computer Owl:
  125. Writing a fully-functional class using attrs takes me less time than writing this testimonial.
  126. **Glyph Lefkowitz**, creator of `Twisted <https://twistedmatrix.com/>`_, `Automat <https://pypi.org/project/Automat/>`_, and other open source software, in `The One Python Library Everyone Needs <https://glyph.twistedmatrix.com/2016/08/attrs.html>`_:
  127. I’m looking forward to is being able to program in Python-with-attrs everywhere.
  128. It exerts a subtle, but positive, design influence in all the codebases I’ve see it used in.
  129. **Kenneth Reitz**, creator of `Requests <https://github.com/psf/requests>`_ (`on paper no less <https://twitter.com/hynek/status/866817877650751488>`_!):
  130. attrs—classes for humans. I like it.
  131. **Łukasz Langa**, creator of `Black <https://github.com/psf/black>`_, prolific Python core developer, and release manager for Python 3.8 and 3.9:
  132. I'm increasingly digging your attr.ocity. Good job!
  133. .. -end-
  134. .. -project-information-
  135. Getting Help
  136. ============
  137. Please use the ``python-attrs`` tag on `StackOverflow <https://stackoverflow.com/questions/tagged/python-attrs>`_ to get help.
  138. Answering questions of your fellow developers is also great way to help the project!
  139. Project Information
  140. ===================
  141. ``attrs`` is released under the `MIT <https://choosealicense.com/licenses/mit/>`_ license,
  142. its documentation lives at `Read the Docs <https://www.attrs.org/>`_,
  143. the code on `GitHub <https://github.com/python-attrs/attrs>`_,
  144. and the latest release on `PyPI <https://pypi.org/project/attrs/>`_.
  145. It’s rigorously tested on Python 2.7, 3.4+, and PyPy.
  146. We collect information on **third-party extensions** in our `wiki <https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs>`_.
  147. Feel free to browse and add your own!
  148. 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!
  149. Release Information
  150. ===================
  151. 19.3.0 (2019-10-15)
  152. -------------------
  153. Changes
  154. ^^^^^^^
  155. - Fixed ``auto_attribs`` usage when default values cannot be compared directly with ``==``, such as ``numpy`` arrays.
  156. `#585 <https://github.com/python-attrs/attrs/issues/585>`_
  157. `Full changelog <https://www.attrs.org/en/stable/changelog.html>`_.
  158. Credits
  159. =======
  160. ``attrs`` is written and maintained by `Hynek Schlawack <https://hynek.me/>`_.
  161. The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_.
  162. A full list of contributors can be found in `GitHub's overview <https://github.com/python-attrs/attrs/graphs/contributors>`_.
  163. It’s the spiritual successor of `characteristic <https://characteristic.readthedocs.io/>`_ and aspires to fix some of it clunkiness and unfortunate decisions.
  164. 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?