Metadata-Version: 2.0
Name: magicalimport
Version: 0.3
Summary: importing a module by physical file path
Home-page: https://github.com/podhmo/magicalimport
Author: podhmo
Author-email: ababjam61+github@gmail.com
License: UNKNOWN
Keywords: import,physical address,file path
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: Implementation :: CPython
Provides-Extra: docs
Provides-Extra: testing

magicalimport
========================================

.. image:: https://travis-ci.org/podhmo/magicalimport.svg?branch=master
  :target: https://travis-ci.org/podhmo/magicalimport

Importing a module from physical file path.

examples
----------------------------------------

these files are existed, then..

.. code-block:: bash

  $ tree
  .
  ├── a
  │   └── b
  │       └── c
  │           └── foo.py
  └── main.py

  4 directories, 3 files


a/b/c/foo.py

.. code-block:: python

  name = "foo"
  _age = "*secret*"

.. code-block:: python

  from magicalimport import import_from_physical_path

  # importing foo.py as the module named foo2
  foo = import_from_physical_path("./a/b/c/foo.py", as_="foo2")
  print(foo.name)

  # cached in sys.modules, so it is ok.
  import foo2
  print(foo2.name)


here option
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

  from magicalimport import import_from_physical_path

  import_from_physical_path("bar.py", here="/tmp/foo", as_="bar")

star import
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

   from magicalimport import import_from_physical_path
   from magicalimport import expose_all_members

   # something of like a `from foo import *`
   expose_all_members(import_from_physical_path("./a/b/c/foo.py"))
   print(name)  # "foo"
   # print(_age)  # NameError.. because expose_all_members() doesn't expose the symbols started by "_"

   # or
   from magicalimport import expose_members
   expose_members(import_from_physical_path("./a/b/c/foo.py"), members=["_age"])
   print(_age)  # "*secret*"


0.3

- ns option in import_symbol

0.2.1

- here option is supported

0.2

- python2 support

0.1

- first release


