fcmd 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fcmd-0.2.2 → fcmd-0.2.4}/.bumpversion.toml +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/Makefile +6 -3
- {fcmd-0.2.2 → fcmd-0.2.4}/PKG-INFO +9 -4
- {fcmd-0.2.2 → fcmd-0.2.4}/README.md +8 -3
- fcmd-0.2.4/docs/api.rst +120 -0
- fcmd-0.2.4/docs/changelog.rst +117 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/docs/conf.py +4 -0
- fcmd-0.2.4/docs/index.rst +120 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/pyproject.toml +4 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/pyrefly.toml +2 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/__init__.py +1 -1
- fcmd-0.2.4/src/fcmd/_dependency_runner.py +129 -0
- fcmd-0.2.4/src/fcmd/_layer_runner.py +178 -0
- fcmd-0.2.4/src/fcmd/_task_runner.py +464 -0
- fcmd-0.2.4/src/fcmd/apis/_tool_args.py +343 -0
- fcmd-0.2.4/src/fcmd/apis/_tool_exec.py +340 -0
- fcmd-0.2.4/src/fcmd/apis/toolkit.py +331 -0
- fcmd-0.2.4/src/fcmd/cli/_doctor_helpers.py +143 -0
- fcmd-0.2.4/src/fcmd/cli/_env_helpers.py +41 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/_env_persist.py +3 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/archivex.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/asciitool.py +5 -4
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/bumpversion.py +6 -5
- fcmd-0.2.4/src/fcmd/cli/calcdate.py +263 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/casetool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/codetool.py +4 -3
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/colortool.py +3 -2
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/convtool.py +3 -2
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/cryptool.py +11 -8
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/csvtool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/envdev.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/filedate.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/filelevel.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/filerename.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/filesearch.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/folderback.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/gittool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/hashfile.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/hashtool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/idtool.py +5 -4
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/imagetool.py +1 -1
- fcmd-0.2.4/src/fcmd/cli/inifile.py +282 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/iptool.py +4 -3
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/jsontool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/lscalc.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/main.py +7 -113
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/mathtool.py +5 -4
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/nettool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/packtool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/padtool.py +6 -5
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/pathtool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/pdftool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/piptool.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/portcheck.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/pymake.py +6 -2
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/randtool.py +6 -5
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/regextool.py +6 -5
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/screenshot.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/stattool.py +3 -2
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/sysinfo.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/taskkill.py +3 -3
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/textdiff.py +1 -1
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/timetool.py +4 -3
- fcmd-0.2.4/src/fcmd/cli/tomltool.py +289 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/txttool.py +3 -2
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/urltool.py +6 -5
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/xmltool.py +5 -4
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/yamtool.py +6 -5
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/zipencrypt.py +1 -1
- fcmd-0.2.4/src/fcmd/executors.py +286 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/models/command.py +2 -11
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/models/filefilter.py +2 -7
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/models/version.py +3 -12
- fcmd-0.2.4/tests/test_cli_calcdate.py +288 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_cryptool.py +3 -1
- fcmd-0.2.4/tests/test_cli_inifile.py +228 -0
- fcmd-0.2.4/tests/test_cli_tomltool.py +243 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_executors.py +5 -5
- fcmd-0.2.4/tests/test_perf_baseline.py +187 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_toolkit.py +17 -17
- {fcmd-0.2.2 → fcmd-0.2.4}/uv.lock +1 -1
- fcmd-0.2.2/docs/api.rst +0 -7
- fcmd-0.2.2/docs/changelog.rst +0 -7
- fcmd-0.2.2/docs/index.rst +0 -58
- fcmd-0.2.2/src/fcmd/apis/toolkit.py +0 -875
- fcmd-0.2.2/src/fcmd/executors.py +0 -951
- {fcmd-0.2.2 → fcmd-0.2.4}/.copier-answers.yml +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.coveragerc +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.gitattributes +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.github/workflows/ci.yml +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.github/workflows/release.yml +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.gitignore +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.pre-commit-config.yaml +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.python-version +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.readthedocs.yaml +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/.vscode/settings.json +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/LICENSE +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/docs/_static/.gitkeep +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/pytest.ini +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/ruff.toml +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/__main__.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/_compat.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/apis/__init__.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/apis/context.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/apis/dag.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/apis/errors.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/apis/profiling.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/apis/report.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/apis/task.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/__init__.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/_common.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/_completion_scripts.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/_profiler_helpers.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/autofmt.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/clr.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/dockercmd.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/folderzip.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/reseticoncache.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/setenv.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/sshcopyid.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/which.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/cli/writefile.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/command.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/conditions.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/console.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/models/__init__.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/py.typed +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/src/fcmd/yaml_loader.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/__init__.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_archivex.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_asciitool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_autofmt.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_bumpversion.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_casetool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_clr.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_codetool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_colortool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_convtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_csvtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_dockercmd.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_envdev.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_filedate.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_filelevel.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_filerename.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_filesearch.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_folderback.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_folderzip.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_gittool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_hashfile.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_hashtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_idtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_imagetool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_iptool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_jsontool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_lscalc.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_mathtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_nettool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_packtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_padtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_pathtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_pdftool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_piptool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_portcheck.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_profiler.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_pymake.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_randtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_regextool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_reseticoncache.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_screenshot.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_setenv.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_sshcopyid.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_stattool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_sysinfo.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_taskkill.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_textdiff.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_timetool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_txttool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_urltool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_which.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_writefile.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_xmltool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_yamtool.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_cli_zipencrypt.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_command.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_conditions.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_console.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_context.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_env_persist.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_fcmd.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_graph.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_init.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_models.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_profiling.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_report.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_task.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tests/test_yaml_loader.py +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/tox.ini +0 -0
- {fcmd-0.2.2 → fcmd-0.2.4}/uv.toml +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
PACKAGE := fcmd
|
|
5
5
|
COV_THRESHOLD := 95
|
|
6
6
|
|
|
7
|
-
.PHONY: help sync build b clean c test cov lint typecheck check doc tox bump patch minor major push
|
|
7
|
+
.PHONY: help sync build b clean c test cov lint typecheck typecheck-ci check doc tox bump patch minor major push
|
|
8
8
|
|
|
9
9
|
help: ## 显示帮助信息
|
|
10
10
|
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z].*:.*##/ {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
@@ -31,10 +31,13 @@ lint: ## 代码风格检查 (ruff)
|
|
|
31
31
|
uv run ruff check .
|
|
32
32
|
uv run ruff format --check .
|
|
33
33
|
|
|
34
|
-
typecheck: ## 类型检查 (pyrefly)
|
|
34
|
+
typecheck: ## 类型检查 (pyrefly, 本地平台)
|
|
35
35
|
uv run pyrefly check
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
typecheck-ci: ## 类型检查 (pyrefly, CI 平台 linux — 捕获跨平台问题)
|
|
38
|
+
uv run pyrefly check --python-platform linux
|
|
39
|
+
|
|
40
|
+
check: lint typecheck typecheck-ci cov ## 运行全套门禁 (lint + typecheck + typecheck-ci + cov)
|
|
38
41
|
|
|
39
42
|
doc: ## 构建 Sphinx 文档
|
|
40
43
|
uv run sphinx-build -b html docs docs/_build/html
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fcmd
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: 极速 Python 工具集应用:DAG 任务调度 + 组合 CLI
|
|
5
5
|
Author: fcmd
|
|
6
6
|
License: MIT
|
|
@@ -70,7 +70,7 @@ Description-Content-Type: text/markdown
|
|
|
70
70
|
- **极速冷启动**(< 100ms):三层懒加载,核心模块零外部依赖
|
|
71
71
|
- **DAG 任务调度**:四种执行策略(sequential/thread/async/dependency)
|
|
72
72
|
- **组合 API 简洁**:`@fx.task` 装饰器 + 自动依赖推断 + `@fx.tool` CLI 工具
|
|
73
|
-
- **纯 CLI
|
|
73
|
+
- **纯 CLI(自实现 Console)**:ASCII 表格、彩色输出、Win7/8 兼容
|
|
74
74
|
- **便捷脚本模式**:`fcmd pymake b` 一键调用
|
|
75
75
|
- **YAML 编排**:GitHub Actions 风格的 `jobs`/`needs`/`matrix`/`if` 任务图
|
|
76
76
|
- **零配置工具发现**:`fcmd/cli/` 下的模块自动注册为 CLI 子命令
|
|
@@ -127,7 +127,7 @@ fcmd doctor # 诊断环境问题
|
|
|
127
127
|
|
|
128
128
|
## 内建命令
|
|
129
129
|
|
|
130
|
-
`fcmd` 自带
|
|
130
|
+
`fcmd` 自带 7 个内建命令(不通过 `@fx.tool` 注册):
|
|
131
131
|
|
|
132
132
|
| 命令 | 说明 |
|
|
133
133
|
|------|------|
|
|
@@ -137,6 +137,7 @@ fcmd doctor # 诊断环境问题
|
|
|
137
137
|
| `fcmd yaml <file> [job]` | 从 YAML 加载任务图并执行(支持 `--dry-run`/`--strategy`) |
|
|
138
138
|
| `fcmd env [--json]` | 展示运行环境(fcmd 版本、Python、平台、工具数、可选依赖) |
|
|
139
139
|
| `fcmd doctor` | 诊断环境问题(Python 版本、核心模块、工具模块、可选依赖、PATH 命令) |
|
|
140
|
+
| `fcmd profiler <script.py> [args] [-E html\|text] [-o FILE] [--no-browser]` | 分析含 `fx.run()` 的脚本,生成性能剖面报告(HTML/文本) |
|
|
140
141
|
|
|
141
142
|
shell 补全安装:
|
|
142
143
|
|
|
@@ -148,7 +149,7 @@ fcmd completion --shell fish | source # fish
|
|
|
148
149
|
|
|
149
150
|
## 工具列表
|
|
150
151
|
|
|
151
|
-
|
|
152
|
+
57 个工具模块,按用途分组:
|
|
152
153
|
|
|
153
154
|
### 项目构建与发布
|
|
154
155
|
|
|
@@ -197,7 +198,9 @@ fcmd completion --shell fish | source # fish
|
|
|
197
198
|
| `stattool` | - | 统计工具(mean/median/variance/quantile) |
|
|
198
199
|
| `textdiff` | - | 文本比较(行级 diff,统一格式输出) |
|
|
199
200
|
| `timetool` | - | 时间工具(convert/format/timezone) |
|
|
201
|
+
| `calcdate` | - | 日期计算(add/workdays/diff/compare) |
|
|
200
202
|
| `urltool` | - | URL 解析(编码/解码/拆分/拼接) |
|
|
203
|
+
| `cryptool` | - | 文本对称加密(genkey/encrypt/decrypt,PBKDF2 + HMAC-SHA256 CTR + Encrypt-then-MAC) |
|
|
201
204
|
|
|
202
205
|
### 数据格式
|
|
203
206
|
|
|
@@ -205,6 +208,8 @@ fcmd completion --shell fish | source # fish
|
|
|
205
208
|
|------|------|------|
|
|
206
209
|
| `xmltool` | - | XML 处理(pretty/get/keys/validate) |
|
|
207
210
|
| `yamtool` | - | YAML 处理(pretty/get/keys/validate) |
|
|
211
|
+
| `inifile` | - | INI 处理(get/set/list/keys,基于 configparser) |
|
|
212
|
+
| `tomltool` | - | TOML 处理(get/keys/format/validate,3.11+ 用 tomllib,3.8-3.10 回退 tomli) |
|
|
208
213
|
|
|
209
214
|
### 多媒体(可选依赖)
|
|
210
215
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- **极速冷启动**(< 100ms):三层懒加载,核心模块零外部依赖
|
|
8
8
|
- **DAG 任务调度**:四种执行策略(sequential/thread/async/dependency)
|
|
9
9
|
- **组合 API 简洁**:`@fx.task` 装饰器 + 自动依赖推断 + `@fx.tool` CLI 工具
|
|
10
|
-
- **纯 CLI
|
|
10
|
+
- **纯 CLI(自实现 Console)**:ASCII 表格、彩色输出、Win7/8 兼容
|
|
11
11
|
- **便捷脚本模式**:`fcmd pymake b` 一键调用
|
|
12
12
|
- **YAML 编排**:GitHub Actions 风格的 `jobs`/`needs`/`matrix`/`if` 任务图
|
|
13
13
|
- **零配置工具发现**:`fcmd/cli/` 下的模块自动注册为 CLI 子命令
|
|
@@ -64,7 +64,7 @@ fcmd doctor # 诊断环境问题
|
|
|
64
64
|
|
|
65
65
|
## 内建命令
|
|
66
66
|
|
|
67
|
-
`fcmd` 自带
|
|
67
|
+
`fcmd` 自带 7 个内建命令(不通过 `@fx.tool` 注册):
|
|
68
68
|
|
|
69
69
|
| 命令 | 说明 |
|
|
70
70
|
|------|------|
|
|
@@ -74,6 +74,7 @@ fcmd doctor # 诊断环境问题
|
|
|
74
74
|
| `fcmd yaml <file> [job]` | 从 YAML 加载任务图并执行(支持 `--dry-run`/`--strategy`) |
|
|
75
75
|
| `fcmd env [--json]` | 展示运行环境(fcmd 版本、Python、平台、工具数、可选依赖) |
|
|
76
76
|
| `fcmd doctor` | 诊断环境问题(Python 版本、核心模块、工具模块、可选依赖、PATH 命令) |
|
|
77
|
+
| `fcmd profiler <script.py> [args] [-E html\|text] [-o FILE] [--no-browser]` | 分析含 `fx.run()` 的脚本,生成性能剖面报告(HTML/文本) |
|
|
77
78
|
|
|
78
79
|
shell 补全安装:
|
|
79
80
|
|
|
@@ -85,7 +86,7 @@ fcmd completion --shell fish | source # fish
|
|
|
85
86
|
|
|
86
87
|
## 工具列表
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
57 个工具模块,按用途分组:
|
|
89
90
|
|
|
90
91
|
### 项目构建与发布
|
|
91
92
|
|
|
@@ -134,7 +135,9 @@ fcmd completion --shell fish | source # fish
|
|
|
134
135
|
| `stattool` | - | 统计工具(mean/median/variance/quantile) |
|
|
135
136
|
| `textdiff` | - | 文本比较(行级 diff,统一格式输出) |
|
|
136
137
|
| `timetool` | - | 时间工具(convert/format/timezone) |
|
|
138
|
+
| `calcdate` | - | 日期计算(add/workdays/diff/compare) |
|
|
137
139
|
| `urltool` | - | URL 解析(编码/解码/拆分/拼接) |
|
|
140
|
+
| `cryptool` | - | 文本对称加密(genkey/encrypt/decrypt,PBKDF2 + HMAC-SHA256 CTR + Encrypt-then-MAC) |
|
|
138
141
|
|
|
139
142
|
### 数据格式
|
|
140
143
|
|
|
@@ -142,6 +145,8 @@ fcmd completion --shell fish | source # fish
|
|
|
142
145
|
|------|------|------|
|
|
143
146
|
| `xmltool` | - | XML 处理(pretty/get/keys/validate) |
|
|
144
147
|
| `yamtool` | - | YAML 处理(pretty/get/keys/validate) |
|
|
148
|
+
| `inifile` | - | INI 处理(get/set/list/keys,基于 configparser) |
|
|
149
|
+
| `tomltool` | - | TOML 处理(get/keys/format/validate,3.11+ 用 tomllib,3.8-3.10 回退 tomli) |
|
|
145
150
|
|
|
146
151
|
### 多媒体(可选依赖)
|
|
147
152
|
|
fcmd-0.2.4/docs/api.rst
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
API 参考
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
本节按模块组织 fcmd 的公共 API。顶层包 ``fcmd`` 通过 ``__getattr__`` 懒加载聚合
|
|
5
|
+
各子模块符号,确保 ``import fcmd`` 冷启动 < 100ms;首次访问 ``fx.task`` /
|
|
6
|
+
``fx.run`` 等才触发对应模块导入。
|
|
7
|
+
|
|
8
|
+
顶层 API
|
|
9
|
+
--------
|
|
10
|
+
|
|
11
|
+
.. automodule:: fcmd
|
|
12
|
+
:members:
|
|
13
|
+
:undoc-members:
|
|
14
|
+
:show-inheritance:
|
|
15
|
+
:exclude-members: __version__
|
|
16
|
+
|
|
17
|
+
任务与图
|
|
18
|
+
--------
|
|
19
|
+
|
|
20
|
+
任务定义、依赖推断与 DAG 构建。
|
|
21
|
+
|
|
22
|
+
.. automodule:: fcmd.apis.dag
|
|
23
|
+
:members:
|
|
24
|
+
:undoc-members:
|
|
25
|
+
:show-inheritance:
|
|
26
|
+
|
|
27
|
+
.. automodule:: fcmd.apis.task
|
|
28
|
+
:members:
|
|
29
|
+
:undoc-members:
|
|
30
|
+
:show-inheritance:
|
|
31
|
+
|
|
32
|
+
执行器
|
|
33
|
+
------
|
|
34
|
+
|
|
35
|
+
四种执行策略(``sequential`` / ``thread`` / ``async`` / ``dependency``)
|
|
36
|
+
与对应的 Runner 实现。
|
|
37
|
+
|
|
38
|
+
.. automodule:: fcmd.executors
|
|
39
|
+
:members:
|
|
40
|
+
:undoc-members:
|
|
41
|
+
:show-inheritance:
|
|
42
|
+
|
|
43
|
+
工具箱
|
|
44
|
+
------
|
|
45
|
+
|
|
46
|
+
``@tool`` 装饰器、``run_tool`` / ``build_tool_graph`` 等 CLI 工具注册与执行 API。
|
|
47
|
+
|
|
48
|
+
.. automodule:: fcmd.apis.toolkit
|
|
49
|
+
:members:
|
|
50
|
+
:undoc-members:
|
|
51
|
+
:show-inheritance:
|
|
52
|
+
|
|
53
|
+
报告与上下文
|
|
54
|
+
------------
|
|
55
|
+
|
|
56
|
+
.. automodule:: fcmd.apis.report
|
|
57
|
+
:members:
|
|
58
|
+
:undoc-members:
|
|
59
|
+
:show-inheritance:
|
|
60
|
+
|
|
61
|
+
.. automodule:: fcmd.apis.context
|
|
62
|
+
:members:
|
|
63
|
+
:undoc-members:
|
|
64
|
+
:show-inheritance:
|
|
65
|
+
|
|
66
|
+
性能分析
|
|
67
|
+
--------
|
|
68
|
+
|
|
69
|
+
``fcmd profiler`` 内建命令背后的剖面数据结构。
|
|
70
|
+
|
|
71
|
+
.. automodule:: fcmd.apis.profiling
|
|
72
|
+
:members:
|
|
73
|
+
:undoc-members:
|
|
74
|
+
:show-inheritance:
|
|
75
|
+
|
|
76
|
+
异常
|
|
77
|
+
----
|
|
78
|
+
|
|
79
|
+
fcmd 异常层次,均继承自 :class:`fcmd.FcmdError`。
|
|
80
|
+
|
|
81
|
+
.. automodule:: fcmd.apis.errors
|
|
82
|
+
:members:
|
|
83
|
+
:undoc-members:
|
|
84
|
+
:show-inheritance:
|
|
85
|
+
|
|
86
|
+
命令执行
|
|
87
|
+
--------
|
|
88
|
+
|
|
89
|
+
.. automodule:: fcmd.command
|
|
90
|
+
:members:
|
|
91
|
+
:undoc-members:
|
|
92
|
+
:show-inheritance:
|
|
93
|
+
|
|
94
|
+
YAML 加载
|
|
95
|
+
---------
|
|
96
|
+
|
|
97
|
+
GitHub Actions 风格的 ``jobs`` / ``needs`` / ``matrix`` / ``if`` 任务图加载。
|
|
98
|
+
|
|
99
|
+
.. automodule:: fcmd.yaml_loader
|
|
100
|
+
:members:
|
|
101
|
+
:undoc-members:
|
|
102
|
+
:show-inheritance:
|
|
103
|
+
|
|
104
|
+
模型
|
|
105
|
+
----
|
|
106
|
+
|
|
107
|
+
.. automodule:: fcmd.models.command
|
|
108
|
+
:members:
|
|
109
|
+
:undoc-members:
|
|
110
|
+
:show-inheritance:
|
|
111
|
+
|
|
112
|
+
.. automodule:: fcmd.models.filefilter
|
|
113
|
+
:members:
|
|
114
|
+
:undoc-members:
|
|
115
|
+
:show-inheritance:
|
|
116
|
+
|
|
117
|
+
.. automodule:: fcmd.models.version
|
|
118
|
+
:members:
|
|
119
|
+
:undoc-members:
|
|
120
|
+
:show-inheritance:
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
更新日志
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
遵循 `Keep a Changelog <https://keepachangelog.com/>`_ 风格,版本倒序排列。
|
|
5
|
+
|
|
6
|
+
v0.2.3 (2026-08-12)
|
|
7
|
+
-------------------
|
|
8
|
+
|
|
9
|
+
- ``feat``: 新增 3 个 CLI 工具:``inifile``(INI 读写,configparser)、``tomltool``(TOML 解析,3.11+ tomllib / 3.8-3.10 回退 tomli)、``calcdate``(日期计算 add/workdays/diff/compare)
|
|
10
|
+
- ``refactor``: 拆分 ``executors.py``,抽取 Runner 抽象与 LayerRunner 系列,简化 ``_dispatch_strategy``
|
|
11
|
+
- ``refactor``: 拆分 ``toolkit.py``,参数解析移至 ``apis/_tool_args.py``,执行逻辑移至 ``apis/_tool_exec.py``
|
|
12
|
+
- ``refactor``: 拆分 ``main.py`` 内建命令纯函数辅助到 ``cli/_env_helpers.py`` 与 ``cli/_doctor_helpers.py``
|
|
13
|
+
- ``refactor``: 审计异常处理模式,统一 CLI 错误打印格式
|
|
14
|
+
- ``perf``: 建立性能基线(cold start / tool discovery / DAG / tool exec),工具发现耗时从 126ms 降至 63ms
|
|
15
|
+
- ``chore``: 死代码扫描清理,复测性能基线对比
|
|
16
|
+
|
|
17
|
+
v0.2.2 (2026-08-12)
|
|
18
|
+
-------------------
|
|
19
|
+
|
|
20
|
+
- ``feat(envdev)``: 新增 Bun 环境配置功能,完善 Rust 子命令实现
|
|
21
|
+
- ``feat(portcheck)``: 端口占用时显示进程详情(PID/名称/状态/用户)
|
|
22
|
+
- ``fix``: envdev 镜像源环境变量实质持久化到用户层面(Windows 注册表 + Linux/macOS profile)
|
|
23
|
+
- ``refactor``: 清理死代码与重复工具,删除 basetool 合并到 codetool
|
|
24
|
+
- ``refactor``: 提升代码质量,覆盖率 98.04% → 98.16%,补全异常处理注释
|
|
25
|
+
- ``chore``: 清理项目内废弃的 .trae 文档与配置文件,envdev 默认镜像源改为 aliyun
|
|
26
|
+
|
|
27
|
+
v0.2.1 (2026-08-08)
|
|
28
|
+
-------------------
|
|
29
|
+
|
|
30
|
+
- ``refactor(envdev)``: 重构 envdev 子命令,发布版本 0.2.1
|
|
31
|
+
- ``perf``: 修复打包后管道输出无内容的问题
|
|
32
|
+
- ``fix``: 为所有 CLI 工具模块添加 ``if __name__ == "__main__"`` 块,修复 fspack 打包后单独运行无输出
|
|
33
|
+
|
|
34
|
+
v0.2.0 (2026-07-31)
|
|
35
|
+
-------------------
|
|
36
|
+
|
|
37
|
+
- ``refactor``: 重构项目结构,将核心 API 抽取到 ``apis`` 子模块(dag/task/toolkit/report/context/profiling/errors)
|
|
38
|
+
- ``refactor``: 重构项目 API 结构,将核心模块迁移至 apis 目录
|
|
39
|
+
|
|
40
|
+
v0.1.10 (2026-07-31)
|
|
41
|
+
--------------------
|
|
42
|
+
|
|
43
|
+
- ``chore``: 移除 pymake 任务中多余的 c 依赖并更新相关测试
|
|
44
|
+
|
|
45
|
+
v0.1.9 (2026-07-31)
|
|
46
|
+
-------------------
|
|
47
|
+
|
|
48
|
+
- ``chore``: 移除 pymake 任务中多余的 c 依赖并更新相关测试
|
|
49
|
+
|
|
50
|
+
v0.1.8 (2026-07-30)
|
|
51
|
+
-------------------
|
|
52
|
+
|
|
53
|
+
- ``refactor``: 拆分 ``run_tool`` / ``run_command`` 高复杂度函数并修复 RET 风格
|
|
54
|
+
- ``refactor``: 提取 main.py 补全生成器与 profiler 辅助函数到独立模块(``_completion_scripts`` / ``_profiler_helpers``)
|
|
55
|
+
- ``fix(console)``: 兼容 Win7/8 终端宽度,修复表格超出窗口问题
|
|
56
|
+
- ``fix(console)``: Win7/8 下强制 ascii_only 修复 box 字符乱码
|
|
57
|
+
- ``fix(console)``: 改用 AsciiBoxStream 包装 stdout 兜底 Win7 乱码
|
|
58
|
+
- ``fix(console)``: ``_display_width`` 补全 Fullwidth 字符宽度计算
|
|
59
|
+
|
|
60
|
+
v0.1.7 (2026-07-30)
|
|
61
|
+
-------------------
|
|
62
|
+
|
|
63
|
+
- ``perf``: pdftool 惰性导入 fitz/pypdf,工具发现耗时从 163ms 降至 126ms
|
|
64
|
+
- ``fix``: 缩窄 basetool.py 的异常捕获范围,符合 python-standards 硬约束
|
|
65
|
+
- ``refactor``: 删除 randtool 两处不可达 raise 并补测 timetool 无效 from_tz 分支
|
|
66
|
+
|
|
67
|
+
v0.1.6 (2026-07-29)
|
|
68
|
+
-------------------
|
|
69
|
+
|
|
70
|
+
- ``build``: 适配 Python 3.12+ 版本的依赖包
|
|
71
|
+
- ``fix(taskkill)``: 修复跨平台路径拼接导致的进程爆炸问题
|
|
72
|
+
|
|
73
|
+
v0.1.5 (2026-07-29)
|
|
74
|
+
-------------------
|
|
75
|
+
|
|
76
|
+
- ``fix(pdf)``: 降级 Win7 环境的 PyMuPDF 版本至 1.22 系列(mupdfcpp64.dll 链接了 Win7 UCRT 不支持的函数)
|
|
77
|
+
|
|
78
|
+
v0.1.4 (2026-07-29)
|
|
79
|
+
-------------------
|
|
80
|
+
|
|
81
|
+
- ``fix(cli)``: 修复 taskkill 递归调用自身的进程爆炸问题
|
|
82
|
+
- ``build``: 修复命令行别名拼写错误并适配 Win7 Python 环境
|
|
83
|
+
|
|
84
|
+
v0.1.3 (2026-07-29)
|
|
85
|
+
-------------------
|
|
86
|
+
|
|
87
|
+
- ``feat``: 新增 7 个 CLI 工具及其测试用例
|
|
88
|
+
- ``refactor``: 统一变量命名并简化代码格式
|
|
89
|
+
|
|
90
|
+
v0.1.2 (2026-07-18 ~ 2026-07-29)
|
|
91
|
+
--------------------------------
|
|
92
|
+
|
|
93
|
+
- ``feat``: 迁移 dockercmd 和 lscalc 两个 CLI 工具到 fcmd
|
|
94
|
+
- ``feat``: 为所有 CLI 工具模块添加独立入口脚本,支持打包后直接命令调用
|
|
95
|
+
- ``build``: 添加 fspack 打包入口声明,解决 src layout 无法识别入口的问题
|
|
96
|
+
- ``refactor``: 重组 CLI 测试文件结构,按工具拆分为单工具测试文件
|
|
97
|
+
|
|
98
|
+
v0.1.1 (2026-07-16 ~ 2026-07-18)
|
|
99
|
+
--------------------------------
|
|
100
|
+
|
|
101
|
+
- ``feat``: 移植 imagetool/pdftool 工具并修复 verbose 回调 Unicode 编码
|
|
102
|
+
- ``feat``: 框架支持 Optional 解包与 bool=True 取反,还原 imagetool 反转语义
|
|
103
|
+
- ``feat``: 新增 ``fcmd env`` 与 ``fcmd doctor`` 内置命令
|
|
104
|
+
- ``feat``: 移植 profiler 性能分析工具,支持离线 HTML/text 报告
|
|
105
|
+
- ``fix``: 修复 ``_unwrap_optional`` 跨 Python 版本兼容性问题
|
|
106
|
+
- ``fix``: 修复测试状态泄漏并补全 command.py 覆盖率至 100%
|
|
107
|
+
|
|
108
|
+
v0.1.0 (2026-07-13 ~ 2026-07-16)
|
|
109
|
+
--------------------------------
|
|
110
|
+
|
|
111
|
+
- 项目初始化,完成基础框架搭建
|
|
112
|
+
- ``feat``: 实现 P0 DAG 调度核心,支持编程式 API ``fx.graph`` / ``fx.run``
|
|
113
|
+
- ``feat``: 实现 P1 ``@fx.tool`` 装饰器框架与 FcmdApp CLI 路由
|
|
114
|
+
- ``feat``: 扩展 pymake 子命令集为完整构建/测试/发布工具集
|
|
115
|
+
- ``feat``: 实现工具自动发现机制替代硬编码注册表
|
|
116
|
+
- ``feat``: 新增 ``fcmd graph`` 内建命令与 ``build_tool_graph`` 公共 API
|
|
117
|
+
- ``feat``: 新增 ``fcmd info`` 内建命令展示工具与子命令元信息
|
|
@@ -63,6 +63,10 @@ intersphinx_mapping = {
|
|
|
63
63
|
language = "zh_CN"
|
|
64
64
|
master_doc = "index"
|
|
65
65
|
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
66
|
+
# fcmd 顶层包通过 __getattr__ 聚合子模块符号,autodoc 会同时索引 fcmd.X 与
|
|
67
|
+
# fcmd.apis.Y.X,导致交叉引用多目标与重复对象描述警告。这些警告不影响文档
|
|
68
|
+
# 功能(Sphinx 自动选首个目标),且 RTD 配置 fail_on_warning: false,此处抑制。
|
|
69
|
+
suppress_warnings = ["ref.python", "duplicate_object"]
|
|
66
70
|
source_suffix = {
|
|
67
71
|
".rst": "restructuredtext",
|
|
68
72
|
".md": "markdown",
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
fcmd
|
|
2
|
+
====
|
|
3
|
+
|
|
4
|
+
极速 Python 工具集应用:DAG 任务调度 + 组合 CLI。
|
|
5
|
+
|
|
6
|
+
.. toctree::
|
|
7
|
+
:maxdepth: 2
|
|
8
|
+
:caption: 目录
|
|
9
|
+
|
|
10
|
+
api
|
|
11
|
+
changelog
|
|
12
|
+
|
|
13
|
+
特性
|
|
14
|
+
====
|
|
15
|
+
|
|
16
|
+
- **极速冷启动** (小于 100ms):三层懒加载,核心模块零外部依赖
|
|
17
|
+
- **DAG 任务调度**:四种执行策略(sequential/thread/async/dependency)
|
|
18
|
+
- **组合 API 简洁**:``@fx.task`` 装饰器 + 自动依赖推断 + ``@fx.tool`` CLI 工具
|
|
19
|
+
- **纯 CLI(自实现 Console)**:ASCII 表格、彩色输出、Win7/8 兼容
|
|
20
|
+
- **YAML 编排**:GitHub Actions 风格的 ``jobs``/``needs``/``matrix``/``if`` 任务图
|
|
21
|
+
- **零配置工具发现**:``fcmd/cli/`` 下的模块自动注册为 CLI 子命令
|
|
22
|
+
|
|
23
|
+
安装
|
|
24
|
+
====
|
|
25
|
+
|
|
26
|
+
.. code-block:: bash
|
|
27
|
+
|
|
28
|
+
pip install fcmd # 或 uv add fcmd
|
|
29
|
+
|
|
30
|
+
可选依赖按需安装:``fcmd[img]`` (Pillow)、``fcmd[pdf]`` (PyMuPDF + pypdf)、
|
|
31
|
+
``fcmd[ocr]`` (pytesseract)、``fcmd[office]`` (img + pdf + ocr)。
|
|
32
|
+
要求 Python ≥ 3.8。
|
|
33
|
+
|
|
34
|
+
快速上手
|
|
35
|
+
========
|
|
36
|
+
|
|
37
|
+
Python API
|
|
38
|
+
----------
|
|
39
|
+
|
|
40
|
+
.. code-block:: python
|
|
41
|
+
|
|
42
|
+
import fcmd as fx
|
|
43
|
+
|
|
44
|
+
@fx.task
|
|
45
|
+
def extract() -> list[int]: return [1, 2, 3]
|
|
46
|
+
|
|
47
|
+
@fx.task
|
|
48
|
+
def double(extract: list[int]) -> list[int]: return [x * 2 for x in extract]
|
|
49
|
+
|
|
50
|
+
graph = fx.graph(extract, double) # double 自动依赖 extract
|
|
51
|
+
report = fx.run(graph)
|
|
52
|
+
print(report["double"]) # [2, 4, 6]
|
|
53
|
+
|
|
54
|
+
CLI
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
.. code-block:: bash
|
|
58
|
+
|
|
59
|
+
fcmd # 列出所有工具
|
|
60
|
+
fcmd pymake b # 构建
|
|
61
|
+
fcmd pymake tc # 类型检查
|
|
62
|
+
fcmd info pymake # 查看 pymake 子命令
|
|
63
|
+
fcmd graph pymake tc # 输出 DAG(Mermaid)
|
|
64
|
+
fcmd env # 查看运行环境
|
|
65
|
+
fcmd doctor # 诊断环境问题
|
|
66
|
+
fcmd profiler workflow.py # 性能剖面分析
|
|
67
|
+
|
|
68
|
+
更多用法(任务定义 API、YAML 编排、执行策略)详见 ``README.md``。
|
|
69
|
+
|
|
70
|
+
项目结构
|
|
71
|
+
========
|
|
72
|
+
|
|
73
|
+
采用 ``src`` layout,核心分为三层:
|
|
74
|
+
|
|
75
|
+
.. code-block:: text
|
|
76
|
+
|
|
77
|
+
src/fcmd/
|
|
78
|
+
├── __init__.py # 顶层导出:task/tool/graph/run 等
|
|
79
|
+
├── _compat.py # 跨版本兼容补丁
|
|
80
|
+
├── command.py # 命令执行辅助
|
|
81
|
+
├── conditions.py # YAML ``if`` 条件函数(success()/failure() 等)
|
|
82
|
+
├── console.py # 自实现 Console + Table(替代 rich)
|
|
83
|
+
├── executors.py # 四种执行策略的 Runner
|
|
84
|
+
├── yaml_loader.py # YAML 任务图加载
|
|
85
|
+
├── apis/ # 核心 API:DAG/任务/工具箱/报告/上下文/性能
|
|
86
|
+
│ ├── dag.py # 图构建与拓扑排序
|
|
87
|
+
│ ├── task.py # TaskSpec/TaskResult 数据结构
|
|
88
|
+
│ ├── toolkit.py # @tool 装饰器与 run_tool/build_tool_graph
|
|
89
|
+
│ ├── report.py # RunReport 执行报告
|
|
90
|
+
│ ├── context.py # 执行上下文
|
|
91
|
+
│ ├── profiling.py # 性能剖面
|
|
92
|
+
│ └── errors.py # 异常层次
|
|
93
|
+
├── models/ # 命令/文件过滤/版本等模型
|
|
94
|
+
└── cli/ # CLI 入口与 57 个工具模块
|
|
95
|
+
├── main.py # FcmdApp 主入口与 7 个内建命令
|
|
96
|
+
├── _common.py # 共享常量(_BUILTIN_COMMANDS 等)
|
|
97
|
+
├── _completion_scripts.py # shell 补全生成
|
|
98
|
+
├── _profiler_helpers.py # profiler 内建命令辅助
|
|
99
|
+
├── _env_persist.py # 环境变量持久化
|
|
100
|
+
└── <tool>.py # 工具模块(@fcmd.tool 自动注册)
|
|
101
|
+
|
|
102
|
+
开发
|
|
103
|
+
====
|
|
104
|
+
|
|
105
|
+
.. code-block:: bash
|
|
106
|
+
|
|
107
|
+
# 安装开发依赖(lint + test + office + prek + tox)
|
|
108
|
+
uv sync --extra dev
|
|
109
|
+
|
|
110
|
+
fcmd pymake tc # 类型检查(pyrefly + ruff)
|
|
111
|
+
fcmd pymake t # 运行测试
|
|
112
|
+
fcmd pymake cov # 测试 + 覆盖率
|
|
113
|
+
make check # 全套门禁(lint + typecheck + cov ≥ 95%)
|
|
114
|
+
|
|
115
|
+
工具链独立配置文件:``ruff.toml`` / ``pyrefly.toml`` / ``pytest.ini`` / ``.coveragerc``
|
|
116
|
+
/ ``.bumpversion.toml`` / ``uv.toml`` / ``.pre-commit-config.yaml``。
|
|
117
|
+
``pyproject.toml`` 仅含项目元数据。
|
|
118
|
+
|
|
119
|
+
新增工具:在 ``src/fcmd/cli/`` 下新建模块(非 ``_`` 前缀、非 ``main``),
|
|
120
|
+
用 ``@fcmd.tool`` 装饰器注册即可,无需修改 ``main.py``。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fcmd"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "极速 Python 工具集应用:DAG 任务调度 + 组合 CLI"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.8"
|
|
@@ -28,6 +28,7 @@ archivex = "fcmd.cli.archivex:main"
|
|
|
28
28
|
asciitool = "fcmd.cli.asciitool:main"
|
|
29
29
|
autofmt = "fcmd.cli.autofmt:main"
|
|
30
30
|
bumpversion = "fcmd.cli.bumpversion:main"
|
|
31
|
+
calcdate = "fcmd.cli.calcdate:main"
|
|
31
32
|
casetool = "fcmd.cli.casetool:main"
|
|
32
33
|
clr = "fcmd.cli.clr:main"
|
|
33
34
|
codetool = "fcmd.cli.codetool:main"
|
|
@@ -47,6 +48,7 @@ gitt = "fcmd.cli.gittool:main"
|
|
|
47
48
|
hashfile = "fcmd.cli.hashfile:main"
|
|
48
49
|
hashtool = "fcmd.cli.hashtool:main"
|
|
49
50
|
idtool = "fcmd.cli.idtool:main"
|
|
51
|
+
inifile = "fcmd.cli.inifile:main"
|
|
50
52
|
imaget = "fcmd.cli.imagetool:main"
|
|
51
53
|
iptool = "fcmd.cli.iptool:main"
|
|
52
54
|
jsont = "fcmd.cli.jsontool:main"
|
|
@@ -71,6 +73,7 @@ sysinfo = "fcmd.cli.sysinfo:main"
|
|
|
71
73
|
taskk = "fcmd.cli.taskkill:main"
|
|
72
74
|
textdiff = "fcmd.cli.textdiff:main"
|
|
73
75
|
timetool = "fcmd.cli.timetool:main"
|
|
76
|
+
tomltool = "fcmd.cli.tomltool:main"
|
|
74
77
|
txttool = "fcmd.cli.txttool:main"
|
|
75
78
|
urltool = "fcmd.cli.urltool:main"
|
|
76
79
|
wch = "fcmd.cli.which:main"
|