Skip to content

Migrate from setup.py to pyproject.toml (PEP 621) #5415

@mahdirajaee

Description

@mahdirajaee

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. pip already emits deprecation warnings for projects without pyproject.toml.
  • Build isolation: pyproject.toml enables 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, and requirements.txt.
  • Tool configuration: Tools like black, ruff, mypy, and pytest can all be configured in pyproject.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions