Repository: facebookincubator/ptr

Issue:
Fix 3.11 from failing when deps are ready
Some dependencies don't work in 3.11.

- wrapt uses a removed method from inspect module
  - https://github.com/GrahamDumpleton/wrapt/issues/196


Discussion:

Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a05aa64..0310917 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,4 +39,5 @@ jobs:
        PTR_INTEGRATION: 1
        pythonioencoding: utf-8
       run: |
+        python -m pip install -r requirements.txt
         python ci.py
diff --git a/.pylint b/.pylint
index 474c73b..2ca1abf 100644
--- a/.pylint
+++ b/.pylint
@@ -54,92 +54,7 @@ confidence=
 # --enable=similarities". If you want to run only the classes checker, but have
 # no Warning level messages displayed, use"--disable=all --enable=classes
 # --disable=W"
-disable=print-statement,
-        parameter-unpacking,
-        unpacking-in-except,
-        old-raise-syntax,
-        backtick,
-        long-suffix,
-        old-ne-operator,
-        old-octal-literal,
-        import-star-module-level,
-        non-ascii-bytes-literal,
-        raw-checker-failed,
-        bad-inline-option,
-        locally-disabled,
-        locally-enabled,
-        file-ignored,
-        suppressed-message,
-        useless-suppression,
-        deprecated-pragma,
-        apply-builtin,
-        basestring-builtin,
-        buffer-builtin,
-        cmp-builtin,
-        coerce-builtin,
-        execfile-builtin,
-        file-builtin,
-        long-builtin,
-        raw_input-builtin,
-        reduce-builtin,
-        standarderror-builtin,
-        unicode-builtin,
-        xrange-builtin,
-        coerce-method,
-        delslice-method,
-        getslice-method,
-        setslice-method,
-        no-absolute-import,
-        old-division,
-        dict-iter-method,
-        dict-view-method,
-        next-method-called,
-        metaclass-assignment,
-        indexing-exception,
-        raising-string,
-        reload-builtin,
-        oct-method,
-        hex-method,
-        nonzero-method,
-        cmp-method,
-        input-builtin,
-        round-builtin,
-        intern-builtin,
-        unichr-builtin,
-        map-builtin-not-iterating,
-        zip-builtin-not-iterating,
-        range-builtin-not-iterating,
-        filter-builtin-not-iterating,
-        using-cmp-argument,
-        eq-without-hash,
-        div-method,
-        idiv-method,
-        rdiv-method,
-        exception-message-attribute,
-        invalid-str-codec,
-        sys-max-int,
-        bad-python3-import,
-        deprecated-string-function,
-        deprecated-str-translate-call,
-        deprecated-itertools-function,
-        deprecated-types-field,
-        next-method-defined,
-        dict-items-not-iterating,
-        dict-keys-not-iterating,
-        dict-values-not-iterating,
-        missing-docstring,
-        bad-continuation,
-        global-statement,
-        invalid-name,
-        duplicate-code,
-        unused-argument,
-        missing-docstring,
-        function-redefined,
-        too-many-public-methods,
-        protected-access,
-        logging-format-interpolation,
-        no-self-use,
-        ungrouped-imports,
+disable=ungrouped-imports,
         fixme,
         too-many-function-args,
         logging-fstring-interpolation,
@@ -323,13 +238,6 @@ max-line-length=90
 # Maximum number of lines in a module
 max-module-lines=2000
 
-# List of optional constructs for which whitespace checking is disabled. `dict-
-# separator` is used to allow tabulation in dicts, etc.: {1  : 1,\n222: 2}.
-# `trailing-comma` allows a space between comma and closing bracket: (a, ).
-# `empty-line` allows space-only lines.
-no-space-check=trailing-comma,
-               dict-separator
-
 # Allow the body of a class to be on the same line as the declaration if body
 # contains single statement.
 single-line-class-stmt=no
diff --git a/mypy.ini b/mypy.ini
index 3328556..bc27ba7 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -6,5 +6,6 @@ disallow_untyped_decorators = True
 disallow_untyped_defs = True
 no_implicit_optional = True
 show_error_context = True
-warn_unused_ignores = True
+# Due to tomli dance we have to ignore this
+warn_unused_ignores = False
 warn_return_any = True
diff --git a/ptr.py b/ptr.py
index aa7fb00..dfd6e5d 100755
--- a/ptr.py
+++ b/ptr.py
@@ -7,6 +7,7 @@
 # Can remove once we're >= 3.7 so asyncio has a .run() method
 # pyre-ignore-all-errors[0]
 # pyre-ignore-all-errors[16]
