Skip to content

build: add pyproject.toml, switch to versioningit #4440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2022

Conversation

bastimeyer
Copy link
Member

@bastimeyer bastimeyer commented Apr 8, 2022

  • Add basic pyproject.toml with build-system information
  • Drop versioneer in favor of versioningit
  • Delete versioneer install module and remove its setup.cfg config
  • Replace src/streamlink/_version.py and load streamlink's version
    string via versioningit. The module's __version__ export will get
    replaced by a static string on build-time when creating sdists/wheels,
    which results in the old versioneer behavior with support for
    editable installs.
  • Make versioningit use the same version format as versioneer
  • Update MANIFEST.in and .coveragerc

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 see src/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 to pyproject.toml, and dependencies from {dev,docs}-requirements.txt to the project.optional-dependencies table of pyproject.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.

@bastimeyer bastimeyer force-pushed the build/pyproject branch 3 times, most recently from 6c956f6 to 636a8ee Compare April 8, 2022 23:16
- Add basic pyproject.toml with build-system information
- Drop versioneer in favor of versioningit
- Delete versioneer install module and remove its setup.cfg config
- Replace `src/streamlink/_version.py` and load streamlink's version
  string via versioningit. The module's `__version__` export will get
  replaced by a static string on build-time when creating sdists/wheels,
  which results in the old versioneer behavior with support for
  editable installs.
- Make versioningit use the same version format as versioneer
- Update MANIFEST.in and .coveragerc
@bastimeyer
Copy link
Member Author

This will also require an update of the install dependencies in the docs and dev-requirements.

pip 10.0.0 introduced support for PEP 517/518, but there were many changes afterwards, and I think it'd be best to require at least pip version 21.0.0, which was released in January 2021. This release also dropped support for Python 2.

I will update this after #4441 was merged.

@bastimeyer bastimeyer marked this pull request as ready for review April 9, 2022 17:43
@back-to back-to merged commit 9b0815d into streamlink:master Apr 10, 2022
@bastimeyer bastimeyer deleted the build/pyproject branch April 10, 2022 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build system definition via pyproject.toml (PEP 518)
2 participants