Skip to content

Commit

Permalink
Add support for Python 3.11 and 3.12; remove support for 3.7 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzhengnan authored Dec 28, 2023
1 parent 75ef3b1 commit 2373317
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2021 Zhengnan Zhao
Copyright (c) 2020-2023 Zhengnan Zhao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion iscan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from iscan.scan import run


__version__ = '0.4.3'
__version__ = '0.4.4'
99 changes: 50 additions & 49 deletions iscan/std_lib.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
"""Modules in the standard library."""
import itertools
from typing import Iterable, List, Tuple


# Modules that come with the standard library in Python 2.7
STD_LIB_27 = [
'__builtin__', '__future__', '__main__', '_winreg',
'abc', 'aepack', 'aetools', 'aetypes', 'aifc', 'al', 'AL', 'anydbm', 'applesingle', 'argparse', 'array', 'ast', 'asynchat', 'asyncore', 'atexit', 'audioop', 'autoGIL',
'base64', 'BaseHTTPServer', 'Bastion', 'bdb', 'binascii', 'binhex', 'bisect', 'bsddb', 'buildtools', 'bz2',
'calendar', 'Carbon', 'cd', 'cfmfile', 'cgi', 'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop', 'collections', 'ColorPicker', 'colorsys', 'commands', 'compileall', 'compiler', 'ConfigParser', 'contextlib', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'cProfile', 'crypt', 'cStringIO', 'csv', 'ctypes', 'curses',
'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE', 'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm', 'dummy_thread', 'dummy_threading',
'EasyDialogs', 'email', 'encodings', 'ensurepip', 'errno', 'exceptions',
'fcntl', 'filecmp', 'fileinput', 'findertools', 'fl', 'FL', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl', 'fpformat', 'fractions', 'FrameWork', 'ftplib', 'functools', 'future_builtins',
'gc', 'gdbm', 'gensuitemodule', 'getopt', 'getpass', 'gettext', 'gl', 'GL', 'glob', 'grp', 'gzip',
'hashlib', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib', 'HTMLParser', 'httplib',
'ic', 'icopen', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'importlib', 'imputil', 'inspect', 'io', 'itertools',
'jpeg', 'json',
'keyword',
'lib2to3', 'linecache', 'locale', 'logging',
'macerrors', 'MacOS', 'macostools', 'macpath', 'macresource', 'mailbox', 'mailcap', 'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify', 'MiniAEFrame', 'mmap', 'modulefinder', 'msilib', 'msvcrt', 'multifile', 'multiprocessing', 'mutex',
'Nav', 'netrc', 'new', 'nis', 'nntplib', 'numbers',
'operator', 'optparse', 'os', 'ossaudiodev',
'parser', 'pdb', 'pickle', 'pickletools', 'pipes', 'PixMapWrapper', 'pkgutil', 'platform', 'plistlib', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile', 'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc',
'Queue', 'quopri',
'random', 're', 'readline', 'resource', 'rexec', 'rfc822', 'rlcompleter', 'robotparser', 'runpy',
'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve', 'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd', 'smtplib', 'sndhdr', 'socket', 'SocketServer', 'spwd', 'sqlite3', 'ssl', 'stat', 'statvfs', 'string', 'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'sunaudiodev', 'SUNAUDIODEV', 'symbol', 'symtable', 'sys', 'sysconfig', 'syslog',
'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios', 'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token', 'tokenize', 'trace', 'traceback', 'ttk', 'tty', 'turtle', 'types',
'unicodedata', 'unittest', 'urllib', 'urllib2', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'uuid',
'videoreader',
'W', 'warnings', 'wave', 'weakref', 'webbrowser', 'whichdb', 'winsound', 'wsgiref',
'xdrlib', 'xml', 'xmlrpclib',
'zipfile', 'zipimport', 'zlib'
]

# New modules introduced in Python 3.5+
STD_LIB_35 = [
'_dummy_thread', '_thread',
'asyncio', 'builtins', 'concurrent', 'configparser', 'copyreg', 'enum', 'faulthandler',
'html', 'http', 'ipaddress', 'lzma',
'pathlib', 'queue', 'reprlib', 'selectors', 'socketserver', 'statistics', 'tkinter', 'tracemalloc', 'turtledemo', 'typing',
'venv', 'winreg', 'xmlrpc', 'zipapp'
]
STD_LIB_36 = ['secrets']
STD_LIB_37 = ['contextvars', 'dataclasses']
STD_LIB_38 = [] # type: ignore
STD_LIB_39 = ['graphlib', 'zoneinfo']
STD_LIB_310 = [] # type: ignore

