Loading Pipfile +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ verify_ssl = true name = "pypi" [packages] common-package = {editable = true, path = "./src"} common-package = {editable = true, path = "./src", extras = ["scrapers"]} twine = "*" [dev-packages] Loading Pipfile.lock +555 −211 File changed.Preview size limit exceeded, changes collapsed. Show changes src/common/cli/__init__.py +2 −0 Original line number Diff line number Diff line Loading @@ -22,9 +22,11 @@ def of_cli(): # noqa: PEP402 from common.cli.docker_cli import docker from common.cli.python_cli import python_cli of_cli.add_command(docker) of_cli.add_command(python_cli) if __name__ == "__main__": Loading src/common/cli/docker_cli.py +0 −1 Original line number Diff line number Diff line Loading @@ -34,4 +34,3 @@ def docker_execute_and_mount(image, volume_target, volume_mount, exec_cmd): volume_target = os.getcwd() command = f"docker run -it -v {volume_target}:{volume_mount} -w {volume_mount} {image} {exec_cmd}" subprocess.run(command, shell=True) src/common/cli/python_cli.py 0 → 100644 +39 −0 Original line number Diff line number Diff line """Command line arguments for use setting up Python projects.""" import os import click @click.group() def python_cli(): """Python related commands.""" pass @python_cli.command(name='mk-pymodule', help='Create a new Python module directory') @click.option('--name', '-n', required=True, help='Name of the module') def mk_pymodule(name): """Create a new Python module directory with an __init__.py file.""" if name: try: os.makedirs(name, exist_ok=True) os.chdir(name) click.echo(f"Created directory {name} and changed into it.") except Exception as e: click.echo(f'Failed to create directory {name}: {str(e)}') return ctx = click.get_current_context() ctx.invoke(mk_init) os.chdir('..') else: click.echo('Must specify a --name for directory to create') @python_cli.command(name='mk-init', help='Create a new __init__.py file') def mk_init(): """Create a new __init__.py file.""" with open('__init__.py', 'w', encoding="utf-8") as f: f.write('#!/usr/bin/env python3\n') f.write('# -*- coding: utf-8 -*-\n') f.write('\n') f.write('"""Module initialization."""\n') f.write('\n') Loading
Pipfile +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ verify_ssl = true name = "pypi" [packages] common-package = {editable = true, path = "./src"} common-package = {editable = true, path = "./src", extras = ["scrapers"]} twine = "*" [dev-packages] Loading
src/common/cli/__init__.py +2 −0 Original line number Diff line number Diff line Loading @@ -22,9 +22,11 @@ def of_cli(): # noqa: PEP402 from common.cli.docker_cli import docker from common.cli.python_cli import python_cli of_cli.add_command(docker) of_cli.add_command(python_cli) if __name__ == "__main__": Loading
src/common/cli/docker_cli.py +0 −1 Original line number Diff line number Diff line Loading @@ -34,4 +34,3 @@ def docker_execute_and_mount(image, volume_target, volume_mount, exec_cmd): volume_target = os.getcwd() command = f"docker run -it -v {volume_target}:{volume_mount} -w {volume_mount} {image} {exec_cmd}" subprocess.run(command, shell=True)
src/common/cli/python_cli.py 0 → 100644 +39 −0 Original line number Diff line number Diff line """Command line arguments for use setting up Python projects.""" import os import click @click.group() def python_cli(): """Python related commands.""" pass @python_cli.command(name='mk-pymodule', help='Create a new Python module directory') @click.option('--name', '-n', required=True, help='Name of the module') def mk_pymodule(name): """Create a new Python module directory with an __init__.py file.""" if name: try: os.makedirs(name, exist_ok=True) os.chdir(name) click.echo(f"Created directory {name} and changed into it.") except Exception as e: click.echo(f'Failed to create directory {name}: {str(e)}') return ctx = click.get_current_context() ctx.invoke(mk_init) os.chdir('..') else: click.echo('Must specify a --name for directory to create') @python_cli.command(name='mk-init', help='Create a new __init__.py file') def mk_init(): """Create a new __init__.py file.""" with open('__init__.py', 'w', encoding="utf-8") as f: f.write('#!/usr/bin/env python3\n') f.write('# -*- coding: utf-8 -*-\n') f.write('\n') f.write('"""Module initialization."""\n') f.write('\n')