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

License

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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file bareimport-0.2.tar.gz.

File metadata

  • Download URL: bareimport-0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for bareimport-0.2.tar.gz
Algorithm Hash digest
SHA256 346f0bdf5838c16958285a78ff3c02f928b25c28bc5a3373177e821854629b6d
MD5 48e39f59924119defadab9fb365c134c
BLAKE2b-256 844ac0f5e1fc6eac113515a1624ea0d75084b1409410605b5bfd6f35f57e2617

See more details on using hashes here.

File details

Details for the file bareimport-0.2-py3-none-any.whl.

File metadata

  • Download URL: bareimport-0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for bareimport-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 86df488c985a602d37dc9b472d07d5d1b26fa9429024330946bef5d12d8de8c7
MD5 d41e3b55f752dbd27e5d7808f89db4f9
BLAKE2b-256 4551724508a960741c7ea2b7702d188a43fa92102b1e6d0af28f67e39b1bbfe2

See more details on using hashes here.

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