diff --git a/setup.py b/setup.py index a805c188..5a35d188 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def read_files(files): }, entry_points={ "console_scripts": [ - "dotenv=dotenv.cli:cli", + "dotenv=dotenv.__main__:cli", ], }, license='BSD-3-Clause', diff --git a/src/dotenv/__main__.py b/src/dotenv/__main__.py new file mode 100644 index 00000000..3977f55a --- /dev/null +++ b/src/dotenv/__main__.py @@ -0,0 +1,6 @@ +"""Entry point for cli, enables execution with `python -m dotenv`""" + +from .cli import cli + +if __name__ == "__main__": + cli() diff --git a/src/dotenv/cli.py b/src/dotenv/cli.py index b7ae24af..3411e346 100644 --- a/src/dotenv/cli.py +++ b/src/dotenv/cli.py @@ -158,7 +158,3 @@ def run_command(command: List[str], env: Dict[str, str]) -> int: _, _ = p.communicate() return p.returncode - - -if __name__ == "__main__": - cli()