Skip to main content

Utility for adding new import paths.

Project description


🐵
importmonkey


       

An utility for adding new import paths to make your relative import work without hassle.

pip install importmonkey

What does it do?

Here is your repository:

├─ src
│   └─ project
│       ├─ __init__.py
│       └─ module.py
└─ test
    └─ test.py

test.py can't find module.py:

ModuleNotFoundError: No module named 'module'
ImportError: attempted relative import with no known parent package
SystemError: Parent module '' not loaded, cannot perform relative import

importmonkey will fix that:

import importmonkey  # In test.py
importmonkey.add_path("../src")
import project

Documentation / Licensing / Dev stuff

Expand

Documentation

help(importmonkey.add_path) # Or look at the source.

Licensing

To protest the copyright landscape, I chose The Unlicense. If you need a different license, just ask.

Dev stuff

  • Install for dev stuff: importmonkey$ pip install -e ".[dev]" # In a venv
  • Linting: importmonkey$ python -m ruff check .
  • Testing: importmonkey$ python test/run_test_suite.py
  • Releasing:
# Remember: increment __version__ in __init__.py
# Remember: .pypirc file is needed.
# Remember: run tests
# Remember: run ruff
importmonkey$ python -m build --wheel
importmonkey$ rm -rf build/ && rm -rf src/importmonkey.egg-info/
importmonkey$ python -m twine check dist/*
importmonkey$ python -m twine upload dist/*
importmonkey$ rm -rf dist/

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

importmonkey-2.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file importmonkey-2.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for importmonkey-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d325c32341d39b7a1d22012efbb09a056217aa55c8410b4edbcea0f6599f79
MD5 83bb6f1ab0c1dd50e7eb064391ee6fab
BLAKE2b-256 5920aa2c8a1eeb55bb352c3b25f0a04cf35cee5bdf68346a81203c73e1e4a20e

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