Skip to content

Choosing a better build backend than setuptools #105

Description

@Avasam

Following #101, switching the build backend is now as easy as literally changing 2 lines.

You may want to consider a different backend than setuptools, which is literally the slowest, biggest (in size) and least maintained amongst all options available: https://packaging.python.org/en/latest/guides/tool-recommendations/#build-backends + https://docs.astral.sh/uv/concepts/build-backend/#choosing-a-build-backend

I highly suggest you read the link above, as well as the following table I compiled: python/typeshed#13622 (review)
but tl-dr: This is a pure-python project, so plugins are a non-offering. Performance, footprint and maintenance are the only real concerns.

I'd personally recommend uv_build as it would integrate very will with #99 (the uv build frontend comes with its own integrated build backend pre-installed, so it doesn't have to install it from PyPI at build time !
uv is basically an all-in-one extremely efficient package management tool that also comes with commands to build+publish. It's literally as easy as uv sync && uv build && uv publish, replacing pip, venv, build, wheel and twine packages/tools. Great error messages and documentation too !

If you wanna keep your current workflow AND mind the uv_build backend footprint (it's honestly still faster despite a bigger initial download), then I'd recommend flit-core, it is the smallest and fastest pure-python backend, and is a bit more restrictive/pedantic.


Side note, you also now have 3 valid options of handling versioning:

  1. Current pywinctl.__version__ that is read by build backend. Requires pywinctl to be importable at build time (dynamic project.version)
  2. VCS based (build backend uses git to see if the current commit match an exact git tag. This is great to automate deployment and version bump simply by pushing a git tag, rather than having the version be found in source. (dynamic project.version)
  3. Write the version to pyproject.toml instead (static project.version)

* To keep pywinctl.__version__ existing, option 2 and 3 require filling it in at runtime using packaging metadata (through the importlib module)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions