attrs/docs/index.rst

88 lines
2.7 KiB
ReStructuredText
Raw Normal View History

2017-10-26 15:55:45 +00:00
======================================
``attrs``: Classes Without Boilerplate
======================================
2015-01-27 16:53:17 +00:00
Release v\ |release| (:doc:`What's new? <changelog>`).
.. include:: ../README.rst
2015-01-27 21:41:24 +00:00
:start-after: teaser-begin
2016-08-15 15:24:09 +00:00
:end-before: -spiel-end-
2017-10-26 15:55:45 +00:00
Getting Started
===============
2015-01-27 16:53:17 +00:00
2017-10-26 15:55:45 +00:00
``attrs`` is a Python-only package `hosted on PyPI <https://pypi.org/project/attrs/>`_.
The recommended installation method is `pip <https://pip.pypa.io/en/stable/>`_-installing into a `virtualenv <https://hynek.me/articles/virtualenv-lives/>`_:
2015-01-27 16:53:17 +00:00
2017-10-26 15:55:45 +00:00
.. code-block:: console
2015-01-27 16:53:17 +00:00
2017-10-26 15:55:45 +00:00
$ pip install attrs
2015-01-27 16:53:17 +00:00
2017-10-26 15:55:45 +00:00
The next three steps should bring you up and running in no time:
- :doc:`overview` will show you a simple example of ``attrs`` in action and introduce you to its philosophy.
Afterwards, you can start writing your own classes, understand what drives ``attrs``'s design, and know what ``@attr.s`` and ``attr.ib()`` stand for.
- :doc:`examples` will give you a comprehensive tour of ``attrs``'s features.
After reading, you will know about our advanced features and how to use them.
- Finally :doc:`why` gives you a rundown of potential alternatives and why we think ``attrs`` is superior.
2017-11-08 18:21:26 +00:00
Yes, we've heard about ``namedtuple``\ s!
2017-10-26 15:55:45 +00:00
If you need any help while getting started, feel free to use the ``python-attrs`` tag on `StackOverflow <https://stackoverflow.com/questions/tagged/python-attrs>`_ and someone will surely help you out!
Day-to-Day Usage
================
- Once you're comfortable with the concepts, our :doc:`api` contains all information you need to use ``attrs`` to its fullest.
- Instance initialization is one of ``attrs`` key feature areas.
Our goal is to relieve you from writing as much code as possible.
:doc:`init` gives you an overview what ``attrs`` has to offer and explains some related philosophies we believe in.
- If you want to put objects into sets or use them as keys in dictionaries, they have to be hashable.
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.
2017-10-26 15:55:45 +00:00
- ``attrs`` is built for extension from the ground up.
:doc:`extending` will show you the affordances it offers and how to make it a building block of your own projects.
2015-01-27 16:53:17 +00:00
2015-01-28 17:23:15 +00:00
2017-10-26 15:55:45 +00:00
.. include:: ../README.rst
:start-after: -testimonials-
:end-before: -end-
.. include:: ../README.rst
:start-after: -project-information-
2015-01-27 16:53:17 +00:00
.. toctree::
:maxdepth: 1
license
2016-08-15 19:51:20 +00:00
backward-compatibility
2015-01-27 16:53:17 +00:00
contributing
changelog
2017-10-26 15:55:45 +00:00
----
Full Table of Contents
======================
.. toctree::
:maxdepth: 2
overview
why
examples
init
hashing
2017-10-26 15:55:45 +00:00
api
extending
how-does-it-work
2015-01-27 16:53:17 +00:00
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`