Skip to main content

Reloadable Modules and Namespace Packages

Project description

FakeMod

A utility to automatically reload a module if modified, or emulate a namespace package.

Example

import os
os.makedirs('./utilities', exist_ok=True)
with open('./utilities/tool.py', 'w') as f:
   f.write(r'''if 1:

    def func(a):
        print('func', a)

    ''')

import fakemod
mod = fakemod.at('./utilities')
mod.tool.func(123)

Usage

Place into __init__.py:

import fakemod; fakemod.local(vars())

Also place into local.py to allow for from . import local to access other files in the same directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fakemod-0.1.0.zip (6.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page