Skip to content

Modernize build system to be based on pyproject.toml #1334

Closed
@anselor

Description

@anselor

We need to replace the legacy build system based on setup.py, setup.cfg with a modern Python one based on pyproject.toml. This guide on How to modernize a setup.py based project has some useful pointers on where to start. setup.cfg should be deleted entirely and all configuration moved to pyproject.toml. Any python setup.py commands need to be migrated to a modern python -m build or python -m pip install command.

There are several more advanced build system tools which are worth exploring. The current default recommendation from python seems to be hatch. It has impressive features including declaring build/test configurations and managing venv environments. @anselor tried hatch on a couple small projects and found it to be much faster than using nox to set up venvs. The problem is it currently doesn't support a monorepo project with multiple modules or plugin modules. There is a development ticket (pypa/hatch#233) that documents it and it is under active development now. Once that is complete we should be able to migrate to hatch with minimal fuss.

A newer alternative that is taking the Python world by storm is uv which is an extremely fast Python package and project manager, written in Rust. uv is a single tool to replace pip, pip-tools, pipx, poetry, pyenv, virtualenv, pipenv and more. I've used this at work to replace pip in some builds and it has typically sped things up by a factor of 2x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions