| 1 |
# *attrs*: Classes Without Boilerplate |
| 2 |
|
| 3 |
Release **{sub-ref}`release`** ([What's new?](changelog.md)) |
| 4 |
|
| 5 |
```{include} ../README.md |
| 6 |
:start-after: 'teaser-begin -->' |
| 7 |
:end-before: '<!-- teaser-end' |
| 8 |
``` |
| 9 |
|
| 10 |
|
| 11 |
## Getting Started |
| 12 |
|
| 13 |
*attrs* is a Python-only package [hosted on PyPI](https://pypi.org/project/attrs/). |
| 14 |
The recommended installation method is [pip](https://pip.pypa.io/en/stable/)-installing into a [virtualenv](https://hynek.me/articles/virtualenv-lives/): |
| 15 |
|
| 16 |
```console |
| 17 |
$ python -Im pip install attrs |
| 18 |
``` |
| 19 |
|
| 20 |
The next steps will get you up and running in no time: |
| 21 |
|
| 22 |
- {doc}`overview` will show you a simple example of *attrs* in action and introduce you to its philosophy. |
| 23 |
Afterwards, you can start writing your own classes and understand what drives *attrs*'s design. |
| 24 |
- {doc}`examples` will give you a comprehensive tour of *attrs*'s features. |
| 25 |
After reading, you will know about our advanced features and how to use them. |
| 26 |
- {doc}`why` gives you a rundown of potential alternatives and why we think *attrs* is still worthwhile -- depending on *your* needs even superior. |
| 27 |
- If at any point you get confused by some terminology, please check out our {doc}`glossary`. |
| 28 |
|
| 29 |
If you need any help while getting started, feel free to use the `python-attrs` tag on [Stack Overflow](https://stackoverflow.com/questions/tagged/python-attrs) and someone will surely help you out! |
| 30 |
|
| 31 |
|
| 32 |
## Day-to-Day Usage |
| 33 |
|
| 34 |
- {doc}`types` help you to write *correct* and *self-documenting* code. |
| 35 |
*attrs* has first class support for them, yet keeps them optional if you’re not convinced! |
| 36 |
- Instance initialization is one of *attrs* key feature areas. |
| 37 |
Our goal is to relieve you from writing as much code as possible. |
| 38 |
{doc}`init` gives you an overview what *attrs* has to offer and explains some related philosophies we believe in. |
| 39 |
- Comparing and ordering objects is a common task. |
| 40 |
{doc}`comparison` shows you how *attrs* helps you with that and how you can customize it. |
| 41 |
- If you want to put objects into sets or use them as keys in dictionaries, they have to be hashable. |
| 42 |
The simplest way to do that is to use frozen classes, but the topic is more complex than it seems and {doc}`hashing` will give you a primer on what to look out for. |
| 43 |
- Once you're comfortable with the concepts, our {doc}`api` contains all information you need to use *attrs* to its fullest. |
| 44 |
- *attrs* is built for extension from the ground up. |
| 45 |
{doc}`extending` will show you the affordances it offers and how to make it a building block of your own projects. |
| 46 |
- Finally, if you're confused by all the `attr.s`, `attr.ib`, `attrs`, `attrib`, `define`, `frozen`, and `field`, head over to {doc}`names` for a very short explanation, and optionally a quick history lesson. |
| 47 |
|
| 48 |
|
| 49 |
## *attrs* for Enterprise |
| 50 |
|
| 51 |
```{include} ../README.md |
| 52 |
:start-after: '### *attrs* for Enterprise' |
| 53 |
``` |
| 54 |
|
| 55 |
--- |
| 56 |
|
| 57 |
## Full Table of Contents |
| 58 |
|
| 59 |
```{toctree} |
| 60 |
:maxdepth: 2 |
| 61 |
|
| 62 |
overview |
| 63 |
why |
| 64 |
examples |
| 65 |
types |
| 66 |
init |
| 67 |
comparison |
| 68 |
hashing |
| 69 |
api |
| 70 |
api-attr |
| 71 |
extending |
| 72 |
how-does-it-work |
| 73 |
glossary |
| 74 |
``` |
| 75 |
|
| 76 |
```{toctree} |
| 77 |
:caption: Meta |
| 78 |
:maxdepth: 1 |
| 79 |
|
| 80 |
names |
| 81 |
license |
| 82 |
changelog |
| 83 |
Third-party Extentions <https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs> |
| 84 |
PyPI <https://pypi.org/project/attrs/> |
| 85 |
Contributing <https://github.com/python-attrs/attrs/blob/main/.github/CONTRIBUTING.md> |
| 86 |
Funding <https://hynek.me/say-thanks/> |
| 87 |
``` |
| 88 |
|
| 89 |
[Full Index](genindex) |