From ab59628c2f1d200d35d68dd76fb3961aa102f584 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 17 Aug 2022 20:28:09 -0700 Subject: [PATCH 1/7] Support building mypycified mypy with PEP517 interface --- pyproject.toml | 6 ++++++ setup.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 95f65599a130..de6ec8d51f4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,12 @@ requires = [ "setuptools >= 40.6.2", "wheel >= 0.30.0", + "typing_extensions>=3.10", + "mypy_extensions>=0.4.3", + "typed_ast>=1.4.0,<2; python_version<'3.8'", + "tomli>=1.1.0; python_version<'3.11'", + "types-setuptools", + "types-typed-ast>=1.5.0,<1.6.0", ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index a8c86ff663a3..5390d09d92b4 100644 --- a/setup.py +++ b/setup.py @@ -79,8 +79,8 @@ def run(self): USE_MYPYC = False # To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH -if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc": - sys.argv.pop(1) +if len(sys.argv) > 1 and "--use-mypyc" in sys.argv: + sys.argv.remove("--use-mypyc") USE_MYPYC = True if os.getenv("MYPY_USE_MYPYC", None) == "1": USE_MYPYC = True From 7b027c9ec494aee755aea10f61f850c11ab492bd Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Sun, 21 Aug 2022 14:17:20 -0700 Subject: [PATCH 2/7] Remove build-requirements.txt, just use pyproject.toml --- MANIFEST.in | 1 - build-requirements.txt | 3 --- mypy-requirements.txt | 1 + pyproject.toml | 1 + test-requirements.txt | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 build-requirements.txt diff --git a/MANIFEST.in b/MANIFEST.in index 1c26ae16fc78..c5c307f6b8d6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -30,7 +30,6 @@ graft mypyc/doc # files necessary for testing sdist include mypy-requirements.txt -include build-requirements.txt include test-requirements.txt include mypy_self_check.ini prune misc diff --git a/build-requirements.txt b/build-requirements.txt deleted file mode 100644 index dabc9b14c493..000000000000 --- a/build-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --r mypy-requirements.txt -types-setuptools -types-typed-ast>=1.5.0,<1.6.0 diff --git a/mypy-requirements.txt b/mypy-requirements.txt index 1c372294383d..ee5fe5d295b8 100644 --- a/mypy-requirements.txt +++ b/mypy-requirements.txt @@ -1,3 +1,4 @@ +# NOTE: this needs to be kept in sync with the "requires" list in pyproject.toml typing_extensions>=3.10 mypy_extensions>=0.4.3 typed_ast>=1.4.0,<2; python_version<'3.8' diff --git a/pyproject.toml b/pyproject.toml index de6ec8d51f4d..fa6913598df8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] requires = [ + # NOTE: this needs to be kept in sync with mypy-requirements.txt "setuptools >= 40.6.2", "wheel >= 0.30.0", "typing_extensions>=3.10", diff --git a/test-requirements.txt b/test-requirements.txt index d5bc3f1113a9..9d060b065243 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,4 @@ -r mypy-requirements.txt --r build-requirements.txt attrs>=18.0 black==22.6.0 # must match version in .pre-commit-config.yaml filelock>=3.3.0,<3.4.2; python_version<'3.7' From 68047e656bdafe51f630ac788447cc4a331168a7 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Fri, 2 Sep 2022 12:10:10 -0700 Subject: [PATCH 3/7] Fix tests and re-add types-psutil --- .github/workflows/test.yml | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8f8a2a05e2b..c06bb0692f57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -120,7 +120,7 @@ jobs: if: ${{ matrix.test_mypyc }} run: | pip install -r test-requirements.txt - CC=clang MYPYC_OPT_LEVEL=0 python3 setup.py --use-mypyc build_ext --inplace + CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e . - name: Setup tox environment run: tox -e ${{ matrix.toxenv }} --notest - name: Test diff --git a/pyproject.toml b/pyproject.toml index fa6913598df8..5e5f8dc0ede1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ requires = [ "mypy_extensions>=0.4.3", "typed_ast>=1.4.0,<2; python_version<'3.8'", "tomli>=1.1.0; python_version<'3.11'", + "types-psutil", "types-setuptools", "types-typed-ast>=1.5.0,<1.6.0", ] From 6350673a50f77c2aa44e1c2ac2c014b9a89f3eff Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Sat, 3 Sep 2022 15:57:12 -0700 Subject: [PATCH 4/7] Update pyproject.toml Co-authored-by: Alex Waygood --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5e5f8dc0ede1..1b4db0f0bc48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ requires = [ "tomli>=1.1.0; python_version<'3.11'", "types-psutil", "types-setuptools", - "types-typed-ast>=1.5.0,<1.6.0", + "types-typed-ast>=1.5.8,<1.6.0", ] build-backend = "setuptools.build_meta" From 14cacfb8b53373c64fbd443a1d9a866fd68713e3 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Sat, 3 Sep 2022 21:08:07 -0700 Subject: [PATCH 5/7] Argh we need types for selfcheck --- MANIFEST.in | 1 + build-requirements.txt | 4 ++++ pyproject.toml | 4 ++++ test-requirements.txt | 8 +++++--- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 build-requirements.txt diff --git a/MANIFEST.in b/MANIFEST.in index c5c307f6b8d6..1c26ae16fc78 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -30,6 +30,7 @@ graft mypyc/doc # files necessary for testing sdist include mypy-requirements.txt +include build-requirements.txt include test-requirements.txt include mypy_self_check.ini prune misc diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 000000000000..0bf40e3c03e8 --- /dev/null +++ b/build-requirements.txt @@ -0,0 +1,4 @@ +-r mypy-requirements.txt +types-psutil +types-setuptools +types-typed-ast>=1.5.8,<1.6.0 diff --git a/pyproject.toml b/pyproject.toml index 1b4db0f0bc48..a792eb43882c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,16 @@ [build-system] requires = [ # NOTE: this needs to be kept in sync with mypy-requirements.txt + # and build-requirements.txt, because those are both needed for + # self-typechecking :/ "setuptools >= 40.6.2", "wheel >= 0.30.0", + # the following is from mypy-requirements.txt "typing_extensions>=3.10", "mypy_extensions>=0.4.3", "typed_ast>=1.4.0,<2; python_version<'3.8'", "tomli>=1.1.0; python_version<'3.11'", + # the following is from build-requirements.txt "types-psutil", "types-setuptools", "types-typed-ast>=1.5.8,<1.6.0", diff --git a/test-requirements.txt b/test-requirements.txt index fb09651e810c..d5bc3f1113a9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,11 +1,12 @@ -r mypy-requirements.txt +-r build-requirements.txt attrs>=18.0 black==22.6.0 # must match version in .pre-commit-config.yaml filelock>=3.3.0,<3.4.2; python_version<'3.7' filelock>=3.3.0; python_version>='3.7' -flake8==5.0.4 # must match version in .pre-commit-config.yaml -flake8-bugbear==22.8.23 # must match version in .pre-commit-config.yaml -flake8-noqa==1.2.9 # must match version in .pre-commit-config.yaml +flake8==3.9.2 # must match version in .pre-commit-config.yaml +flake8-bugbear==22.7.1 # must match version in .pre-commit-config.yaml +flake8-noqa==1.2.8 # must match version in .pre-commit-config.yaml isort[colors]==5.10.1 # must match version in .pre-commit-config.yaml lxml>=4.4.0; python_version<'3.11' psutil>=4.0 @@ -18,3 +19,4 @@ py>=1.5.2 typed_ast>=1.5.4,<2; python_version>='3.8' setuptools!=50 six +importlib-metadata>=4.6.1,<5.0.0 From 104d2a43b80c0910497b2d4d49fd2c2d9d453c93 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Sat, 3 Sep 2022 21:12:30 -0700 Subject: [PATCH 6/7] Ooops, remove accidental change to test-requirements.txt --- test-requirements.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index d5bc3f1113a9..019a86541314 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,9 +4,9 @@ attrs>=18.0 black==22.6.0 # must match version in .pre-commit-config.yaml filelock>=3.3.0,<3.4.2; python_version<'3.7' filelock>=3.3.0; python_version>='3.7' -flake8==3.9.2 # must match version in .pre-commit-config.yaml -flake8-bugbear==22.7.1 # must match version in .pre-commit-config.yaml -flake8-noqa==1.2.8 # must match version in .pre-commit-config.yaml +flake8==5.0.4 # must match version in .pre-commit-config.yaml +flake8-bugbear==22.8.23 # must match version in .pre-commit-config.yaml +flake8-noqa==1.2.9 # must match version in .pre-commit-config.yaml isort[colors]==5.10.1 # must match version in .pre-commit-config.yaml lxml>=4.4.0; python_version<'3.11' psutil>=4.0 @@ -19,4 +19,3 @@ py>=1.5.2 typed_ast>=1.5.4,<2; python_version>='3.8' setuptools!=50 six -importlib-metadata>=4.6.1,<5.0.0 From 5010f15daadeb995b6456570de7b585a888aa252 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Fri, 16 Sep 2022 20:38:18 -0700 Subject: [PATCH 7/7] Add comment to build-requirements.txt --- build-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/build-requirements.txt b/build-requirements.txt index 0bf40e3c03e8..52c518d53bc2 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -1,3 +1,4 @@ +# NOTE: this needs to be kept in sync with the "requires" list in pyproject.toml -r mypy-requirements.txt types-psutil types-setuptools