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
File details
Details for the file importmonkey-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: importmonkey-2.1.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a601cd985be7c5cbfba9d9bed5ce370c675904f240312a7934619f049de9f72a |
|
MD5 | 7104531a0291e5a3c5cd1d6611cf1701 |
|
BLAKE2b-256 | 679fd7276acf732bcb1e691c3615df532d084253fed1d4283b276cac6e5bd403 |