Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tmeckel opened this issue Jun 5, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers low Low priority

Comments

@tmeckel
Copy link
Owner

tmeckel commented Jun 5, 2023

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

@tmeckel tmeckel added good first issue Good for newcomers enhancement New feature or request labels Jun 5, 2023
@tmeckel tmeckel added the low Low priority label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers low Low priority
Projects
None yet
Development

No branches or pull requests

1 participant