Skip to content

feat: Replace packaging module with local implementation to parse and compare versions #6

@tmeckel

Description

@tmeckel

Replace the packaging module, which is only used for parsing version specifications, with a local implementation to simplify the installation process.

importlib was added to Python 3 to programmatically >import a module.

import importlib

moduleName = input('Enter module name:')
importlib.import_module(moduleName)

The .py extension should be removed from moduleName. The function also defines a package argument for relative imports.

In python 2.x:

Just import file without the .py extension
A folder can be marked as a package, by adding an empty init.py file
You can use the import function, which takes the module name (without extension) as a string extension

pmName = input('Enter module name:')
pm = __import__(pmName)
print(dir(pm))

Type help(import) for more details.

https://stackoverflow.com/a/2349998

Depends on: #17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions