Skip to main content

Import a python module even if it is in a file that does not end in '.py'

Project description

bareimport - Import a python file even if it does not end in ".py".

This module is useful for building tests of functions within standalone scripts. This allows you to have a standalone script file, without having to name it ending in ".py". Then you can create test files that:

import bareimport
mod = bareimport.import_script_as_module('mod', ['./mod', '../mod'])

#  You can also import "mod" now:
from mod import func


CC0 1.0 Universal, see LICENSE file for more information.

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

bareimport-0.2.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

bareimport-0.2-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

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