Skip to content
Merged
18 changes: 17 additions & 1 deletion .github/actions/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ inputs:
description: "Option to skip the poetry installation"
required: false
default: "false"
uv-version:
description: "Version of uv to install"
default: "0.10.7"
uv-skip:
description: "Option to skip the uv installation"
required: false
default: "true"
outputs:
python-version:
description: "Version range or exact version of Python or PyPy"
Expand All @@ -28,15 +35,23 @@ outputs:
description: "Installed version of setuptools"
value: ${{ steps.versions.outputs.setuptools-version }}
poetry-version:
description: "Installed version of poetry"
description: "Requested version of poetry"
value: ${{ steps.versions.outputs.poetry-version }}
uv-version:
description: "Requested version of uv"
value: ${{ steps.versions.outputs.uv-version }}
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Set up uv
if: ${{ inputs.uv-skip == 'false' }}
uses: astral-sh/setup-uv@v7
with:
version: ${{ inputs.uv-version }}
- name: Install build tools
run: |
python -m pip install -U pip==${{ inputs.pip-version }}
Expand All @@ -53,3 +68,4 @@ runs:
echo "pip-version=$(echo ${{ inputs.pip-version }})" >> $GITHUB_OUTPUT
echo "setuptools-version=$(echo ${{ inputs.setuptools-version }})" >> $GITHUB_OUTPUT
echo "poetry-version=$(echo ${{ inputs.poetry-version }})" >> $GITHUB_OUTPUT
echo "uv-version=$(echo ${{ inputs.uv-version }})" >> $GITHUB_OUTPUT
14 changes: 12 additions & 2 deletions .github/workflows/build-deploy-non-framework-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,29 @@ jobs:
run: ./dev/test-copyright.sh
- name: Bootstrap
uses: ./.github/actions/bootstrap
with:
uv-skip: "false"
- name: Install pandoc
run: sudo apt install pandoc
- name: Install docs dependencies
run: |
cd framework
python -m poetry install
python -m pip install -e ../datasets
- name: Install devtool dependencies
run: |
cd dev
uv sync --frozen
- name: Update HTML theme options
run: python -m devtool.update_html_themes
run: |
cd dev
uv run python -m devtool.update_html_themes
- name: Build baselines docs
run: ./dev/build-baseline-docs.sh
- name: Build examples docs
run: python -m devtool.build_example_docs
run: |
cd dev
uv run python -m devtool.build_example_docs
- name: Build datasets docs
run: ./datasets/dev/build-flwr-datasets-docs.sh
- name: Deploy docs
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/datasets-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ on:
paths:
- "datasets/**"
- "dev/devtool/**"
- "dev/pyproject.toml"
- "dev/uv.lock"
- ".github/workflows/datasets-*.yml"
pull_request:
branches:
- main
paths:
- "datasets/**"
- "dev/devtool/**"
- "dev/pyproject.toml"
- "dev/uv.lock"
- ".github/workflows/datasets-*.yml"

concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/framework-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
framework:
- 'framework/**/*'
- 'dev/devtool/**'
- 'dev/pyproject.toml'
- 'dev/uv.lock'
- '.github/workflows/framework-test.yml'
ex_bench:
- 'examples/**/*'
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/intelligence-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ jobs:
- uses: actions/checkout@v5
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Install dependencies (mandatory only)
with:
uv-skip: "false"
poetry-skip: "true"
- name: Install dependencies
run: |
cd dev
python -m poetry install --all-extras
uv sync --frozen
- name: Check docs format
run: |
cd dev
docstrfmt --check ../intelligence/docs/source
uv run docstrfmt --check ../intelligence/docs/source
build_ts_docs:
runs-on: ubuntu-22.04
name: Build TypeScript Docs
Expand Down
75 changes: 75 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Dev Tooling (`devtool`) with `uv`

This directory provides developer tooling used across the repository (for example
formatting, docs helpers, and repository checks).

`devtool` uses `uv` for dependency management and command execution.
The Flower `framework` project remains Poetry-based.

## Prerequisites

- Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/)
- Use Python 3.10+ (as defined in `pyproject.toml`)

## Quick Start

From the repository root:

```bash
cd dev
uv sync --frozen
```

This creates/updates `dev/.venv` from `uv.lock`.

## Run `devtool` Commands

Run modules through `uv run`:

