Metadata-Version: 2.0
Name: current
Version: 0.3.1
Summary: Current module relative paths and imports
Home-page: http://github.com/xflr6/current
Author: Sebastian Bank
Author-email: sebastian.bank@uni-leipzig.de
License: CC0
Keywords: sys.path import temporary inspect caller
Platform: any
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: test
Requires-Dist: nose; extra == 'test'
Provides-Extra: dev
Requires-Dist: wheel; extra == 'dev'

Current
=======

|PyPI version| |License| |Wheel| |Downloads|

Get the path of a file relative to the current module. Import a Python module
relative to the current module. Temporarily change ``sys.path`` for imports.
Get the path of a file relative to the module of the current caller.


Installation
------------

This package runs under Python 2.7 and 3.3+, use pip_ to install:

.. code:: bash

    $ pip install current

Usage
-----

Get paths relative to the current module:

.. code:: python

    >>> import current

    >>> here = current.current_path()
    >>> parent = current.current_path('..')
    >>> bruces = current.current_path('..', 'australia', 'bruces', 'bruces.ini')


Temporarily add the parent directory to ``sys.path``:

.. code:: python

    >>> with current.inserted_path()
    ...     import australia


Get paths relative to the module of the callers of the current code:

.. code:: python

    >>> caller = current.caller_path()
    >>> callercaller = current.caller_path(steps=2)


Potential issues
----------------

This package uses ``sys._getframe`` (which is almost the same as
``inspect.currentframe``, see__ docs__). Under IronPython this might require
enabling the ``FullFrames`` option of the interpreter.

.. __: http://docs.python.org/2/library/sys.html#sys._getframe
.. __: http://docs.python.org/2/library/inspect.html#inspect.currentframe


License
-------

`CC0 1.0 Public Domain Dedication`__

.. __: http://creativecommons.org/publicdomain/zero/1.0/


Changelog
---------

Version 0.3.1: Added wheel.

Version 0.3: Added Python 3.3+ support.

Version 0.2.1: Fixed caller_path. Documented sys._getframe dependency.

Version 0.2: Added caller_path.

Version 0.1: First public release.


.. _pip: http://pip.readthedocs.org


.. |PyPI version| image:: https://pypip.in/v/current/badge.svg
    :target: https://pypi.python.org/pypi/current
    :alt: Latest PyPI Version
.. |License| image:: https://pypip.in/license/current/badge.svg
    :target: https://pypi.python.org/pypi/current
    :alt: License
.. |Wheel| image:: https://pypip.in/wheel/current/badge.svg
    :target: https://pypi.python.org/pypi/current
    :alt: Wheel Status
.. |Downloads| image:: https://pypip.in/d/current/badge.svg
    :target: https://pypi.python.org/pypi/current
    :alt: Downloads


