Skip to content

Commit

Permalink
feat!: Bump minimum Python version to 3.9
Browse files Browse the repository at this point in the history
Also reverts old fixes specific to Python 3.6
  • Loading branch information
joeyparrish committed Oct 30, 2024
1 parent 31e00a6 commit 74cda84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ See also the more detailed list of :ref:`Features` below.
Getting started
---------------

Shaka Streamer requires `Python 3.6+`_. Release versions of Shaka Streamer can
Shaka Streamer requires `Python 3.9+`_. Release versions of Shaka Streamer can
be installed or upgraded through ``pip3`` with:

.. code:: sh
Expand Down Expand Up @@ -167,9 +167,7 @@ the ``shaka-streamer`` script as an example of how to do this. See also


.. _config_files/: https://github.com/shaka-project/shaka-streamer/tree/main/config_files
.. _issue #8: https://github.com/shaka-project/shaka-streamer/issues/8
.. _issue #17: https://github.com/shaka-project/shaka-streamer/issues/17
.. _issue #23: https://github.com/shaka-project/shaka-streamer/issues/23
.. _Python 3.6+: https://www.python.org/downloads/
.. _Python 3.9+: https://www.python.org/downloads/
.. _Shaka Packager: https://github.com/shaka-project/shaka-packager
.. _FFmpeg: https://ffmpeg.org/
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
],
# Python 3.6 tested in GitHub Actions CI
python_requires='>=3.6',
# Python 3.9+ tested in GitHub Actions CI
python_requires='>=3.9',
)
14 changes: 7 additions & 7 deletions streamer/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def get_subtypes(
# is something like "str" or "int" instead of "typing.List" or
# "typing.Dict".
if hasattr(typing, 'get_args'):
args = typing.get_args(type) # type: ignore
args = typing.get_args(type)
elif hasattr(type, '__args__'):
# Before Python 3.8, you can use this undocumented attribute to get the
# type parameters. If this doesn't exist, you are probably dealing with a
Expand All @@ -256,9 +256,9 @@ def get_subtypes(
args = ()

underlying = Field.get_underlying_type(type)
if underlying in [dict, Dict]:
if underlying is dict:
return cast(Tuple[Optional[Type], Optional[Type]], args)
if underlying in [list, List]:
if underlying is list:
return (None, args[0])
return (None, None)

Expand All @@ -272,11 +272,11 @@ def get_type_name_static(type: Optional[Type],
if type is str:
# Call it a string, not a "str".
return 'string'
elif type in [list, List]:
elif type is list:
# Mention the subtype.
return 'list of {}'.format(
Field.get_type_name_static(subtype, None, None))
elif type in [dict, Dict]:
elif type is dict:
# Mention the subtype.
return 'dictionary of {} to {}'.format(
Field.get_type_name_static(keytype, None, None),
Expand Down Expand Up @@ -372,7 +372,7 @@ def _check_and_convert_type(self,

# For lists, check the type of the value itself, then check the subtype of
# the list items.
if field.type in [list, List]:
if field.type is list:
if not isinstance(value, list):
raise WrongType(self.__class__, key, field)

Expand All @@ -389,7 +389,7 @@ def _check_and_convert_type(self,

# For dictionaries, check the type of the value itself, then check the
# type of the dictionary keys, then the type of the dictionary values.
if field.type in [dict, Dict]:
if field.type is dict:
if not isinstance(value, dict):
raise WrongType(self.__class__, key, field)

Expand Down

0 comments on commit 74cda84

Please sign in to comment.