#6756·streamlink

build: versioningit: replace regex-based substitution with tomllib

Author: bastimeyerCreated Dec 24, 2025Updated Dec 24, 2025
LabelscleanupEnd of Lifebuild configpython: 3.10

When building Streamlink's sdist, it removes versioningit from its build-system.requires, so that versioningit is only required when building from git, as intended: https://github.com/streamlink/streamlink/blob/befff8e979e886c547b05348e8f63c789a0ccbce/pyproject.toml#L4-L6

This is currently done by using a regex in a custom versioningit build step that's run when building the sdist from git: https://github.com/streamlink/streamlink/blob/befff8e979e886c547b05348e8f63c789a0ccbce/pyproject.toml#L185-L187 https://github.com/streamlink/streamlink/blob/befff8e979e886c547b05348e8f63c789a0ccbce/build_backend/onbuild.py#L58-L84

It was done this way, because it's the simplest way without having to parse the pyproject.toml file. On older Python versions, this would've required the additional tomli dependency. With the drop of Python 3.10 next year though, tomllib will be available in the stdlib, so let's replace this "hacky" regex-based substitution then.

Then the version attribute also doesn't have to be set in setup.py and it can simply be set in pyproject.toml as a static value after removing the version item from project.dynamic. This is much cleaner. https://github.com/streamlink/streamlink/blob/befff8e979e886c547b05348e8f63c789a0ccbce/setup.py#L93 https://github.com/streamlink/streamlink/blob/befff8e979e886c547b05348e8f63c789a0ccbce/pyproject.toml#L49