-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Description
Description
First of all, great work on the library, I appreciate your work!
As of right now, the __init__.py file for this library properly checks if certain dependencies are available, but does not report anything if libraries are missing, instead, the library simply states it fails to import a certain class or function.
If this issue is agreed upon, I would not mind forking and providing a small change to implement this check.
Context
Currently, this is the output the Python interpreter provides when attempting to import a class or function that does not have it's underlying dependencies installed.
Traceback (most recent call last):
File "/path/to/configuration.py", line 1, in <module>
from config import Configuration, ConfigurationSet, EnvConfiguration, TOMLConfiguration, JSONConfiguration
ImportError: cannot import name 'TOMLConfiguration' from 'config' (/path/to/env/lib/python3.11/site-packages/config/__init__.py)Expected Behavior
- Provide a verbose error, for example:
Traceback (most recent call last):
File "/path/to/configuration.py", line 1, in <module>
from config import Configuration, ConfigurationSet, EnvConfiguration, TOMLConfiguration, JSONConfiguration
ImportError: Cannot use class <TOMLConfiguration>, install dependency "toml".- Create an optional_requirements.txt.
- Create documentation outlining the dependencies of certain classes.
Use Case Examples
- Developers are capable of identifying missing libraries when using functions/classes that rely on them.
- Developers can read documentation to identify optional dependencies.
- Developers receive a verbose exception when attempting to use classes/functions that rely on uninstalled libraries.
Additional Information
N/A
Metadata
Metadata
Assignees
Labels
No labels