diff options
Diffstat (limited to 'examples/include_no_requirements.py')
-rw-r--r-- | examples/include_no_requirements.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/include_no_requirements.py b/examples/include_no_requirements.py new file mode 100644 index 0000000..c51a85c --- /dev/null +++ b/examples/include_no_requirements.py @@ -0,0 +1,11 @@ +# How to import tqdm in any frontend without enforcing it as a dependency +try: + from tqdm.auto import tqdm +except ImportError: + + def tqdm(*args, **kwargs): + if args: + return args[0] + return kwargs.get('iterable', None) + +__all__ = ['tqdm'] |