Metadata-Version: 2.0
Name: fiximports
Version: 0.1.11.dev1
Summary: Reorder import statements in Python files
Home-page: https://github.com/Stibbons/fiximports
Author: Gaetan Semet
Author-email: gaetan@xeberon.net
License: Apache-2
Keywords: codesstyle
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Requires-Dist: setuptools (>=17.1)
Requires-Dist: pip (>=1.0)
Requires-Dist: six (>=1.10.0)
Requires-Dist: argparse; (python_version=='2.6')

******************
Python Fix Imports
******************

|travis-badge|_ |codecov-badge|_ |readthedocs-badge|_ |pypi-badge|_

Python Fix Imports is a Python executable that can automatically reorganize the ``import``
statements of your Python script, by splitting single import statement importing several package
into as many import statement as imported module ("one import, one line" principle), and sorting
these import statements respecting position of *group* of them.

The main advantage for this method is to strictly restrict the forms of import statement and
facilitate multiple code branch merges and rebase, while still allowing to specify a given order if
it is the wish of the developer.

Please read the full rational
`online documenation for more information <http://fiximports.readthedocs.org/en/latest/>`_.

Sublime Text 3 users can use my
`Python Fix Imports <https://packagecontrol.io/packages/Python%20Fix%20Imports>`_ plugin.

Example
=======

Fix imports allows you to automatically turn:

.. code:: python

    from any_module import d, f
    from other_module import z, x
    from any_module import (b,
                            e)
    from any_module import a, \
                           c

    from a_module_that_should_be import at, after, all_others

into:

.. code:: python

    from any_module import a
    from any_module import b
    from any_module import c
    from any_module import d
    from any_module import e
    from any_module import f
    from other_module import x
    from other_module import z

    from a_module_that_should_be import after
    from a_module_that_should_be import all_others
    from a_module_that_should_be import at


Fiximport installation
======================

.. code-block:: bash

    $ pip install fiximports

Development environment
=======================

.. code-block:: bash

    $ virtualenv env
    $ source env/bin/activate
    $ pip install --upgrade -e .
    $ pip install -r test-requirements.txt
    $ python setup.py --version

Executing tests
===============

.. code-block:: bash

    $ python setup.py test

Updating AUTHORS, ChangeLog
===========================

Source distribution:

.. code-block:: bash

    $ python setup.py sdist

Binary distribution:

.. code-block:: bash

    $ python setup.py bdist

Wheels:

.. code-block:: bash

    $ python setup.py bdist_wheel

Universal Wheels:

.. code-block:: bash

    python setup.py bdist_wheel --universal

Update the dependencies for tests
=================================

.. code-block:: bash

    $ pip-compile test-requirements.in

.. note::

    We do "`pin`_" the dependencies for test environment. We do not "`pin`_ " for development.

    .. _pin: http://nvie.com/posts/better-package-management/

Generating the documentation
============================

.. code-block:: bash

    $ python setup.py docs

Release and upload to Pypi
==========================

.. note::

    In the normal case, package is automatically published to Pypi after successful Travis build.

    To release using this automatic procedure, simply create a new tag, push it (do not forget to do
    ``git push --tags``). When successful, Travis will automatically publish a new version on Pypi.

    Promote the tag to a proper Release in Github to align everything.

    PS: ChangeLog will be properly updated on Pypi, not on Github (you need to align it manually).

Here is the manual release procedure.

- Commit everything localy

- Create the release tag

  .. code-block:: bash

      git tag 0.?.?

- Create you source distribution to regenerate ChangeLog properly

  .. code-block:: bash

      $ python setup.py sdist

- Overwrite the release tag

  .. code-block:: bash

      git tag --force 0.?.?

- Push to Github, create a release with the same tag

- Build source and distribution:

  .. code-block:: bash

      $ rm -rfv dist/*
      $ python setup.py bdist
      $ python setup.py bdist_wheel
      $ python setup.py bdist_wheel --universal

- Upload distributions:

  .. code-block:: bash

      $ twine upload dist/*


.. |travis-badge| image:: https://travis-ci.org/Stibbons/fiximports.svg?branch=master
.. _travis-badge: https://travis-ci.org/Stibbons/fiximports
.. |codecov-badge| image:: http://codecov.io/github/Stibbons/fiximports/coverage.svg?branch=master
.. _codecov-badge: http://codecov.io/github/Stibbons/fiximports?branch=master
.. |readthedocs-badge| image:: https://readthedocs.org/projects/fiximports/badge/?version=latest
.. _readthedocs-badge: https://readthedocs.org/projects/fiximports/builds/
.. |pypi-badge| image:: https://badge.fury.io/py/fiximports.svg
.. _pypi-badge: https://pypi.python.org/pypi/fiximports/



