Skip to content

Commit 769a040

Browse files
theskumarSaurabh Kumar
andauthored
feat(cli): add support for execution via 'python -m' (#395)
Co-authored-by: Saurabh Kumar <theskumar@noreply.users.github.com>
1 parent 8080d1d commit 769a040

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def read_files(files):
3737
},
3838
entry_points={
3939
"console_scripts": [
40-
"dotenv=dotenv.cli:cli",
40+
"dotenv=dotenv.__main__:cli",
4141
],
4242
},
4343
license='BSD-3-Clause',

src/dotenv/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Entry point for cli, enables execution with `python -m dotenv`"""
2+
3+
from .cli import cli
4+
5+
if __name__ == "__main__":
6+
cli()

src/dotenv/cli.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,3 @@ def run_command(command: List[str], env: Dict[str, str]) -> int:
158158
_, _ = p.communicate()
159159

160160
return p.returncode
161-
162-
163-
if __name__ == "__main__":
164-
cli()

0 commit comments

Comments
 (0)