Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bbcf80e0ca | |||
| 87606d152a |
@@ -1,47 +0,0 @@
|
|||||||
# 版本控制
|
|
||||||
.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
|
|
||||||
+13
-14
@@ -12,21 +12,20 @@ jobs:
|
|||||||
ci:
|
ci:
|
||||||
name: Lint, Typecheck & Test
|
name: Lint, Typecheck & Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: pyflowx-ci:1.0.0
|
|
||||||
env:
|
|
||||||
UV_LINK_MODE: copy
|
|
||||||
steps:
|
steps:
|
||||||
- uses: http://gitea:3000/zhou/checkout.git@main
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Sync dependencies
|
- uses: astral-sh/setup-uv@v5
|
||||||
run: uv sync --frozen
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
- name: Ruff check
|
- uses: actions/setup-python@v5
|
||||||
run: ruff check src tests
|
with:
|
||||||
|
python-version: |
|
||||||
|
3.8
|
||||||
|
3.13
|
||||||
|
|
||||||
- name: Pyrefly check
|
- run: uv sync
|
||||||
run: pyrefly check src tests
|
- run: uv run ruff check src tests
|
||||||
|
- run: uv run pyrefly check .
|
||||||
- name: Tox test (py38, py313)
|
- run: uvx tox run -e py38,py313
|
||||||
run: uvx tox run -e py38,py313
|
|
||||||
|
|||||||
@@ -11,18 +11,20 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
name: Build, Publish & Release
|
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: http://gitea:3000/zhou/checkout.git@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build distributions
|
- uses: astral-sh/setup-uv@v5
|
||||||
run: uv build
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- uses: actions/setup-python@v5
|
||||||
uses: http://gitea:3000/zhou/gh-action-pypi-publish.git@release/v1
|
with:
|
||||||
|
python-version: '3.13'
|
||||||
|
|
||||||
|
- run: uv build
|
||||||
|
|
||||||
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
|
||||||
@@ -41,3 +43,5 @@ jobs:
|
|||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary @"$file"
|
--data-binary @"$file"
|
||||||
done
|
done
|
||||||
|
env:
|
||||||
|
GITEA_URL: ${{ secrets.GITEA_URL || 'https://git.gookeryoung.cn' }}
|
||||||
|
|||||||
-57
@@ -1,57 +0,0 @@
|
|||||||
# 使用国内镜像源拉取基础镜像
|
|
||||||
# 备选镜像源前缀: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
|
|
||||||
|
|
||||||
# 安装 Node.js 20.x(actions/checkout 需要)
|
|
||||||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
|
||||||
apt-get install -y nodejs && \
|
|
||||||
node --version
|
|
||||||
|
|
||||||
# 预装项目 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"]
|
|
||||||
+5
-4
@@ -26,7 +26,6 @@ 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"
|
||||||
@@ -38,8 +37,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"
|
||||||
pxp = "pyflowx.cli.profiler:main"
|
|
||||||
pymake = "pyflowx.cli.pymake:main"
|
pymake = "pyflowx.cli.pymake:main"
|
||||||
|
pxp = "pyflowx.cli.profiler: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"
|
||||||
@@ -67,6 +66,9 @@ 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",
|
||||||
@@ -92,7 +94,7 @@ packages = ["src/pyflowx"]
|
|||||||
pyflowx = { workspace = true }
|
pyflowx = { workspace = true }
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = ["pyflowx[dev,office]"]
|
dev = ["pyflowx[dev,office,llm]"]
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
branch = true
|
branch = true
|
||||||
@@ -156,4 +158,3 @@ select = [
|
|||||||
preset = "strict"
|
preset = "strict"
|
||||||
project-includes = ["**/*.ipynb", "**/*.py*"]
|
project-includes = ["**/*.ipynb", "**/*.py*"]
|
||||||
python-version = "3.8"
|
python-version = "3.8"
|
||||||
unused-ignore = false
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
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()
|
|
||||||
Reference in New Issue
Block a user