Commit Graph

4 Commits

Author SHA1 Message Date
Nikita Shulga
5976f0bdfe Set min supported Python version to 3.8 (#93155)
Also, grep for `if sys.version_info .cond. (3, 8)` and replaces them with appropriate action.

This is a last in a series of PRs that moved CI/CD away from testing PyTorch behavior against Python-3.7.

Fixes https://github.com/pytorch/pytorch/issues/80513

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93155
Approved by: https://github.com/huydhn
2023-01-29 18:28:46 +00:00
joncrall
4c9eae331b Use standard mechanism for stdlib names (#81520)
I noticed that in #81261 all of the stdlib module names were explicitly listed, however as of Python 3.10 the stdlib now has a mechanism for this. https://github.com/python/cpython/issues/87121

I figured it was better to use `sys.stdlib_module_names` going forward for 3.10+ instead of having to maintain this file for every new Python release. For docs see:
https://docs.python.org/3/library/sys.html#sys.stdlib_module_names

I did a symmetric difference to determine what the effective change would be. I verified that everything listed in this file ins included in sys.stdlib_module_names. However, there are files in sys.stdlib_module_names that are not included in the previous hard coded definition. Namely these are:

```
frozenset({'__future__',
           '_abc',
           '_aix_support',
           '_asyncio',
           '_bisect',
           '_blake2',
           '_bootsubprocess',
           '_bz2',
           '_codecs',
           '_codecs_cn',
           '_codecs_hk',
           '_codecs_iso2022',
           '_codecs_jp',
           '_codecs_kr',
           '_codecs_tw',
           '_collections',
           '_collections_abc',
           '_compat_pickle',
           '_compression',
           '_contextvars',
           '_crypt',
           '_csv',
           '_ctypes',
           '_curses',
           '_curses_panel',
           '_datetime',
           '_dbm',
           '_decimal',
           '_elementtree',
           '_frozen_importlib',
           '_frozen_importlib_external',
           '_functools',
           '_gdbm',
           '_hashlib',
           '_heapq',
           '_imp',
           '_io',
           '_json',
           '_locale',
           '_lsprof',
           '_lzma',
           '_markupbase',
           '_md5',
           '_msi',
           '_multibytecodec',
           '_multiprocessing',
           '_opcode',
           '_operator',
           '_osx_support',
           '_overlapped',
           '_pickle',
           '_posixshmem',
           '_posixsubprocess',
           '_py_abc',
           '_pydecimal',
           '_pyio',
           '_queue',
           '_random',
           '_scproxy',
           '_sha1',
           '_sha256',
           '_sha3',
           '_sha512',
           '_signal',
           '_sitebuiltins',
           '_socket',
           '_sqlite3',
           '_sre',
           '_ssl',
           '_stat',
           '_statistics',
           '_string',
           '_strptime',
           '_struct',
           '_symtable',
           '_threading_local',
           '_tkinter',
           '_tracemalloc',
           '_uuid',
           '_warnings',
           '_weakref',
           '_weakrefset',
           '_winapi',
           '_zoneinfo',
           'antigravity',
           'genericpath',
           'idlelib',
           'nt',
           'nturl2path',
           'opcode',
           'pydoc_data',
           'pyexpat',
           'this'})
```

I'm not sure if excluding these matters. I wouldn't think it would, but if it does and it is better to explicitly update this file each time, then feel free to close this.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81520
Approved by: https://github.com/malfet
2022-07-15 23:11:23 +00:00
Nikita Shulga
9ed76c8c89 Add 3.10 stdlib to torch.package (#81261)
Copy-n-paste the list from https://github.com/PyCQA/isort/blob/main/isort/stdlibs/py310.py

Tested locally and in https://github.com/pytorch/pytorch/pull/81233
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81261
Approved by: https://github.com/suo
2022-07-11 20:21:28 +00:00
Michael Suo
285e69a9cd [package] more reliable method for determining standard library-ness (#51694)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51694

We implicitly extern standard library modules. Our method of determining
whether a module is in the standard library is a little unreliable. In
particular, I'm seeing lots of flaky errors on windows/mac CI when I
start doing more complicated packaging tests.

I looked into the best ways to do this, turns out there's no reliable
way, so tools that need to do this generally just parse the Python docs
for a listing and save it. I took `isort`'s lists and called it a day.

Test Plan: Imported from OSS

Reviewed By: zdevito

Differential Revision: D26243751

Pulled By: suo

fbshipit-source-id: 48c685cd45ae847fe986bcb9f39106e0c3361cdc
2021-02-09 07:42:41 -08:00