<commit_before>======================
Changes in version 0.9
======================

This document details the various backwards-incompatible changes made during
Fabric's rewrite between versions 0.1 and 0.9. The codebase has been almost
completely rewritten and reorganized and an attempt has been made to remove
"magical" behavior and make things more simple and Pythonic; the ``fab``
command-line component has also been redone to behave more like a typical Unix
program.


Major changes
=============

You'll want to at least skim the entire document, but the primary changes that
will need to be made to one's fabfiles are as follows:

Imports
-------

You will need to **explicitly import any and all methods or decorators used**,
at the top of your fabfile; they are no longer magically available. Here's a
sample fabfile that works with 0.1 and earlier::

     @hosts('a', 'b')
     def my_task():
         run('ls /var/www')
         sudo('mkdir /var/www/newsite')

The above fabfile uses `hosts`, `run` and `sudo`, and so in Fabric 0.9 one
simply needs to add the following imports::

     from fabric.api import hosts, run, sudo
 
     @hosts('a', 'b')
     def my_task():
         run('ls /var/www')
         sudo('mkdir /var/www/newsite')

You may, if you wish, use ``from fabric.api import *``, though this is
technically not Python best practices; or you may import directly from the
Fabric submodules if you desire (e.g. ``from fabric.decorators import hosts``.)
See :doc:`usage` for a permanent version of this information.

Python version
--------------

Fabric started out Python 2.5-only, but became largely
2.4 compatible at one point during its lifetime. Fabric is once again **only
compatible with Python 2.5 or newer**, in order to take advantage of the various
new features and functions available in that version.

With this change we're setting an official policy to support the two most recent
stable releases of Python, which at time of writing is 2.5 and 2.6. We feel this
is a decent compromise between new features and the reality of operating system
packaging concerns. Given that most users use Fabric from their workstations,
which are typically more up-to-date than servers, we're hoping this doesn't cut
out too many folks.

Finally, note that while we will not officially support a 2.4-compatible
version or fork, we may provide a link to such a project if one arises.

Environment/config variables
----------------------------

The ``config`` object previously used to access and set internal state
(including Fabric config options) **has been renamed to** :data:`env`, but
otherwise remains the same (it allows both dictionary and object-attribute style
access to its data.) :data:`env` resides in the :mod:`state` submodule, so where
before one might have seen fabfiles like this::

    def my_task():
        config.foo = 'bar'

one will now be explicitly importing the object like so::

    from fabric.state import env
  
    def my_task():
        env.foo = 'bar'<commit_msg>Doc text re-wrapping.<commit_after>======================
Changes in version 0.9
======================

This document details the various backwards-incompatible changes made during
Fabric's rewrite between versions 0.1 and 0.9. The codebase has been almost
completely rewritten and reorganized and an attempt has been made to remove
"magical" behavior and make things more simple and Pythonic; the ``fab``
command-line component has also been redone to behave more like a typical Unix
program.


Major changes
=============

You'll want to at least skim the entire document, but the primary changes that
will need to be made to one's fabfiles are as follows:

Imports
-------

You will need to **explicitly import any and all methods or decorators used**,
at the top of your fabfile; they are no longer magically available. Here's a
sample fabfile that works with 0.1 and earlier::

     @hosts('a', 'b')
     def my_task():
         run('ls /var/www')
         sudo('mkdir /var/www/newsite')

The above fabfile uses `hosts`, `run` and `sudo`, and so in Fabric 0.9 one
simply needs to add the following imports::

     from fabric.api import hosts, run, sudo
 
     @hosts('a', 'b')
     def my_task():
         run('ls /var/www')
         sudo('mkdir /var/www/newsite')

You may, if you wish, use ``from fabric.api import *``, though this is
technically not Python best practices; or you may import directly from the
Fabric submodules if you desire (e.g. ``from fabric.decorators import hosts``.)
See :doc:`usage` for a permanent version of this information.

Python version
--------------

Fabric started out Python 2.5-only, but became largely 2.4 compatible at one
point during its lifetime. Fabric is once again **only compatible with Python
2.5 or newer**, in order to take advantage of the various new features and
functions available in that version.

With this change we're setting an official policy to support the two most
recent stable releases of Python, which at time of writing is 2.5 and 2.6. We
feel this is a decent compromise between new features and the reality of
operating system packaging concerns. Given that most users use Fabric from
their workstations, which are typically more up-to-date than servers, we're
hoping this doesn't cut out too many folks.

Finally, note that while we will not officially support a 2.4-compatible
version or fork, we may provide a link to such a project if one arises.

Environment/config variables
----------------------------

The ``config`` object previously used to access and set internal state
(including Fabric config options) **has been renamed to** :data:`env`, but
otherwise remains the same (it allows both dictionary and object-attribute
style access to its data.) :data:`env` resides in the :mod:`state` submodule,
so where before one might have seen fabfiles like this::

    def my_task():
        config.foo = 'bar'

one will now be explicitly importing the object like so::

    from fabric.state import env
  
    def my_task():
        env.foo = 'bar'
{'fraction_non_alphanumeric': 0.10085978835978836, 'fraction_numerical': 0.007275132275132275, 'mean_word_length': 3.6566589684372595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '883109', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1525, 'n_words': 859}