Skip to content

Commit

Permalink
Add Python 3.11 and Python 3.12 to build workflow (#485)
Browse files Browse the repository at this point in the history
This change brings github actions back into the green.
  • Loading branch information
dbieber authored Feb 24, 2024
1 parent 8a41c91 commit 343e6b6
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 19 deletions.
11 changes: 7 additions & 4 deletions .github/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
setuptools <65.7.0
pip <23.0
setuptools <65.7.0 ; python_version == '2.7'
setuptools <=69.1.1 ; python_version >= '3.8'
pip <23.0 ; python_version == '2.7'
pip ; python_version >= '3.5'
pylint <2.15.10
pytest <=7.2.1
pytest-pylint <=1.1.2
pytest-runner <6.0.0
termcolor <2.2.0
hypothesis <6.62.0
python-Levenshtein <0.20.9
mock <5.0.0
python-Levenshtein <0.20.9 ; python_version == '2.7'
levenshtein <=0.25.0 ; python_version >= '3.5'
mock <5.0.0
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.5", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.5", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
# Checkout the repo.
Expand Down
2 changes: 1 addition & 1 deletion fire/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
from fire.core import Fire

__all__ = ['Fire']
__version__ = '0.5.0'
__version__ = '0.6.0'
2 changes: 1 addition & 1 deletion fire/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def import_from_file_path(path):
spec.loader.exec_module(module) # pytype: disable=attribute-error

else:
import imp # pylint: disable=g-import-not-at-top,import-outside-toplevel,deprecated-module
import imp # pylint: disable=g-import-not-at-top,import-outside-toplevel,deprecated-module,import-error
module = imp.load_source(module_name, path)

return module, module_name
Expand Down
12 changes: 6 additions & 6 deletions fire/console/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def Decode(data, encoding=None):

try:
# Just return the string if its pure ASCII.
return string.decode('ascii')
return string.decode('ascii') # pytype: disable=attribute-error
except UnicodeError:
# The string is not ASCII encoded.
pass

# Try the suggested encoding if specified.
if encoding:
try:
return string.decode(encoding)
return string.decode(encoding) # pytype: disable=attribute-error
except UnicodeError:
# Bad suggestion.
pass
Expand All @@ -103,21 +103,21 @@ def Decode(data, encoding=None):
# be exceptional if a valid extended ascii encoding with extended chars
# were also a valid UITF-8 encoding.
try:
return string.decode('utf8')
return string.decode('utf8') # pytype: disable=attribute-error
except UnicodeError:
# Not a UTF-8 encoding.
pass

# Try the filesystem encoding.
try:
return string.decode(sys.getfilesystemencoding())
return string.decode(sys.getfilesystemencoding()) # pytype: disable=attribute-error
except UnicodeError:
# string is not encoded for filesystem paths.
pass

# Try the system default encoding.
try:
return string.decode(sys.getdefaultencoding())
return string.decode(sys.getdefaultencoding()) # pytype: disable=attribute-error
except UnicodeError:
# string is not encoded using the default encoding.
pass
Expand All @@ -137,7 +137,7 @@ def Decode(data, encoding=None):
# string = '\xdc'
# string = string.decode('iso-8859-1')
# string = string.encode('ascii', 'backslashreplace')
return string.decode('iso-8859-1')
return string.decode('iso-8859-1') # pytype: disable=attribute-error


def GetEncodedValue(env, name, default=None):
Expand Down
4 changes: 3 additions & 1 deletion fire/formatting_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def initialize_or_disable():
"""Enables ANSI processing on Windows or disables it as needed."""
if HAS_COLORAMA:
wrap = True
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty() and platform.release() == '10':
if (hasattr(sys.stdout, "isatty")
and sys.stdout.isatty()
and platform.release() == '10'):
# Enables native ANSI sequences in console.
# Windows 10, 2016, and 2019 only.

Expand Down
4 changes: 2 additions & 2 deletions fire/inspectutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class with an __init__ method.
def Py2GetArgSpec(fn):
"""A wrapper around getargspec that tries both fn and fn.__call__."""
try:
return inspect.getargspec(fn) # pylint: disable=deprecated-method
return inspect.getargspec(fn) # pylint: disable=deprecated-method,no-member
except TypeError:
if hasattr(fn, '__call__'):
return inspect.getargspec(fn.__call__) # pylint: disable=deprecated-method
return inspect.getargspec(fn.__call__) # pylint: disable=deprecated-method,no-member
raise


Expand Down
2 changes: 1 addition & 1 deletion fire/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def assertOutputMatches(self, stdout='.*', stderr='.*', capture=True):

def assertRaisesRegex(self, *args, **kwargs): # pylint: disable=arguments-differ
if sys.version_info.major == 2:
return super(BaseTestCase, self).assertRaisesRegexp(*args, **kwargs) # pylint: disable=deprecated-method
return super(BaseTestCase, self).assertRaisesRegexp(*args, **kwargs) # pylint: disable=deprecated-method,no-member
else:
return super(BaseTestCase, self).assertRaisesRegex(*args, **kwargs) # pylint: disable=no-member

Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enable=indexing-exception,old-raise-syntax
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifier separated by comma (,) or put this option
# multiple time.
disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,file-ignored,wrong-import-order,useless-object-inheritance,no-else-return,super-with-arguments,raise-missing-from,consider-using-f-string,unspecified-encoding,unnecessary-lambda-assignment
disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,file-ignored,wrong-import-order,useless-object-inheritance,no-else-return,super-with-arguments,raise-missing-from,consider-using-f-string,unspecified-encoding,unnecessary-lambda-assignment,wrong-import-position,ungrouped-imports,deprecated-module


[REPORTS]
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'python-Levenshtein',
]

VERSION = '0.5.0'
VERSION = '0.6.0'
URL = 'https://github.com/google/python-fire'

setup(
Expand Down Expand Up @@ -72,6 +72,8 @@
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',

'Operating System :: OS Independent',
'Operating System :: POSIX',
Expand Down

0 comments on commit 343e6b6

Please sign in to comment.