+# pyre-ignore-all-errors[21]
 
 import argparse
 import ast
@@ -36,8 +37,7 @@ if sys.version_info >= (3, 11):  # pragma: no cover
         # Help users on older alphas
         import tomli as tomllib
 else:
-    # pyre-ignore: Undefined import [21]
-    import tomli as tomllib
+    import tomli as tomllib  # type: ignore
 
 
 LOG = logging.getLogger(__name__)
diff --git a/pyproject.toml b/pyproject.toml
index 48bc58e..b808fd0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,5 +12,5 @@ run_usort = true
 run_black = true
 run_mypy = true
 run_flake8 = true
-run_pylint = true
+run_pylint = false
 run_pyre = true
diff --git a/setup.py b/setup.py
index bbdae33..abccc09 100644
--- a/setup.py
+++ b/setup.py
@@ -30,8 +30,8 @@ ptr_params = {
     "run_mypy": True,
     # Run flake8 or not
     "run_flake8": True,
-    # Run pylint or not - Disabled until 3.9 Support
-    "run_pylint": True,
+    # Run pylint or not - Disabled due to python3.11 support
+    "run_pylint": False,
     # Run pyre or not
     "run_pyre": True,
 }
@@ -68,6 +68,7 @@ setup(
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: 3.10",
+        "Programming Language :: Python :: 3.11",
     ],
     python_requires=">=3.7",
     install_requires=["tomli>=1.1.0; python_full_version < '3.11.0a7'"],


Test patch:
diff --git a/.github/workflows/ci_latest.yml b/.github/workflows/ci_latest.yml
index 6a6f868..87d698a 100644
--- a/.github/workflows/ci_latest.yml
+++ b/.github/workflows/ci_latest.yml
@@ -39,4 +39,5 @@ jobs:
          PTR_INTEGRATION: 1
          pythonioencoding: utf-8
         run: |
-          python ci.py || echo "!! FAILED: Please look into - returned $?"
+          python -m pip install -r requirements.txt
+          python ci.py
diff --git a/ptr_tests.py b/ptr_tests.py
index 054f3fb..ae88b08 100644
--- a/ptr_tests.py
+++ b/ptr_tests.py
@@ -561,7 +561,7 @@ class TestPtr(unittest.TestCase):
                 self.loop.run_until_complete(
                     ptr._test_steps_runner(*tsr_params)  # pyre-ignore
                 ),
-                (None, 8) if no_pyre else (None, 9),
+                (None, 7) if no_pyre else (None, 8),
             )
 
             # Test we run coverage when required_coverage does not exist
@@ -574,7 +574,7 @@ class TestPtr(unittest.TestCase):
                 self.loop.run_until_complete(
                     ptr._test_steps_runner(*tsr_params)  # pyre-ignore
                 ),
-                (None, 8) if no_pyre else (None, 9),
+                (None, 7) if no_pyre else (None, 8),
             )
 
             # Run everything but black + no print cov
@@ -585,11 +585,11 @@ class TestPtr(unittest.TestCase):
             self.assertEqual(
                 # pyre-ignore[6]: Tests ...
                 self.loop.run_until_complete(ptr._test_steps_runner(*tsr_params)),
-                (None, 7) if no_pyre else (None, 8),
+                (None, 6) if no_pyre else (None, 7),
             )
 
             # Run everything but test_suite with print_cov
-            expected_no_pyre_tests = (None, 7) if no_pyre else (None, 8)
+            expected_no_pyre_tests = (None, 6) if no_pyre else (None, 7)
             etp = deepcopy(ptr_tests_fixtures.EXPECTED_TEST_PARAMS)
             del etp["test_suite"]
             del etp["required_coverage"]
diff --git a/ptr_tests_fixtures.py b/ptr_tests_fixtures.py
index b67eda1..5b9093b 100644
--- a/ptr_tests_fixtures.py
+++ b/ptr_tests_fixtures.py
@@ -35,7 +35,7 @@ EXPECTED_TEST_PARAMS = {
     "run_black": True,
     "run_mypy": True,
     "run_flake8": True,
-    "run_pylint": True,
+    "run_pylint": False,
     "run_pyre": True,
 }
 
@@ -222,7 +222,7 @@ run_usort = true
 run_black = true
 run_mypy = true
 run_flake8 = true
-run_pylint = true
+run_pylint = false
 run_pyre = true
 """
 
@@ -239,7 +239,7 @@ run_usort = true
 run_black = true
 run_mypy = true
 run_flake8 = true
-run_pylint = true
+run_pylint = false
 run_pyre = true
 """