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:
from importmonkey import add_path # In test.py
add_path("../src")
import project
Why?
Show details
Sometimes you want a specific repo structure to test and build a package from the same files so you need a relative / sibling / parent import.
Documentation
Show details
>>> import importmonkey
>>> help(importmonkey.add_path)
>>> # Or take a look at the well documented source.
Development details
Show details
Linting
importmonkey$ python -m black .
importmonkey$ python -m flake8 src/ test/
Testing
importmonkey$ python test/run_test_suite.py
Building & releasing
# Remember to increment __version__ in __init__.py
importmonkey$ python -m build --wheel && rm -rf build/ && rm -rf src/importmonkey.egg-info/
importmonkey$ importmonkey$ python -m twine check dist/*
importmonkey$ python -m twine upload dist/*
importmonkey$ rm -rf dist/
Additional licensing
Show details
This software is licensed under The Unlicense as the author's protest towards the modern copyright landscape. If you need a different lisence for legal or compability reasons, just ask.
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
Close
Hashes for importmonkey-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91a21ac05425644cfc7a2462c9bd0df5d9ca9c8643c5836143036adf87f3bd08 |
|
MD5 | b6938c9196040bd26ea028ec9a56c527 |
|
BLAKE2b-256 | 8e1cd43c2815d51611923528ca7afefbc52b5b00346f1ce68378117d5db97fae |