Skip to main content


🐵
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/

Release files for importmonkey 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for importmonkey 2.1.1
File Interpreter ABI Platform
importmonkey-2.1.1-py3-none-any.whl Python 3 none any Details

Release files / importmonkey-2.1.1-py3-none-any.whl

Download URL importmonkey-2.1.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a601cd985be7c5cbfba9d9bed5ce370c675904f240312a7934619f049de9f72a
BLAKE2b-256 checksum
How to use checksums
679fd7276acf732bcb1e691c3615df532d084253fed1d4283b276cac6e5bd403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.0

Release history Release notifications | RSS feed

This release

2.1.1 This release

1 release file

2.1.0

1 release file

2.0.0

1 release file

1.0.0

1 release file

0.1.0

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page