Skip to main content

A collection of automation tools for Python projects

Project description

zyt_auto_tools

PyPI Version License Python Version

zyt_auto_tools 是一个 Python 工具集,旨在帮助开发者自动化常见的项目任务。它包含以下工具:

  1. 自动生成 __init__.py 文件:根据指定目录下的指定部分文件,自动生成 __init__.py 文件。
  2. 自动创建 Python 文件:快速生成带有标准模板的 Python 文件。
  3. 自动更新文件修改时间:更新项目中今天修改过的 .py 文件的 Update 日期。
  4. 自动生成项目结构图:生成项目的目录结构图,支持文本和 .gitignore 规则。
  5. 自动创建 Python 项目文件夹:快速生成指定类型的 Python 项目架构文件夹。

安装

你可以通过 pip 安装这个工具集:

pip install zyt-auto-tools

使用方法

1. 自动生成 __init__.py 文件

在项目根目录下运行以下命令,自动生成指定目录下的 __init__.py 文件(默认utils下全部文件):

auto-generate-init

① 你还可以通过 '-d' 或 '--dir' 指定目标目录(默认utils):

auto-generate-init --dir ./my_project

② 你还可以通过 '-i' 或 '--include' 指定所包含的文件名(默认选择包含以.py结尾的文件):

# 例如选择文件名中含有xxx的文件
auto-generate-init --include *xxx*

③ 你还可以通过 '-t' 或 '--type' 来选择生成的内容(func:全部函数;file:只包含文件,默认func):

auto-generate-init --type file
or
auto-generate-init --type func

④ 你还可以通过 '-a' 或 '--author' 指定作者:

auto-generate-init --author your_name
作者名可以通过环境变量 DEFAULT_AUTHOR 设置:
# Linux
export DEFAULT_AUTHOR=your_name
or
# Windows
$env:DEFAULT_AUTHOR = "your_name"

2. 自动创建 Python 文件

使用以下命令快速创建一个带有标准模板的 Python 文件(默认在项目根目录下,默认本作者):

auto-init-python-file my_script.py

① 你还可以通过 '-d' 或 '--dir' 指定目标目录:

auto-init-python-file my_script.py --dir ./my_project

② 你还可以通过 '-a' 或 '--author' 指定作者:

auto-init-python-file my_script.py --author your_name
作者名可以通过环境变量 DEFAULT_AUTHOR 设置:
# Linux
export DEFAULT_AUTHOR=your_name
or
# Windows
$env:DEFAULT_AUTHOR = "your_name"

3. 自动更新文件修改时间

在项目根目录下运行以下命令,更新全部根目录下今天修改过的 .py 文件的 Update 日期:

auto-update-ctime

① 你还可以通过 '-d' 或 '--dir' 指定目标目录:

auto-update-ctime --dir ./my_project

4. 自动生成项目结构图

在项目根目录下运行以下命令,生成项目的目录结构图(默认输出到控制台):

auto-create-structure

① 你还可以通过 '-d' 或 '--dir' 指定目标目录:

auto-create-structure --dir ./my_project

② 你还可以通过 -o 或 --output 指定输出文件路径:

auto-create-structure --output project_structure.txt

③ 你还可以通过 -i 或 --ignore 指定额外忽略的目录/文件(支持通配符):

auto-create-structure --ignore *.log tests/

④ 你还可以通过 --use-gitignore 使用 .gitignore 文件中的规则替换默认忽略列表:

auto-create-structure --use-gitignore

5. 自动创建 Python 项目文件夹

使用以下命令快速创建指定类型的 Python 项目文件夹(默认在项目根目录下,默认本作者, 默认类型为标准的python文件夹):

auto-init-python-dir

① 你还可以通过 '-t' 或 '--type' 指定项目类型(支持None, software, crawler, spiders):

auto-init-python-dir --type software

② 你还可以通过 '-d' 或 '--dir' 指定目标目录:

auto-init-python-dir --dir ./my_project

③ 你还可以通过 '-a' 或 '--author' 指定作者:

auto-init-python-dir --author your_name
作者名可以通过环境变量 DEFAULT_AUTHOR 设置:
# Linux
export DEFAULT_AUTHOR=your_name
or
# Windows
$env:DEFAULT_AUTHOR = "your_name"

贡献

欢迎贡献代码!

许可证

本项目基于 MIT 许可证 开源。

作者

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zyt_auto_tools-0.4.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zyt_auto_tools-0.4.0-py3-none-any.whl (204.6 kB view details)

Uploaded Python 3

File details

Details for the file zyt_auto_tools-0.4.0.tar.gz.

File metadata

  • Download URL: zyt_auto_tools-0.4.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.7

File hashes

Hashes for zyt_auto_tools-0.4.0.tar.gz
Algorithm Hash digest
SHA256 799c5e3c361d5525ca3fbb4ba7c0ac2be301ad309ef7f51fd8c856912cbe1740
MD5 e72621ec383212932c90efd6c78a291f
BLAKE2b-256 86cae3cc6cace5d9e3516eba9bfed1e48516287e6fa1390751cc59273157b1ab

See more details on using hashes here.

File details

Details for the file zyt_auto_tools-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: zyt_auto_tools-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 204.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.7

File hashes

Hashes for zyt_auto_tools-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1dbbbf48ab3dfbd13a4d106fea4cd9dd18b8016e4ae424371e6dcee599924d85
MD5 ff7d53c43c24a5547dc10f6ecc518eb9
BLAKE2b-256 195cb9bfc67a6ef31f3aace67e0ef28892fbb46b08ba182b2cd2fe1e3d481ff4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page