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/

Metadata

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 Actions
importmonkey-2.1.1-py3-none-any.whl Python 3 none any Details for importmonkey-2.1.1-py3-none-any.whl

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

Security for importmonkey 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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