python命令行工具pytcli,环境配置,环境辅助神器

关于toollib

pytcli命令行
Usage:
  pytcli  [options]
Commands:
  -h/--help         帮助
  set-pip           设置pip源
  set-conda         设置conda源
  set-mirrors       设置镜像源
  set-sshkey        设置ssh免密
  docker            docker操作
  py2pyd            py转pyd
  snowflake         雪花服务    
  tpl2bash          模板到bash
  tpl2grpc          模板到grpc
  • 安装toollib
    • 执行命令:pip install toollib
详细列表
  • 设置pip源,加速访问

    • 命令行执行:pytcli set-pip
  • 设置conda源,加速访问

    • 命令行执行:pytcli set-conda
  • 设置镜像源,加速访问

    • 命令行执行:pytcli set-mirrors -s ubuntu20.04
  • 设置ssh免密

    usage:
      pytcli set-sshkey
    options:
      -h/--help     帮助
      -i/--infos    主机信息("ip1,user1,pass1,port1 ip2,user2,pass2,port2 ..."|也可指定文件:一行一个)[可选]
      --sysname     系统名称(以防自动获取不精确)[可选]
    
    • 命令行执行,如:pytcli set-sshkey -i "192.168.22.20,root,root@123,22 192.168.22.21,root,root@123,22"
  • docker操作(详情 >>>

  • py转pyd

    usage:
      pytcli py2pyd [options]
    options:
      -h/--help         帮助
      -s/--src          源(py目录或文件)
      -p/--postfix      后缀(默认为Pyd)[可选]
      -e/--exclude      排除编译(适用正则,使用管道等注意加引号)[可选]
      -i/--ignore       忽略复制(多个逗号隔开)[可选]
      -c/--clean        清理临时[可选]
    
    • 命令行执行,如:pytcli py2pyd -s x.py
  • 雪花服务(雪花算法id生成器)(代码式调用 >>>

    usage:
      pytcli snowflake [options]
    options:
      -h/--help         帮助
      --host            host[可选]
      --port            port[可选]
      --workers         进程数[可选]
    
    • 1)服务采用fastapi+uvicorn实现(需安装库):pip install fastapi uvicorn
    • 2)linux启动服务(参数请自行指定):nohup pytcli snowflake > snowflake.log 2>&1 &
    • 3)调用api(ip端口参数请自行修改):
      • 请求url:http://localhost:9000/gen-snowid
      • 可选参数:to_str(默认false)
        • 生成整形:http://localhost:9000/gen-snowid?to_str=false
        • 生成字符串:http://localhost:9000/gen-snowid?to_str=true
      • 返回结果(JSON格式):{"snowid": <雪花id>}
  • 模板到bash(详情 >>>

  • 模板到grpc

    • 命令行执行:pytcli tpl2grpc -n hello -d tplgrpc
      • n: 表示名称[可选]
      • d: 目录[可选]

你可能感兴趣的:(Python,项目部署,linux,python,命令行工具,pytcli,环境配置,环境辅助)