summaryrefslogtreecommitdiff
path: root/doc/index.rst
blob: bf01378d6e3a46487d7a889dff352c40447b3f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
.. Astroid documentation main file, created by
   sphinx-quickstart on Wed Jun 26 15:00:40 2013.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

.. Please see the documentation for the Sphinx Python domain :
   http://sphinx-doc.org/domains.html#the-python-domain
   and the autodoc extension
   http://sphinx-doc.org/ext/autodoc.html


Welcome to astroid's documentation!
===================================

**astroid** is a library for AST parsing, static analysis and inference,
currently powering most of **pylint** capabilities.

It offers support for parsing Python source code into ASTs, similar to how
the builtin **ast** module works. On top of that, it can partially infer various
Python constructs, as seen in the following example::

   from astroid import parse
   module = parse('''
   def func(first, second):
       return first + second

   arg_1 = 2
   arg_2 = 3
   func(arg_1, arg_2)
   ''')
   >>> module.body[-1]
   <Expr l.3 at 0x10ab46f28>
   >>> inferred = next(module.body[-1].value.infer())
   >>> inferred
   <Const.int l.None at 0x10ab00588>
   >>> inferred.value
   5


**astroid** also allows the user to write various inference transforms for
enhancing its Python understanding, helping as well **pylint** in the process
of figuring out the dynamic nature of Python.

Support
-------

.. image:: media/Tidelift_Logos_RGB_Tidelift_Shorthand_On-White.png
   :width: 75
   :alt: Tidelift
   :align: left
   :class: tideliftlogo

Professional support for astroid is available as part of the `Tidelift
Subscription`_.  Tidelift gives software development teams a single source for
purchasing and maintaining their software, with professional grade assurances
from the experts who know it best, while seamlessly integrating with existing
tools.

.. _Tidelift Subscription: https://tidelift.com/subscription/pkg/pypi-astroid?utm_source=pypi-astroid&utm_medium=referral&utm_campaign=readme


More information
----------------

.. toctree::
   :maxdepth: 2

   inference

   extending

   api/index

   whatsnew


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`