17 Commits

Author SHA1 Message Date
zhou c6653d5117 +docker cmd
CI / Lint, Typecheck & Test (push) Failing after 22s
2026-07-03 12:53:11 +08:00
zhou d194a991a0 chore: 移除llm额外依赖组并更新dev依赖配置
CI / Lint, Typecheck & Test (push) Failing after 27s
删除了llm相关的依赖分组,同时调整dev依赖组移除对llm可选依赖的引用
2026-07-03 12:18:24 +08:00
zhou 4446658170 ci(github workflows): 优化CI/CD流程,使用自定义容器并简化步骤
CI / Lint, Typecheck & Test (push) Failing after 23s
1. 为CI和release任务添加自定义pyflowx-ci容器并配置UV链接模式
2. 移除冗余的setup-uv和setup-python步骤,合并依赖同步、代码检查命令
3. 简化步骤命名和执行逻辑,统一使用uv管理工具链
2026-07-03 07:50:59 +08:00
zhou 1d26f9d3e7 build: 添加dockerignore和Dockerfile配置文件
新增.dockerignore文件忽略不必要的构建文件,同时创建Dockerfile配置容器构建流程,使用国内镜像源加速拉取依赖和基础镜像,预装uv和多版本Python环境
2026-07-03 07:48:26 +08:00
zhou d9644ca5d1 ci(github workflow): 更新uv版本到0.11.26
CI / Lint, Typecheck & Test (push) Has been cancelled
将CI工作流中的uv版本从0.8.0升级到0.11.26,获取最新功能和修复
2026-07-03 07:44:04 +08:00
zhou d3c2d53449 build: 升级pyflowx版本到0.3.0
CI / Lint, Typecheck & Test (push) Has been cancelled
更新项目版本号从0.2.13至0.3.0
2026-07-03 07:39:30 +08:00
zhou 9cfcfb38e4 更新 .github/workflows/ci.yml
CI / Lint, Typecheck & Test (push) Has been cancelled
2026-07-02 15:03:23 +00:00
zhou 69db241611 添加 uv.toml
CI / Lint, Typecheck & Test (push) Failing after 21s
2026-07-02 15:00:39 +00:00
zhou 66e6295a24 ci(github workflow): 固定setup-uv和setup-python的版本
CI / Lint, Typecheck & Test (push) Failing after 7m12s
2026-07-02 22:39:50 +08:00
zhou aebb4fce68 ci: 将CI工作流的依赖action版本切换为main分支
CI / Lint, Typecheck & Test (push) Failing after 20s
更新了checkout、setup-uv、setup-python这几个action的引用标签,从固定版本改为使用main分支
2026-07-02 21:18:49 +08:00
zhou 7784c8ff86 ci: 将github actions源替换为内部gitea仓库地址
CI / Lint, Typecheck & Test (push) Failing after 2m45s
2026-07-02 20:53:56 +08:00
zhou 77918a5568 ci: 替换github actions为国内gitcode镜像源
CI / Lint, Typecheck & Test (push) Failing after 1s
2026-07-02 20:48:48 +08:00
zhou 7e4c615dc7 ci: 将actions/checkout版本从v7降级到v4
CI / Lint, Typecheck & Test (push) Has been cancelled
2026-07-02 20:29:51 +08:00
zhou ac5082523e ci: 更新github workflows中的依赖actions版本
CI / Lint, Typecheck & Test (push) Has been cancelled
2026-07-02 20:11:59 +08:00
zhou 0df6f7c8ac ci(github workflows): 替换官方action为国内镜像仓库地址
CI / Lint, Typecheck & Test (push) Failing after 5m8s
2026-07-02 19:59:01 +08:00
zhou 4b66176ce6 ~ci.yml
CI / Lint, Typecheck & Test (push) Has been cancelled
2026-07-02 18:29:03 +08:00
zhou cf6b6fd059 ~ci.yml
CI / Lint, Typecheck & Test (push) Has been cancelled
2026-07-02 17:57:04 +08:00
9 changed files with 2014 additions and 6612 deletions
+47
View File
@@ -0,0 +1,47 @@
# 版本控制
.git
.gitignore
.github
# Python 缓存与构建产物
__pycache__
*.pyc
*.pyo
*.pyd
*.egg-info
*.egg
dist
build
.eggs
# 测试与覆盖率
.pytest_cache
.coverage
htmlcov
.tox
coverage.xml
# 虚拟环境
.venv
venv
env
# 工具缓存
.uv-cache
.ruff_cache
.pyrefly_cache
.mypy_cache
# IDE 与编辑器
.idea
.vscode
*.swp
*.swo
# 文档与示例(按需保留)
docs
examples
# 系统文件
.DS_Store
Thumbs.db
+15 -33
View File
@@ -9,42 +9,24 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
lint-and-typecheck: ci:
name: Lint & Typecheck name: Lint, Typecheck & Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: pyflowx-ci:latest
env:
UV_LINK_MODE: copy
steps: steps:
- uses: actions/checkout@v4 - uses: http://gitea:3000/zhou/checkout.git@main
- uses: astral-sh/setup-uv@v5 - name: Sync dependencies
with: run: uv sync --frozen || uv sync
enable-cache: true
- uses: actions/setup-python@v5 - name: Ruff check
with: run: ruff check src tests
python-version: '3.13'
- run: uv sync - name: Pyrefly check
- run: uv run ruff check src tests run: pyrefly check .
- run: uv run pyrefly check .
test: - name: Tox test (py38, py313)
name: Test (${{ matrix.os }}) run: uvx tox run -e py38,py313
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: |
3.8
3.13
- run: uvx tox run -e py38,py313
+28 -46
View File
@@ -6,56 +6,38 @@ on:
permissions: permissions:
contents: write contents: write
id-token: write
jobs: jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- run: uv build
- id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish-pypi:
needs: build
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
release: release:
needs: [build, publish-pypi] name: Build, Publish & Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: pyflowx-ci:latest
env:
UV_LINK_MODE: copy
steps: steps:
- uses: actions/download-artifact@v8 - uses: http://gitea:3000/zhou/checkout.git@v4
with:
name: dist
path: dist
- uses: softprops/action-gh-release@v2 - name: Build distributions
run: uv build
- name: Publish to PyPI
uses: http://gitea:3000/zhou/gh-action-pypi-publish.git@release/v1
with: with:
files: dist/* password: ${{ secrets.PYPI_API_TOKEN }}
generate_release_notes: true
- name: Create Gitea Release
run: |
VERSION=${GITHUB_REF#refs/tags/v}
REPO=${GITHUB_REPOSITORY}
UPLOAD_URL=$(curl -s -X POST "https://git.gookeryoung.cn/api/v1/repos/${REPO}/releases" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"v${VERSION}\", \"name\": \"v${VERSION}\", \"draft\": false, \"prerelease\": false}" \
| jq -r '.upload_url')
for file in dist/*; do
curl -s -X POST "${UPLOAD_URL}?name=$(basename $file)" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file"
done
+52
View File
@@ -0,0 +1,52 @@
# 使用国内镜像源拉取基础镜像
# 备选镜像源前缀:docker.1ms.run / dockerpull.com / docker.xuanyuan.me
FROM docker.m.daocloud.io/python:3.13-slim
# 环境变量:非交互 + 路径配置
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
UV_LINK_MODE=copy \
UV_CACHE_DIR=/uv-cache \
UV_PYTHON_INSTALL_DIR=/uv-python \
UV_PROJECT_ENVIRONMENT=/opt/venv \
PATH="/opt/venv/bin:${PATH}"
# 配置 apt 国内镜像(阿里云)并安装系统依赖
RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
jq \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# 配置 pip 国内镜像(阿里云)
RUN mkdir -p /etc/pip \
&& printf '[global]\nindex-url = https://mirrors.aliyun.com/pypi/simple/\ntrusted-host = mirrors.aliyun.com\n' \
> /etc/pip/pip.conf \
&& mkdir -p /root/.config/pip \
&& ln -sf /etc/pip/pip.conf /root/.config/pip/pip.conf
# 安装 uv 并预装 Python 3.8 / 3.13
RUN pip install --no-cache-dir uv -i https://mirrors.aliyun.com/pypi/simple/ \
&& uv python install 3.8 3.13
# 预装项目 dev 依赖(仅复制依赖描述文件,利用 Docker 层缓存)
WORKDIR /workspace
COPY pyproject.toml tox.ini README.md ./
COPY src/ ./src/
# 同步依赖到 /opt/venv(CI 时直接复用)
RUN uv sync --frozen --no-install-project 2>/dev/null || uv sync --no-install-project
# 预装 tox 环境(py38 + py313
RUN uvx tox run -e py38,py313 --notest 2>/dev/null || true
# 持久化 uv 缓存目录(CI 可挂载到宿主机加速)
VOLUME ["/uv-cache"]
# 默认入口
CMD ["/bin/bash"]
+3 -5
View File
@@ -26,6 +26,7 @@ version = "0.3.0"
[project.scripts] [project.scripts]
autofmt = "pyflowx.cli.autofmt:main" autofmt = "pyflowx.cli.autofmt:main"
bumpversion = "pyflowx.cli.bumpversion:main" bumpversion = "pyflowx.cli.bumpversion:main"
dockercmd = "pyflowx.cli.dev.dockercmd:main"
emlman = "pyflowx.cli.emlmanager:main" emlman = "pyflowx.cli.emlmanager:main"
filedate = "pyflowx.cli.filedate:main" filedate = "pyflowx.cli.filedate:main"
filelvl = "pyflowx.cli.filelevel:main" filelvl = "pyflowx.cli.filelevel:main"
@@ -37,8 +38,8 @@ msdown = "pyflowx.cli.llm.msdownload:main"
packtool = "pyflowx.cli.packtool:main" packtool = "pyflowx.cli.packtool:main"
pdftool = "pyflowx.cli.pdftool:main" pdftool = "pyflowx.cli.pdftool:main"
piptool = "pyflowx.cli.piptool:main" piptool = "pyflowx.cli.piptool:main"
pymake = "pyflowx.cli.pymake:main"
pxp = "pyflowx.cli.profiler:main" pxp = "pyflowx.cli.profiler:main"
pymake = "pyflowx.cli.pymake:main"
reseticon = "pyflowx.cli.reseticoncache:main" reseticon = "pyflowx.cli.reseticoncache:main"
scrcap = "pyflowx.cli.screenshot:main" scrcap = "pyflowx.cli.screenshot:main"
sglang = "pyflowx.cli.llm.sglang:main" sglang = "pyflowx.cli.llm.sglang:main"
@@ -66,9 +67,6 @@ dev = [
"tox-uv>=1.13.1", "tox-uv>=1.13.1",
"tox>=4.25.0", "tox>=4.25.0",
] ]
llm = [
"sglang[all]==0.5.10rc0; python_version >= '3.10' and sys_platform == 'linux'",
]
office = [ office = [
"pillow>=10.4.0", "pillow>=10.4.0",
"pymupdf>=1.24.11", "pymupdf>=1.24.11",
@@ -94,7 +92,7 @@ packages = ["src/pyflowx"]
pyflowx = { workspace = true } pyflowx = { workspace = true }
[dependency-groups] [dependency-groups]
dev = ["pyflowx[dev,office,llm]"] dev = ["pyflowx[dev,office]"]
[tool.coverage.run] [tool.coverage.run]
branch = true branch = true
+26
View File
@@ -0,0 +1,26 @@
from __future__ import annotations
from typing import Literal
import pyflowx as px
DockerMirrorType = Literal["tencent"]
DOCKER_MIRROR_URLS: dict[DockerMirrorType, str] = {"tencent": "ccr.ccs.tencentyun.com"}
def main():
# parser = argparse.ArgumentParser(description="Docker 命令行工具")
# parser.add_argument("--username", nargs="?", default="", type=str, help="Docker 用户名")
# args = parser.parse_args()
tasks: list[px.TaskSpec] = [
px.cmd(["docker", "login", "--username", "xxx", DOCKER_MIRROR_URLS["tencent"]], name="docker_login_tencent"),
]
alias: dict[str, str | list[str | px.TaskSpec] | px.TaskSpec | px.Graph] = {
"login": "docker_login_tencent",
}
runner = px.CliRunner(strategy="sequential", tasks=tasks, aliases=alias)
runner.run_cli()
+26
View File
@@ -1,6 +1,7 @@
from __future__ import annotations from __future__ import annotations
import argparse import argparse
import getpass
from pathlib import Path from pathlib import Path
from typing import Literal, get_args from typing import Literal, get_args
@@ -254,6 +255,31 @@ def main() -> None:
allow_upstream_skip=True, allow_upstream_skip=True,
verbose=True, verbose=True,
), ),
# 安装 Docker
px.TaskSpec(
"install_docker",
cmd=["sudo", "apt", "install", "-y", "docker-compose-v2"],
conditions=(BuiltinConditions.IS_LINUX(),),
depends_on=("install_mirror",),
allow_upstream_skip=True,
verbose=True,
),
px.TaskSpec(
"add_docker_group",
cmd=["sudo", "usermod", "-aG", "docker", getpass.getuser()],
conditions=(BuiltinConditions.IS_LINUX(),),
depends_on=("install_docker",),
allow_upstream_skip=True,
verbose=True,
),
px.TaskSpec(
"refresh_docker_group",
cmd=["newgrp", "docker"],
conditions=(BuiltinConditions.IS_LINUX(),),
depends_on=("add_docker_group",),
allow_upstream_skip=True,
verbose=True,
),
# 设置 Python 环境变量 # 设置 Python 环境变量
*setenv_group({ *setenv_group({
"PIP_INDEX_URL": PIP_INDEX_URLS[python_mirror], "PIP_INDEX_URL": PIP_INDEX_URLS[python_mirror],
Generated
+1816 -6528
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
required-version = ">=0.5.0"