
Version
*******

Tor versioning information and requirements for its features. These
can be easily parsed and compared, for instance...

   >>> from stem.version import get_system_tor_version, Requirement
   >>> my_version = get_system_tor_version()
   >>> print(my_version)
   0.2.1.30
   >>> my_version >= Requirement.TORRC_CONTROL_SOCKET
   True

**Module Overview:**

   get_system_tor_version - gets the version of our system's tor installation

   Version - Tor versioning information

stem.version.Requirement(enum)

   Enumerations for the version requirements of features.

   +---------------------------------------+---------------------------------------------------------------------+
   | Requirement                           | Description                                                         |
   +=======================================+=====================================================================+
   | **AUTH_SAFECOOKIE**                   | SAFECOOKIE authentication method                                    |
   +---------------------------------------+---------------------------------------------------------------------+
   | **DROPGUARDS**                        | DROPGUARDS requests                                                 |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_AUTHDIR_NEWDESCS**            | AUTHDIR_NEWDESC events                                              |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_BUILDTIMEOUT_SET**            | BUILDTIMEOUT_SET events                                             |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_CIRC_MINOR**                  | CIRC_MINOR events                                                   |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_CLIENTS_SEEN**                | CLIENTS_SEEN events                                                 |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_CONF_CHANGED**                | CONF_CHANGED events                                                 |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_DESCCHANGED**                 | DESCCHANGED events                                                  |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_GUARD**                       | GUARD events                                                        |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_HS_DESC_CONTENT**             | HS_DESC_CONTENT events                                              |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_NEWCONSENSUS**                | NEWCONSENSUS events                                                 |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_NS**                          | NS events                                                           |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_SIGNAL**                      | SIGNAL events                                                       |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_STATUS**                      | STATUS_GENERAL, STATUS_CLIENT, and STATUS_SERVER events             |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_STREAM_BW**                   | STREAM_BW events                                                    |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_TRANSPORT_LAUNCHED**          | TRANSPORT_LAUNCHED events                                           |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_CONN_BW**                     | CONN_BW events                                                      |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_CIRC_BW**                     | CIRC_BW events                                                      |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_CELL_STATS**                  | CELL_STATS events                                                   |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_TB_EMPTY**                    | TB_EMPTY events                                                     |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EVENT_HS_DESC**                     | HS_DESC events                                                      |
   +---------------------------------------+---------------------------------------------------------------------+
   | **EXTENDCIRCUIT_PATH_OPTIONAL**       | EXTENDCIRCUIT queries can omit the path if the circuit is zero      |
   +---------------------------------------+---------------------------------------------------------------------+
   | **FEATURE_EXTENDED_EVENTS**           | 'EXTENDED_EVENTS' optional feature                                  |
   +---------------------------------------+---------------------------------------------------------------------+
   | **FEATURE_VERBOSE_NAMES**             | 'VERBOSE_NAMES' optional feature                                    |
   +---------------------------------------+---------------------------------------------------------------------+
   | **GETINFO_CONFIG_TEXT**               | 'GETINFO config-text' query                                         |
   +---------------------------------------+---------------------------------------------------------------------+
   | **HSFETCH**                           | HSFETCH requests                                                    |
   +---------------------------------------+---------------------------------------------------------------------+
   | **HSPOST**                            | HSPOST requests                                                     |
   +---------------------------------------+---------------------------------------------------------------------+
   | **ADD_ONION**                         | ADD_ONION and DEL_ONION requests                                    |
   +---------------------------------------+---------------------------------------------------------------------+
   | **LOADCONF**                          | LOADCONF requests                                                   |
   +---------------------------------------+---------------------------------------------------------------------+
   | **MICRODESCRIPTOR_IS_DEFAULT**        | Tor gets microdescriptors by default rather than server descriptors |
   +---------------------------------------+---------------------------------------------------------------------+
   | **TAKEOWNERSHIP**                     | TAKEOWNERSHIP requests                                              |
   +---------------------------------------+---------------------------------------------------------------------+
   | **TORRC_CONTROL_SOCKET**              | 'ControlSocket <path>' config option                                |
   +---------------------------------------+---------------------------------------------------------------------+
   | **TORRC_PORT_FORWARDING**             | 'PortForwarding' config option                                      |
   +---------------------------------------+---------------------------------------------------------------------+
   | **TORRC_DISABLE_DEBUGGER_ATTACHMENT** | 'DisableDebuggerAttachment' config option                           |
   +---------------------------------------+---------------------------------------------------------------------+
   | **TORRC_VIA_STDIN**                   | Allow torrc options via 'tor -f -' (ticket 13865)                   |
   +---------------------------------------+---------------------------------------------------------------------+

stem.version.get_system_tor_version(tor_cmd='tor')

   Queries tor for its version. This is os dependent, only working on
   linux, osx, and bsd.

   Parameters:
      **tor_cmd** (*str*) -- command used to run tor

   Returns:
      "Version" provided by the tor command

   Raises :
      **IOError** if unable to query or parse the version

class class stem.version.Version(version_str)

   Bases: "object"

   Comparable tor version. These are constructed from strings that
   conform to the 'new' style in the tor version-spec, such as "0.1.4"
   or "0.2.2.23-alpha (git-7dcd105be34a4f44)".

   Variables:
      * **major** (*int*) -- major version

      * **minor** (*int*) -- minor version

      * **micro** (*int*) -- micro version

      * **patch** (*int*) -- patch level (**None** if undefined)

      * **status** (*str*) -- status tag such as 'alpha' or 'beta-dev'
        (**None** if undefined)

      * **extra** (*str*) -- extra information without its parentheses
        such as 'git-8be6058d8f31e578' (**None** if undefined)

      * **git_commit** (*str*) -- git commit id (**None** if it wasn't
        provided)

   Parameters:
      **version_str** (*str*) -- version to be parsed

   Raises :
      **ValueError** if input isn't a valid tor version