```bash
cd dev
uv run python -m devtool.check_pr_title "feat(framework): Add test"
uv run python -m devtool.init_py_check ../framework/py/flwr
uv run python -m devtool.init_py_fix ../framework/py/flwr
uv run python -m devtool.check_copyright ../framework/py/flwr
uv run python -m devtool.fix_copyright ../framework/py/flwr
uv run python -m devtool.update_html_themes
uv run python -m devtool.build_example_docs
```

## Run Existing Dev Scripts with `uv`

Most scripts in this directory call Python tools directly (`python -m ...`), so run
them via `uv run` to ensure they use the `devtool` environment:

```bash
cd dev
uv run ./test.sh
uv run ./format.sh
```

## Updating Dependencies

1. Edit `pyproject.toml`.
2. Re-lock dependencies:

```bash
cd dev
uv lock
```

3. Validate with:

```bash
uv sync --frozen
```

4. Commit both:
- `pyproject.toml`
- `uv.lock`

## CI Notes

- CI jobs that use `devtool` should run `uv sync --frozen` and execute commands with
`uv run`.
- CI jobs that install `framework` still use Poetry.
82 changes: 46 additions & 36 deletions dev/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,46 +1,56 @@
[build-system]
requires = ["poetry-core>=2.1.3"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry]
[project]
name = "devtool"
version = "0.0.0"
description = "Tools for developers."
license = "Apache-2.0"
authors = ["The Flower Authors <hello@flower.ai>"]
packages = [{ include = "devtool", from = "./" }]
authors = [{ name = "The Flower Authors", email = "hello@flower.ai" }]
requires-python = ">=3.10"
dependencies = ["black==25.11.0", "PyYAML>=6.0.2,<7.0.0"]

[tool.poetry.dependencies]
python = "^3.10"
clang-format = "==17.0.6"
isort = "==5.13.2"
black = { version = "==25.11.0" }
taplo = "==0.9.3"
docformatter = "==1.7.5"
rope = "==1.13.0"
semver = "==3.0.2"
sphinx = "==7.4.7"
sphinx-intl = "==2.2.0"
sphinx-click = "==6.0.0"
myst-parser = "==3.0.1"
sphinx-design = "==0.6.1"
sphinx-copybutton = "==0.5.2"
sphinxcontrib-mermaid = "==0.9.2"
sphinxcontrib-youtube = "==1.4.1"
furo = "==2024.8.6"
sphinx-reredirects = "==0.1.5"
nbsphinx = "==0.9.5"
nbstripout = "==0.6.1"
sphinx-argparse = "==0.4.0"
mdformat = "==1.0.0"
mdformat-gfm = "==1.0.0"
mdformat-frontmatter = "==2.0.10"
mdformat-beautysh = "==1.0.0"
beautysh = "==6.4.2"
GitPython = "==3.1.32"
sphinx-substitution-extensions = "2022.02.16"
sphinxext-opengraph = "==0.9.1"
docstrfmt = { git = "https://github.com/charlesbvll/docstrfmt.git", branch = "patch-2", python = ">=3.10,<4.0.0" }
[dependency-groups]
dev = [
"clang-format==17.0.6",
"isort==5.13.2",
"taplo==0.9.3",
"docformatter==1.7.5",
"rope==1.13.0",
"semver==3.0.2",
"sphinx==7.4.7",
"sphinx-intl==2.2.0",
"sphinx-click==6.0.0",
"myst-parser==3.0.1",
"sphinx-design==0.6.1",
"sphinx-copybutton==0.5.2",
"sphinxcontrib-mermaid==0.9.2",
"sphinxcontrib-youtube==1.4.1",
"furo==2024.8.6",
"sphinx-reredirects==0.1.5",
"nbsphinx==0.9.5",
"nbstripout==0.6.1",
"sphinx-argparse==0.4.0",
"mdformat==1.0.0",
"mdformat-gfm==1.0.0",
"mdformat-frontmatter==2.0.10",
"mdformat-beautysh==1.0.0",
"beautysh==6.4.2",
"GitPython==3.1.32",
"sphinx-substitution-extensions==2022.2.16",
"sphinxext-opengraph==0.9.1",
"docstrfmt",
]

[tool.uv]
default-groups = ["dev"]

[tool.uv.sources]
docstrfmt = { git = "https://github.com/charlesbvll/docstrfmt.git", branch = "patch-2" }

[tool.hatch.build.targets.wheel]
packages = ["devtool"]

[tool.docstrfmt]
extend_exclude = [
Expand Down
Loading
Loading