STD_LIB = STD_LIB_27 + STD_LIB_35 + STD_LIB_36 + STD_LIB_37 + STD_LIB_38 + STD_LIB_39 + STD_LIB_310
# Standard library modules in Python 2.7 and new modules since 3.5+
STD_LIB_BY_VERSION = {
'2.7': [
'__builtin__', '__future__', '__main__', '_winreg',
'abc', 'aepack', 'aetools', 'aetypes', 'aifc', 'al', 'AL', 'anydbm', 'applesingle', 'argparse', 'array', 'ast', 'asynchat', 'asyncore', 'atexit', 'audioop', 'autoGIL',
'base64', 'BaseHTTPServer', 'Bastion', 'bdb', 'binascii', 'binhex', 'bisect', 'bsddb', 'buildtools', 'bz2',
'calendar', 'Carbon', 'cd', 'cfmfile', 'cgi', 'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop', 'collections', 'ColorPicker', 'colorsys', 'commands', 'compileall', 'compiler', 'ConfigParser', 'contextlib', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'cProfile', 'crypt', 'cStringIO', 'csv', 'ctypes', 'curses',
'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE', 'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm', 'dummy_thread', 'dummy_threading',
'EasyDialogs', 'email', 'encodings', 'ensurepip', 'errno', 'exceptions',
'fcntl', 'filecmp', 'fileinput', 'findertools', 'fl', 'FL', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl', 'fpformat', 'fractions', 'FrameWork', 'ftplib', 'functools', 'future_builtins',
'gc', 'gdbm', 'gensuitemodule', 'getopt', 'getpass', 'gettext', 'gl', 'GL', 'glob', 'grp', 'gzip',
'hashlib', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib', 'HTMLParser', 'httplib',
'ic', 'icopen', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'importlib', 'imputil', 'inspect', 'io', 'itertools',
'jpeg', 'json',
'keyword',
'lib2to3', 'linecache', 'locale', 'logging',
'macerrors', 'MacOS', 'macostools', 'macpath', 'macresource', 'mailbox', 'mailcap', 'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify', 'MiniAEFrame', 'mmap', 'modulefinder', 'msilib', 'msvcrt', 'multifile', 'multiprocessing', 'mutex',
'Nav', 'netrc', 'new', 'nis', 'nntplib', 'numbers',
'operator', 'optparse', 'os', 'ossaudiodev',
'parser', 'pdb', 'pickle', 'pickletools', 'pipes', 'PixMapWrapper', 'pkgutil', 'platform', 'plistlib', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile', 'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc',
'Queue', 'quopri',
'random', 're', 'readline', 'resource', 'rexec', 'rfc822', 'rlcompleter', 'robotparser', 'runpy',
'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve', 'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd', 'smtplib', 'sndhdr', 'socket', 'SocketServer', 'spwd', 'sqlite3', 'ssl', 'stat', 'statvfs', 'string', 'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'sunaudiodev', 'SUNAUDIODEV', 'symbol', 'symtable', 'sys', 'sysconfig', 'syslog',
'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios', 'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token', 'tokenize', 'trace', 'traceback', 'ttk', 'tty', 'turtle', 'types',
'unicodedata', 'unittest', 'urllib', 'urllib2', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'uuid',
'videoreader',
'W', 'warnings', 'wave', 'weakref', 'webbrowser', 'whichdb', 'winsound', 'wsgiref',
'xdrlib', 'xml', 'xmlrpclib',
'zipfile', 'zipimport', 'zlib'
],
'3.5': [
'_dummy_thread', '_thread',
'asyncio', 'builtins', 'concurrent', 'configparser', 'copyreg', 'enum', 'faulthandler',
'html', 'http', 'ipaddress', 'lzma',
'pathlib', 'queue', 'reprlib', 'selectors', 'socketserver', 'statistics', 'tkinter', 'tracemalloc', 'turtledemo', 'typing',
'venv', 'winreg', 'xmlrpc', 'zipapp'
],
'3.6': ['secrets'],
'3.7': ['contextvars', 'dataclasses'],
'3.8': [],
'3.9': ['graphlib', 'zoneinfo'],
'3.10': ['idlelib'],
'3.11': ['_tkinter', 'sitecustomize', 'tomllib', 'usercustomize'],
'3.12': [],
}
STD_LIB = list(itertools.chain.from_iterable(STD_LIB_BY_VERSION.values())) # type: ignore


def separate_third_party_from_std_lib(packages: Iterable[str]) -> Tuple[List[str], List[str]]:
Expand Down Expand Up @@ -91,10 +93,9 @@ def get_std_lib(version: str) -> List[str]:


if __name__ == '__main__':
versions = ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10']
cumulative = []
for version in versions:
std_lib = get_std_lib(version)
print(f'\nNew additions in {version}')
for py_version in STD_LIB_BY_VERSION.keys():
std_lib = get_std_lib(py_version)
print(f'\nNew additions in {py_version}')
print([module for module in std_lib if module not in cumulative])
cumulative.extend(std_lib)
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
long_description_content_type='text/markdown',
packages=setuptools.find_packages(),
entry_points={'console_scripts': ['iscan=iscan.scan:main']},
python_requires='>=3.7',
python_requires='>=3.8',
extras_require=EXTRAS_REQUIRE,
classifiers=[
'Programming Language :: Python :: 3.7',
'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',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
]
Expand Down

0 comments on commit 2373317

Please sign in to comment.