Migrate from setup.py to pyproject.toml (PEP 621)
Author: mahdirajaeeCreated Mar 28, 2026Updated Sep 5, 2026
Labelsfeature
Description
The project currently uses the legacy setup.py for packaging. The Python packaging ecosystem has standardized on pyproject.toml as defined by PEP 517, PEP 518, and PEP 621.
Why This Matters
- setuptools deprecation path:
setup.py-based builds are being phased out.pipalready emits deprecation warnings for projects withoutpyproject.toml. - Build isolation:
pyproject.tomlenables proper build isolation, preventing dependency conflicts during installation. - Declarative metadata: All project metadata (name, version, dependencies, entry points) lives in one standard file instead of being split between
setup.py,setup.cfg, andrequirements.txt. - Tool configuration: Tools like
black,ruff,mypy, andpytestcan all be configured inpyproject.toml, reducing the number of config files.
Migration
The current setup.py is straightforward enough that migration would be a direct translation:
[build-system]
requires = ["setuptools>=68.0", "wheel"]
build-backend = "setuptools.backends._legacy:_Backend"
[project]
name = "platformio"
dynamic = ["version", "dependencies"]
requires-python = ">=3.9"The get_pip_dependencies() function and dynamic version import can be handled via setuptools dynamic fields.
This is a non-functional change that modernizes the packaging without affecting runtime behavior.
Source: platformio/platformio-core