From ce78b6628ae60385d51ff89b81aa5d574fc89d4f Mon Sep 17 00:00:00 2001 From: Jesse Hitch Date: Sun, 6 Nov 2022 22:21:51 +0100 Subject: [PATCH] pep8 --- onboardme/__init__.py | 6 ++---- onboardme/config/packages.yml | 1 + onboardme/env_config.py | 3 ++- onboardme/help_text.py | 4 ++-- onboardme/pkg_management.py | 20 +++++++++----------- onboardme/subproc.py | 5 ++--- setup.py | 2 +- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/onboardme/__init__.py b/onboardme/__init__.py index 064cad01..e95a66ce 100755 --- a/onboardme/__init__.py +++ b/onboardme/__init__.py @@ -7,10 +7,8 @@ LICENSE: GNU AFFERO GENERAL PUBLIC LICENSE """ from click import option, command, Choice -import dbm import importlib import logging -import sys # rich helps pretty print everything from rich.console import Console @@ -20,7 +18,7 @@ from .help_text import RichCommand, options_help from .env_config import check_os_support, OS, process_configs, USR_CONFIG_FILE from .env_config import DEFAULTS as OPTS -from .console_logging import print_panel, print_manual_steps +from .console_logging import print_manual_steps HELP = options_help() @@ -131,7 +129,7 @@ def main(log_level: str = "", elif step in ['vim_setup', 'neovim_setup', 'font_setup']: # import step from ide_setup.py in same directory - importlib.import_module(f'onboardme.ide_setup', package=f'.{step}') + importlib.import_module('onboardme.ide_setup', package=f'.{step}') func = getattr(ide_setup, step) func() diff --git a/onboardme/config/packages.yml b/onboardme/config/packages.yml index 463f2548..fb6800cc 100644 --- a/onboardme/config/packages.yml +++ b/onboardme/config/packages.yml @@ -82,6 +82,7 @@ pip3.10: packages: default: # this is for python development + - flake8 - pip - build - twine diff --git a/onboardme/env_config.py b/onboardme/env_config.py index 735f841a..5a32bd3b 100755 --- a/onboardme/env_config.py +++ b/onboardme/env_config.py @@ -19,6 +19,7 @@ def load_yaml(yaml_config_file=""): # print(f"Config file we got was not present: {yaml_config_file}") return None + # pathing PWD = path.dirname(__file__) HOME_DIR = getenv("HOME") @@ -143,7 +144,7 @@ def process_configs(overwrite=False, repo="", git_branch="", pkg_mngrs=[], extra={"markup": True}) usr_cfgs = fill_in_defaults(DEFAULTS, USR_CONFIG_FILE) - log.debug("after user_config_file filled in with defaults: " + \ + log.debug("after user_config_file filled in with defaults: " + f"{usr_cfgs}", extra={"markup": True}) final_defaults = fill_in_defaults(cli_dict, usr_cfgs, True) diff --git a/onboardme/help_text.py b/onboardme/help_text.py index 0032c2d8..e1c0e7e0 100755 --- a/onboardme/help_text.py +++ b/onboardme/help_text.py @@ -100,8 +100,8 @@ class OptionHighlighter(RegexHighlighter): desc = ( "[steel_blue]Get your daily driver just the way you like it, from " "[b]text[/] [i]formatting[/], and dot files to opensource package " - "installation, onboardme intends to save you time with initializing" - " or upgrading your environment.") + "installation, onboardme intends to save you time with " + "initializing or upgrading your environment.") console.print(title + desc, justify="center") diff --git a/onboardme/pkg_management.py b/onboardme/pkg_management.py index 9d95e52a..4015bde0 100755 --- a/onboardme/pkg_management.py +++ b/onboardme/pkg_management.py @@ -4,7 +4,8 @@ # custom libs from .env_config import OS, PWD, load_yaml -from .console_logging import print_header, print_sub_header, print_msg +from .console_logging import print_header, print_msg +from .console_logging import print_sub_header as sub_header from .subproc import subproc @@ -37,7 +38,7 @@ def brew_install_upgrade(package_groups=['default']): if os_brewfile: os_msg = f'[b]{OS[0]}[/b] specific package installs...' - print_sub_header(os_msg) + sub_header(os_msg) subproc([f'{install_cmd}{OS[0]}'], error_ok=True) print_msg(f'{OS[0]} specific packages installed.') @@ -47,12 +48,12 @@ def brew_install_upgrade(package_groups=['default']): if group != "default" and path.exists(group_file): # Installing devops specific brew app Installs/Upgrades msg = f"{group.title()} specific package installs..." - print_sub_header(msg) + sub_header(msg) subproc([f'{install_cmd}{group}'], error_ok=True) print_msg(f'{group.title()} specific packages installed.') # cleanup operation doesn't seem to happen automagically :shrug: - print_sub_header('[b]brew[/b] final cleanup') + sub_header('[b]brew[/b] final cleanup') subproc(['brew cleanup']) print_msg('Cleanup completed.') return @@ -102,26 +103,23 @@ def run_pkg_mngrs(pkg_mngrs=[], pkg_groups=[]): if 'sudo' in pkg_cmds[pre_cmd]: SPINNER = False subproc([pkg_cmds[pre_cmd]], spinner=SPINNER) - print_sub_header(f"[b]{pre_cmd.title()}[/b] completed.") + sub_header(f"[b]{pre_cmd.title()}[/b] completed.") # list of actually installed packages installed_pkgs = subproc([pkg_cmds['list']], quiet=True) for pkg_group in pkg_groups: if pkg_group in required_pkg_groups: - if pkg_group != 'default': - # msg = (f"Installing [i]{pkg_group}[/i] packages") - # print_msg(msg) - install_pkg_group(installed_pkgs, required_pkg_groups[pkg_group], pkg_cmds['install']) - print_sub_header(f'{pkg_group.title()} packages installed.') + sub_header(f'{pkg_group.title()} packages installed.') if 'cleanup' in pkg_cmds: subproc([pkg_cmds['cleanup']]) - print_sub_header("[b]Cleanup[/b] step Completed.") + sub_header("[b]Cleanup[/b] step Completed.") + # return diff --git a/onboardme/subproc.py b/onboardme/subproc.py index d4043880..14546d93 100644 --- a/onboardme/subproc.py +++ b/onboardme/subproc.py @@ -6,7 +6,6 @@ import logging as log from subprocess import PIPE, Popen -from rich import print from rich.console import Console @@ -19,7 +18,7 @@ def subproc(commands=[], **kwargs): spinner - show an animated progress spinner. can break sudo prompts and should be turned off. Default: True cwd - path to run commands in. Default: pwd of user - shell - use shell with subprocess or not. Default: False + shell - use shell with subprocess or not. Default: False env - dictionary of env variables for BASH. Default: None """ @@ -60,7 +59,7 @@ def run_subprocess(command, **kwargs): Optional keyword vars: error_ok - bool, catch errors, defaults to False cwd - str, current working dir which is the dir to run command in - shell - bool, run shell or not + shell - bool, run shell or not env - environment variables you'd like to pass in """ # subprocess expects a list if there are spaces in the command diff --git a/setup.py b/setup.py index a1eea8be..5d7f2209 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def readme(): lic_class], python_requires='>3.10', keywords='onboardme, onboarding, desktop-setup, setuptools, development', - version='0.14.13_a9', + version='0.14.13_a10', project_urls={ 'Documentation': 'https://jessebot.github.io/onboardme/onboardme', 'Source': 'http://github.com/jessebot/onboardme',