Skip to content

Commit aaf5b13

Browse files
authored
Add Python 3.13/3.14 support and docs updates (#4248)
## Summary - add Python 3.13 and 3.14 support metadata and CI matrix coverage - update auto-format workflow to run with Python 3.14 and black 26.1.0 - remove deprecated distutils usage in setup.py for Python 3.12+ - update installation and release-note docs for Python 3.13/3.14 support - keep TensorFlow integration test path on Python 3.12 for compatibility
1 parent 705349c commit aaf5b13

File tree

27 files changed

+114
-89
lines changed

27 files changed

+114
-89
lines changed

.github/workflows/auto-format.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: 3.12
23+
python-version: 3.14
2424

2525
# versions need to be consistent with setup.cfg
2626
- name: Install isort
@@ -30,7 +30,7 @@ jobs:
3030
run: python -m isort $DIRS
3131

3232
- name: Install black
33-
run: pip install black==24.8.0
33+
run: pip install black==25.9.0
3434

3535
- name: Run black
3636
run: python -m black $DIRS
@@ -48,4 +48,3 @@ jobs:
4848
git add .
4949
git diff --cached --quiet || git commit -m "Auto format with black"
5050
git push
51-

.github/workflows/premerge.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,24 @@ on:
2121
workflow_dispatch:
2222

2323
jobs:
24+
style-check:
25+
runs-on: ubuntu-24.04
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Python 3.14
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.14"
32+
- name: Run style checks
33+
run: ./runtest.sh -s
34+
2435
unit-tests:
2536
runs-on: ${{ matrix.os }}
2637
strategy:
2738
fail-fast: false
2839
matrix:
2940
os: [ ubuntu-22.04, ubuntu-24.04 ]
30-
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
41+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
3142
steps:
3243
- uses: actions/checkout@v4
3344
- name: Set up Python ${{ matrix.python-version }}
@@ -40,15 +51,15 @@ jobs:
4051
python3 -m pip install --no-cache-dir -e .[dev]
4152
python3 -m pip install --no-cache-dir --no-deps "flwr>=1.16,<1.26"
4253
- name: Run unit test
43-
run: ./runtest.sh
54+
run: ./runtest.sh --numprocesses=auto -u
4455

4556
wheel-build:
4657
runs-on: ${{ matrix.os }}
4758
strategy:
4859
fail-fast: false
4960
matrix:
5061
os: [ ubuntu-22.04, ubuntu-24.04 ]
51-
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
62+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
5263
steps:
5364
- uses: actions/checkout@v4
5465
- name: Set up Python ${{ matrix.python-version }}

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
## Style and Testing Conventions
2020

2121
- Format/lint stack: black (line length 120), flake8, isort (black profile).
22-
- Python support targets: 3.9, 3.10, 3.11, 3.12.
22+
- Python support targets: 3.9, 3.10, 3.11, 3.12, 3.13, 3.14.
2323
- Add the standard NVIDIA Apache-2.0 license header to new Python source files.
2424
- Unit tests live in `tests/unit_test/`; integration tests live in `tests/integration_test/`.
2525
- Test file names follow `[module_name]_test.py`.

CLAUDE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ nvflare/
119119
- **Formatter**: black (line length: 120)
120120
- **Linter**: flake8
121121
- **Import sorter**: isort (black profile)
122-
- **Python**: 3.9, 3.10, 3.11, 3.12
122+
- **Python**: 3.9, 3.10, 3.11, 3.12, 3.13, 3.14
123123

124124
All Python files must include Apache 2.0 license header:
125125
```python
@@ -149,4 +149,3 @@ Create a `CLAUDE.local.md` file (git-ignored) for personal preferences such as:
149149
- Preferred coding patterns
150150
- Local environment specifics
151151
- Custom shortcuts or workflows
152-

docs/installation.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from the :ref:`fl_introduction` and have reviewed the :ref:`flare_overview` to u
1010

1111
Prerequisites
1212
=============
13-
- Python 3.9+
13+
- Python 3.9+ (tested through Python 3.14, including Python 3.13)
1414
- pip
1515
- Git
1616

@@ -35,7 +35,7 @@ Virtual Environments and Packages
3535
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

3737
Python's official document explains the main idea about virtual environments.
38-
The module used to create and manage virtual environments is called `venv <https://docs.python.org/3.10/library/venv.html>`_.
38+
The module used to create and manage virtual environments is called `venv <https://docs.python.org/3/library/venv.html>`_.
3939
You can find more information there. We only describe a few necessary steps for a virtual environment for NVIDIA FLARE.
4040

4141
Depending on your OS and the Python distribution, you may need to install the Python's venv package separately. For example, in Ubuntu
@@ -89,12 +89,22 @@ NVFlare provides several optional dependency groups that you can install based o
8989
9090
$ pip install nvflare[HE]
9191
92+
.. note::
93+
94+
``nvflare[HE]`` currently supports Python 3.9-3.13.
95+
On Python 3.14, ``tenseal`` is not available yet, so the HE extra is not installed.
96+
9297
* **PSI** - Private Set Intersection support:
9398

9499
.. code-block:: shell
95100
96101
$ pip install nvflare[PSI]
97102
103+
.. note::
104+
105+
``nvflare[PSI]`` currently supports Python 3.9-3.13.
106+
On Python 3.14, ``openmined.psi`` is not available yet, so the PSI extra is not installed.
107+
98108
* **PT** - PyTorch support:
99109

100110
.. code-block:: shell
@@ -205,7 +215,7 @@ To build wheels for specific platforms or Python versions, you can use the follo
205215
.. code-block:: shell
206216
207217
# For a specific Python version
208-
$ PYTHON=python3.9 python -m build
218+
$ PYTHON=python3.14 python -m build
209219
210220
# For a specific platform
211221
$ PLATFORM=linux_x86_64 python -m build

docs/release_notes/flare_272.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ Documentation
210210

211211
- **Job Recipe Guide**: Updated :doc:`/user_guide/data_scientist_guide/job_recipe` with dict model config and initial checkpoint examples.
212212

213+
Python Compatibility
214+
~~~~~~~~~~~~~~~~~~~~
215+
216+
- Added official support for Python 3.13 and Python 3.14, including packaging metadata and CI test matrix updates.
217+
213218
Bug Fixes
214219
~~~~~~~~~
215220

@@ -253,5 +258,3 @@ For more examples and tutorials, see:
253258
- `Hello World Examples <https://github.com/NVIDIA/NVFlare/tree/main/examples/hello-world>`_
254259
- `Advanced Examples <https://github.com/NVIDIA/NVFlare/tree/main/examples/advanced>`_
255260
- `Self-Paced Training Tutorials <https://github.com/NVIDIA/NVFlare/tree/main/examples/tutorials/self-paced-training>`_
256-
257-

examples/advanced/bionemo/task_fitting/job_fedavg/job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""
1616
Federated MLP Training using FedAvgRecipe with PyTorch
1717
18-
This script uses PyTorch-based federated learning to train an MLP classifier
18+
This script uses PyTorch-based federated learning to train an MLP classifier
1919
on protein embeddings for subcellular location prediction.
2020
Run this after inference to train an MLP classifier on the embeddings.
2121
"""

examples/advanced/federated-policies/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""
15-
client side training scripts
15+
client side training scripts
1616
"""
1717

1818
import argparse

examples/advanced/job-level-authorization/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""
15-
client side training scripts
15+
client side training scripts
1616
"""
1717

1818
import argparse

examples/hello-world/hello-dp/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""
15-
Simple MLP model for tabular data
15+
Simple MLP model for tabular data
1616
"""
1717

1818
import torch.nn as nn

0 commit comments

Comments
 (0)