build: add pyproject.toml, switch to versioningit #4440
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
src/streamlink/_version.py
and load streamlink's versionstring via versioningit. The module's
__version__
export will getreplaced by a static string on build-time when creating sdists/wheels,
which results in the old versioneer behavior with support for
editable installs.
Resolves #4321
This needs to be thoroughly reviewed before it can be merged. I'm opening this as a draft for now.
I've set the required setuptools version to >=45, which is the one which breaks compatibility with python 2. A higher version could be set here, but it's probably not necessary. At least version 42 is necessary for PEP 517/518.
The version string format generated by versioningit remains the same, so it'll be one of these, depending on the current state
{version}
{version}+{distance}.{vcs}{rev}
{version}+{distance}.{vcs}{rev}.dirty
Editable installs via
pip install -e .
should be working. Please seesrc/streamlink/_version.py
, which loads the current version from versioningit unless the file's__version__
export was replaced during build-time (sdist/bdist) with a static version string.The next step would be moving the project metadata from
setup.py
topyproject.toml
, and dependencies from{dev,docs}-requirements.txt
to theproject.optional-dependencies
table ofpyproject.toml
. Maybe also properly defining dev- and doc-dependency version ranges would be a wise idea, at least minimum versions. I'd also love to have a dependency lockfile here, but that can be done later.