Skip to main content

dirimport: convenient library importer

Install

  • python -m venv your-dir
  • cd your-dir
  • ./bin/pip install dirimport

Install (devel)

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 dir1 with generated init.py
    • or dir1 = dirimport.importall("dir1") without init.py
  • result
    • symbol1 -> dir1.symbol1
    • symbol2 -> dir1.symbol2
    • symbol3 -> dir1.pkg.symbol2

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

Metadata

Release files for dirimport 0.0.6

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 dirimport 0.0.6
File Interpreter ABI Platform Actions
dirimport-0.0.6-py3-none-any.whl Python 3 none any Details for dirimport-0.0.6-py3-none-any.whl

Release files / dirimport-0.0.6-py3-none-any.whl

Download URL dirimport-0.0.6-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f72438a8ab23153a06052f23e34cba1f4034914a5a9c7c081c5f9135ff7566f
BLAKE2b-256 checksum
How to use checksums
ef30bf7df0695fda5bb5ca9c1bc6831a7716c04fb0ed9e4fdfb6240eba589c66
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for dirimport 0.0.6

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