import your library without __init__.py
Project description
dirimport: convenient library importer
Install
- python -m venv your-dir
- cd your-dir
- ./bin/pip install dirimport
Install (devel)
- git clone https://github.com/wtnb75/dirimport.git
- cd dirimport
- python -m venv .
- ./bin/pip install -r requirements.txt
Use
- import dirimport
- mod = dirimport.importall("/path/to/dirname")
import rules
- file.py ->
from .file import * - subpkg/ ->
from . import subpkg - do it recursively
then, all symbols will be accessible after import.
example:
- layout
- symbol1 in dir1/file1.py
- symbol2 in dir1/file2.py
- symbol3 in dir1/pkg/file1.py
- import
import dir1with generated init.py- or
dir1 = dirimport.importall("dir1")without init.py
- result
- symbol1 ->
dir1.symbol1 - symbol2 ->
dir1.symbol2 - symbol3 ->
dir1.pkg.symbol2
- symbol1 ->
CLI tools
# ./bin/dirimport
Usage: dirimport [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
diff
eval
generate
- diff
__init__.py- ./bin/dirimport diff your-library-dir
- import and evaluate expression
- ./bin/dirimport eval your-library-dir 'expression'
- generate
__init__.py- ./bin/dirimport generate your-library-dir
examples
Links
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dirimport-0.0.6-py3-none-any.whl.
File metadata
- Download URL: dirimport-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f72438a8ab23153a06052f23e34cba1f4034914a5a9c7c081c5f9135ff7566f
|
|
| MD5 |
270903950c577a5be8202c36da932bd7
|
|
| BLAKE2b-256 |
ef30bf7df0695fda5bb5ca9c1bc6831a7716c04fb0ed9e4fdfb6240eba589c66
|