Skip to main content

reimportlib: refactored imports

reimportlib is used to help with refactored old code where the imports were moved out, but you still wish to get legacy packages/classes to work, because you had serialized them at a point in time but they aren't available today.

Main Features

  • Very compact
  • Few Dependencies

Usage

    import reimportlib
    __import__ = reimportlib.import_

    reimportlib.configure() # Reads mappings in .reimport.json
    reimportlib.remap('foo.bar.', 'examples.foo.') # Notice the . at the end
    
    print(reimportlib.get_remapped_name('foo.bar.C')) # 'examples.foo.C'

    print(reimportlib.import_module('foo.bar.B'))
    print(reimportlib.import_from('foo.bar.D', 'c'))
    reimportlib.instantiate('foo.bar.D', 'Foo', *[4], val=True)

And then it should automatically be able to import or instantiate the new classes as required. Do check the provided test.py with this distribution.

Metadata

Release files for reimportlib 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reimportlib 1.0.2
File Size Uploaded Provenance Actions
reimportlib-1.0.2.tar.gz 2.5 kB Without provenance Details for reimportlib-1.0.2.tar.gz

Release files / reimportlib-1.0.2.tar.gz

Download URL reimportlib-1.0.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
77204e0bda4ebd37daf44df22ca23d0ddbf64abd3a91f02f26907535c8f19e82
BLAKE2b-256 checksum
How to use checksums
beb953e093c31e43d7394f1c3bc372881071e8e2a2918cedccf3a0c6093b5463
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/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

Security for reimportlib 1.0.2

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.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

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