Debian Codegraph @

third_party/python/attrs/attrs-23.1.0.dist-info/METADATA

raw
1 Metadata-Version: 2.1
2 Name: attrs
3 Version: 23.1.0
4 Summary: Classes Without Boilerplate
5 Project-URL: Documentation, https://www.attrs.org/
6 Project-URL: Changelog, https://www.attrs.org/en/stable/changelog.html
7 Project-URL: Bug Tracker, https://github.com/python-attrs/attrs/issues
8 Project-URL: Source Code, https://github.com/python-attrs/attrs
9 Project-URL: Funding, https://github.com/sponsors/hynek
10 Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=pypi
11 Author-email: Hynek Schlawack <[email protected]>
12 License-Expression: MIT
13 License-File: LICENSE
14 Keywords: attribute,boilerplate,class
15 Classifier: Development Status :: 5 - Production/Stable
16 Classifier: Intended Audience :: Developers
17 Classifier: License :: OSI Approved :: MIT License
18 Classifier: Programming Language :: Python :: 3.7
19 Classifier: Programming Language :: Python :: 3.8
20 Classifier: Programming Language :: Python :: 3.9
21 Classifier: Programming Language :: Python :: 3.10
22 Classifier: Programming Language :: Python :: 3.11
23 Classifier: Programming Language :: Python :: Implementation :: CPython
24 Classifier: Programming Language :: Python :: Implementation :: PyPy
25 Classifier: Typing :: Typed
26 Requires-Python: >=3.7
27 Requires-Dist: importlib-metadata; python_version < '3.8'
28 Provides-Extra: cov
29 Requires-Dist: attrs[tests]; extra == 'cov'
30 Requires-Dist: coverage[toml]>=5.3; extra == 'cov'
31 Provides-Extra: dev
32 Requires-Dist: attrs[docs,tests]; extra == 'dev'
33 Requires-Dist: pre-commit; extra == 'dev'
34 Provides-Extra: docs
35 Requires-Dist: furo; extra == 'docs'
36 Requires-Dist: myst-parser; extra == 'docs'
37 Requires-Dist: sphinx; extra == 'docs'
38 Requires-Dist: sphinx-notfound-page; extra == 'docs'
39 Requires-Dist: sphinxcontrib-towncrier; extra == 'docs'
40 Requires-Dist: towncrier; extra == 'docs'
41 Requires-Dist: zope-interface; extra == 'docs'
42 Provides-Extra: tests
43 Requires-Dist: attrs[tests-no-zope]; extra == 'tests'
44 Requires-Dist: zope-interface; extra == 'tests'
45 Provides-Extra: tests-no-zope
46 Requires-Dist: cloudpickle; platform_python_implementation == 'CPython' and extra == 'tests-no-zope'
47 Requires-Dist: hypothesis; extra == 'tests-no-zope'
48 Requires-Dist: mypy>=1.1.1; platform_python_implementation == 'CPython' and extra == 'tests-no-zope'
49 Requires-Dist: pympler; extra == 'tests-no-zope'
50 Requires-Dist: pytest-mypy-plugins; platform_python_implementation == 'CPython' and python_version < '3.11' and extra == 'tests-no-zope'
51 Requires-Dist: pytest-xdist[psutil]; extra == 'tests-no-zope'
52 Requires-Dist: pytest>=4.3.0; extra == 'tests-no-zope'
53 Description-Content-Type: text/markdown
54
55 <p align="center">
56 <a href="https://www.attrs.org/">
57 <img src="https://raw.githubusercontent.com/python-attrs/attrs/main/docs/_static/attrs_logo.svg" width="35%" alt="attrs" />
58 </a>
59 </p>
60
61
62 *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)).
63 [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-achievement) for Mars missions since 2020!
64
65 Its main goal is to help you to write **concise** and **correct** software without slowing down your code.
66
67
68 ## Sponsors
69
70 *attrs* would not be possible without our [amazing sponsors](https://github.com/sponsors/hynek).
71 Especially those generously supporting us at the *The Organization* tier and higher:
72
73 <p align="center">
74 <a href="https://www.variomedia.de/">
75 <img src="https://raw.githubusercontent.com/python-attrs/attrs/main/.github/sponsors/Variomedia.svg" width="200" height="60"></img>
76 </a>
77
78 <a href="https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo">
79 <img src="https://raw.githubusercontent.com/python-attrs/attrs/main/.github/sponsors/Tidelift.svg" width="200" height="60"></img>
80 </a>
81
82 <a href="https://sentry.io/">
83 <img src="https://raw.githubusercontent.com/python-attrs/attrs/main/.github/sponsors/Sentry.svg" width="200" height="60"></img>
84 </a>
85
86 <a href="https://filepreviews.io/">
87 <img src="https://raw.githubusercontent.com/python-attrs/attrs/main/.github/sponsors/FilePreviews.svg" width="200" height="60"></img>
88 </a>
89 </p>
90
91 <p align="center">
92 <strong>Please consider <a href="https://github.com/sponsors/hynek">joining them</a> to help make <em>attrs</em>’s maintenance more sustainable!</strong>
93 </p>
94
95 <!-- teaser-end -->
96
97 ## Example
98
99 *attrs* gives you a class decorator and a way to declaratively define the attributes on that class:
100
101 <!-- code-begin -->
102
103 ```pycon
104 >>> from attrs import asdict, define, make_class, Factory
105
106 >>> @define
107 ... class SomeClass:
108 ... a_number: int = 42
109 ... list_of_numbers: list[int] = Factory(list)
110 ...
111 ... def hard_math(self, another_number):
112 ... return self.a_number + sum(self.list_of_numbers) * another_number
113
114
115 >>> sc = SomeClass(1, [1, 2, 3])
116 >>> sc
117 SomeClass(a_number=1, list_of_numbers=[1, 2, 3])
118
119 >>> sc.hard_math(3)
120 19
121 >>> sc == SomeClass(1, [1, 2, 3])
122 True
123 >>> sc != SomeClass(2, [3, 2, 1])
124 True
125
126 >>> asdict(sc)
127 {'a_number': 1, 'list_of_numbers': [1, 2, 3]}
128
129 >>> SomeClass()
130 SomeClass(a_number=42, list_of_numbers=[])
131
132 >>> C = make_class("C", ["a", "b"])
133 >>> C("foo", "bar")
134 C(a='foo', b='bar')
135 ```
136
137 After *declaring* your attributes, *attrs* gives you:
138
139 - a concise and explicit overview of the class's attributes,
140 - a nice human-readable `__repr__`,
141 - equality-checking methods,
142 - an initializer,
143 - and much more,
144
145 *without* writing dull boilerplate code again and again and *without* runtime performance penalties.
146
147 **Hate type annotations**!?
148 No problem!
149 Types are entirely **optional** with *attrs*.
150 Simply assign `attrs.field()` to the attributes instead of annotating them with types.
151
152 ---
153
154 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.
155 The classic APIs (`@attr.s`, `attr.ib`, plus their serious-business aliases) and the `attr` package import name will remain **indefinitely**.
156
157 Please check out [*On The Core API Names*](https://www.attrs.org/en/latest/names.html) for a more in-depth explanation.
158
159
160 ## Data Classes
161
162 On the tin, *attrs* might remind you of `dataclasses` (and indeed, `dataclasses` [are a descendant](https://hynek.me/articles/import-attrs/) of *attrs*).
163 In practice it does a lot more and is more flexible.
164 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).
165
166 For more details, please refer to our [comparison page](https://www.attrs.org/en/stable/why.html#data-classes).
167
168
169 ## Project Information
170
171 - [**Changelog**](https://www.attrs.org/en/stable/changelog.html)
172 - [**Documentation**](https://www.attrs.org/)
173 - [**PyPI**](https://pypi.org/project/attrs/)
174 - [**Source Code**](https://github.com/python-attrs/attrs)
175 - [**Contributing**](https://github.com/python-attrs/attrs/blob/main/.github/CONTRIBUTING.md)
176 - [**Third-party Extensions**](https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs)
177 - **License**: [MIT](https://www.attrs.org/en/latest/license.html)
178 - **Get Help**: please use the `python-attrs` tag on [StackOverflow](https://stackoverflow.com/questions/tagged/python-attrs)
179 - **Supported Python Versions**: 3.7 and later
180
181
182 ### *attrs* for Enterprise
183
184 Available as part of the Tidelift Subscription.
185
186 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.
187 Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
188 [Learn more.](https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
189
190 ## Release Information
191
192 ### Backwards-incompatible Changes
193
194 - Python 3.6 has been dropped and packaging switched to static package data using [Hatch](https://hatch.pypa.io/latest/).
195 [#993](https://github.com/python-attrs/attrs/issues/993)
196
197
198 ### Deprecations
199
200 - The support for *zope-interface* via the `attrs.validators.provides` validator is now deprecated and will be removed in, or after, April 2024.
201
202 The presence of a C-based package in our developement dependencies has caused headaches and we're not under the impression it's used a lot.
203
204 Let us know if you're using it and we might publish it as a separate package.
205 [#1120](https://github.com/python-attrs/attrs/issues/1120)
206
207
208 ### Changes
209
210 - `attrs.filters.exclude()` and `attrs.filters.include()` now support the passing of attribute names as strings.
211 [#1068](https://github.com/python-attrs/attrs/issues/1068)
212 - `attrs.has()` and `attrs.fields()` now handle generic classes correctly.
213 [#1079](https://github.com/python-attrs/attrs/issues/1079)
214 - Fix frozen exception classes when raised within e.g. `contextlib.contextmanager`, which mutates their `__traceback__` attributes.
215 [#1081](https://github.com/python-attrs/attrs/issues/1081)
216 - `@frozen` now works with type checkers that implement [PEP-681](https://peps.python.org/pep-0681/) (ex. [pyright](https://github.com/microsoft/pyright/)).
217 [#1084](https://github.com/python-attrs/attrs/issues/1084)
218 - Restored ability to unpickle instances pickled before 22.2.0.
219 [#1085](https://github.com/python-attrs/attrs/issues/1085)
220 - `attrs.asdict()`'s and `attrs.astuple()`'s type stubs now accept the `attrs.AttrsInstance` protocol.
221 [#1090](https://github.com/python-attrs/attrs/issues/1090)
222 - Fix slots class cellvar updating closure in CPython 3.8+ even when `__code__` introspection is unavailable.
223 [#1092](https://github.com/python-attrs/attrs/issues/1092)
224 - `attrs.resolve_types()` can now pass `include_extras` to `typing.get_type_hints()` on Python 3.9+, and does so by default.
225 [#1099](https://github.com/python-attrs/attrs/issues/1099)
226 - Added instructions for pull request workflow to `CONTRIBUTING.md`.
227 [#1105](https://github.com/python-attrs/attrs/issues/1105)
228 - Added *type* parameter to `attrs.field()` function for use with `attrs.make_class()`.
229
230 Please note that type checkers ignore type metadata passed into `make_class()`, but it can be useful if you're wrapping _attrs_.
231 [#1107](https://github.com/python-attrs/attrs/issues/1107)
232 - It is now possible for `attrs.evolve()` (and `attr.evolve()`) to change fields named `inst` if the instance is passed as a positional argument.
233
234 Passing the instance using the `inst` keyword argument is now deprecated and will be removed in, or after, April 2024.
235 [#1117](https://github.com/python-attrs/attrs/issues/1117)
236 - `attrs.validators.optional()` now also accepts a tuple of validators (in addition to lists of validators).
237 [#1122](https://github.com/python-attrs/attrs/issues/1122)
238
239
240
241 ---
242
243 [Full changelog](https://www.attrs.org/en/stable/changelog.html)