Skip to content
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

cli: list all dependencies in debug output #4575

Merged
merged 1 commit into from Jun 6, 2022

Conversation

bastimeyer
Copy link
Member

  • Require importlib-metadata as fallback on Python < 3.8
  • Add importlib_metadata to streamlink_cli.compat
  • List all dependencies in log_current_versions
  • Update tests

All of Streamlink's dependencies should be listed in the debug output. This is especially useful for figuring out issues like #4562.

$ streamlink -l debug
[cli][debug] OS:         Linux-5.18.1-1-git-x86_64-with-glibc2.35
[cli][debug] Python:     3.10.4
[cli][debug] Streamlink: 4.1.0+7.g0b539fd1
[cli][debug] Dependencies:
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.0
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.14.1
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.27.1
[cli][debug]  websocket-client: 1.3.2
[cli][debug] Arguments:
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
usage: streamlink [OPTIONS] <URL> [STREAM]

Use -h/--help to see the available options or read the manual at https://streamlink.github.io

Since importlib.metadata is only available on py38 and above, the importlib-metadata fallback requirement needs to be added for py37.
https://github.com/python/importlib_metadata#compatibility
https://pypi.org/project/importlib-metadata/

The version restriction of <4.3 is intentional because of flake8, which sets the same requirement:
https://github.com/PyCQA/flake8/blob/4.0.1/setup.cfg#L45
This unfortunately causes a conflict with sphinx, which requires >=4.4 for py37-py39:
https://github.com/sphinx-doc/sphinx/blob/v4.5.0/setup.py#L32

Since we don't build docs and thus don't install docs requirements on py37, we don't need to care about sphinx's dependency version conflict. But since we obviously run tests and lint code on py37, the version requirement of flake8 needs to be set to avoid introducing version conflicts when installing streamlink first and then streamlink's dev-requirements, because pip won't downgrade in this case.

This means that the version conflict does only affect packagers of streamlink who publish the latest versions for py37. This is already unlikely, and then it can simply be patched out if needed.

It probably doesn't matter anyway and the version conflict can probably be ignored... Flake8 is running fine with the latest importlib-metadata version. So should I remove the version restriction again?

$ pip install -U importlib-metadata
...
flake8 4.0.1 requires importlib-metadata<4.3; python_version < "3.8", but you have importlib-metadata 4.11.4 which is incompatible.
Successfully installed importlib-metadata-4.11.4
$ flake8
0

- Require importlib-metadata as fallback on Python < 3.8
- Add importlib_metadata to streamlink_cli.compat
- List all dependencies in `log_current_versions`
- Update tests
@bastimeyer
Copy link
Member Author

Decided to remove the version restriction.

@back-to back-to merged commit c319aa4 into streamlink:master Jun 6, 2022
@bastimeyer bastimeyer deleted the importlib-metadata branch June 6, 2022 11:05
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Jun 7, 2022
- Require importlib-metadata as fallback on Python < 3.8
- Add importlib_metadata to streamlink_cli.compat
- List all dependencies in `log_current_versions`
- Update tests
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Jun 7, 2022
- Require importlib-metadata as fallback on Python < 3.8
- Add importlib_metadata to streamlink_cli.compat
- List all dependencies in `log_current_versions`
- Update tests
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.

None yet

2 participants