Skip to content

Commit e755baf

Browse files
committed
chore: more Python 2 removal
1 parent 4839e58 commit e755baf

9 files changed

Lines changed: 13 additions & 59 deletions

File tree

.github/workflows/pip.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ env:
1717

1818
jobs:
1919
# This builds the sdists and wheels and makes sure the files are exactly as
20-
# expected. Using Windows and Python 2.7, since that is often the most
20+
# expected. Using Windows and Python 3.6, since that is often the most
2121
# challenging matrix element.
2222
test-packaging:
23-
name: 🐍 2.7 • 📦 tests • windows-latest
23+
name: 🐍 3.6 • 📦 tests • windows-latest
2424
runs-on: windows-latest
2525

2626
steps:
2727
- uses: actions/checkout@v2
2828

29-
- name: Setup 🐍 2.7
29+
- name: Setup 🐍 3.6
3030
uses: actions/setup-python@v2
3131
with:
32-
python-version: 2.7
32+
python-version: 3.6
3333

3434
- name: Prepare env
3535
run: |

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependency.
3434
Think of this library as a tiny self-contained version of Boost.Python
3535
with everything stripped away that isn’t relevant for binding
3636
generation. Without comments, the core header files only require ~4K
37-
lines of code and depend on Python (2.7 or 3.5+, or PyPy) and the C++
37+
lines of code and depend on Python (3.5+, or PyPy) and the C++
3838
standard library. This compact implementation was possible thanks to
3939
some of the new C++11 language features (specifically: tuples, lambda
4040
functions and variadic templates). Since its creation, this library has

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
nox.options.sessions = ["lint", "tests", "tests_packaging"]
44

5-
PYTHON_VERISONS = ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
5+
PYTHON_VERISONS = ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
66

77

88
@nox.session(reuse_venv=True)

pybind11/setup_helpers.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import contextlib
55
import distutils.ccompiler
6-
from distutils.command.build_ext import build_ext as _build_ext # type: ignore
6+
from distutils.command.build_ext import build_ext as _build_ext
77
from distutils.extension import Extension as _Extension
88
from types import TracebackType
99
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, TypeVar, Union
@@ -28,7 +28,7 @@ def tmp_chdir() -> Iterator[str]: ...
2828
def has_flag(compiler: distutils.ccompiler.CCompiler, flag: str) -> bool: ...
2929
def auto_cpp_level(compiler: distutils.ccompiler.CCompiler) -> Union[int, str]: ...
3030

31-
class build_ext(_build_ext): # type: ignore
31+
class build_ext(_build_ext):
3232
def build_extensions(self) -> None: ...
3333

3434
def intree_extensions(

pyproject.toml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,7 @@ profile = "black"
2323

2424
[tool.mypy]
2525
files = "pybind11"
26-
python_version = "2.7"
26+
python_version = "3.5"
2727
warn_unused_configs = true
2828

29-
disallow_any_generics = true
30-
disallow_subclassing_any = true
31-
disallow_untyped_calls = true
32-
disallow_untyped_defs = true
33-
disallow_incomplete_defs = true
34-
check_untyped_defs = true
35-
disallow_untyped_decorators = true
36-
no_implicit_optional = true
37-
warn_redundant_casts = true
38-
warn_unused_ignores = true
39-
warn_return_any = true
40-
no_implicit_reexport = true
41-
strict_equality = true
29+
strict = true

setup.cfg

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ classifiers =
1313
Topic :: Software Development :: Libraries :: Python Modules
1414
Topic :: Utilities
1515
Programming Language :: C++
16-
Programming Language :: Python :: 2.7
17-
Programming Language :: Python :: 3
16+
Programming Language :: Python :: 3 :: Only
1817
Programming Language :: Python :: 3.5
1918
Programming Language :: Python :: 3.6
2019
Programming Language :: Python :: 3.7
@@ -39,12 +38,9 @@ project_urls =
3938
Chat = https://gitter.im/pybind/Lobby
4039

4140
[options]
42-
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
41+
python_requires = >=3.5
4342
zip_safe = False
4443

45-
[bdist_wheel]
46-
universal=1
47-
4844

4945
[flake8]
5046
max-line-length = 99

tests/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,6 @@ if(PYBIND11_TEST_FILTER)
179179
pybind11_filter_tests(PYBIND11_TEST_FILES ${PYBIND11_TEST_FILTER})
180180
endif()
181181

182-
if(PYTHON_VERSION VERSION_LESS 3.5)
183-
pybind11_filter_tests(PYBIND11_TEST_FILES test_async.cpp MESSAGE
184-
"Skipping test_async on Python 2")
185-
endif()
186-
187182
# Skip tests for CUDA check:
188183
# /pybind11/tests/test_constants_and_functions.cpp(125):
189184
# error: incompatible exception specifications

tools/pybind11Common.cmake

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,6 @@ set_property(
6666
APPEND
6767
PROPERTY INTERFACE_LINK_LIBRARIES pybind11::pybind11)
6868

69-
# ----------------------- no register ----------------------
70-
71-
# Workaround for Python 2.7 and C++17 (C++14 as a warning) incompatibility
72-
# This adds the flags -Wno-register and -Wno-deprecated-register if the compiler
73-
# is Clang 3.9+ or AppleClang and the compile language is CXX, or /wd5033 for MSVC (all languages,
74-
# since MSVC didn't recognize COMPILE_LANGUAGE until CMake 3.11+).
75-
76-
add_library(pybind11::python2_no_register INTERFACE IMPORTED ${optional_global})
77-
set(clang_4plus
78-
"$<AND:$<CXX_COMPILER_ID:Clang>,$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,3.9>>>")
79-
set(no_register "$<OR:${clang_4plus},$<CXX_COMPILER_ID:AppleClang>>")
80-
81-
if(MSVC AND CMAKE_VERSION VERSION_LESS 3.11)
82-
set(cxx_no_register "${no_register}")
83-
else()
84-
set(cxx_no_register "$<AND:$<COMPILE_LANGUAGE:CXX>,${no_register}>")
85-
endif()
86-
87-
set(msvc "$<CXX_COMPILER_ID:MSVC>")
88-
89-
set_property(
90-
TARGET pybind11::python2_no_register
91-
PROPERTY INTERFACE_COMPILE_OPTIONS
92-
"$<${cxx_no_register}:-Wno-register;-Wno-deprecated-register>" "$<${msvc}:/wd5033>")
93-
9469
# --------------------------- link helper ---------------------------
9570

9671
add_library(pybind11::python_link_helper IMPORTED INTERFACE ${optional_global})

tools/pybind11Tools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ endif()
4343

4444
# A user can set versions manually too
4545
set(Python_ADDITIONAL_VERSIONS
46-
"3.11;3.10;3.9;3.8;3.7;3.6;3.5;3.4"
46+
"3.11;3.10;3.9;3.8;3.7;3.6;3.5"
4747
CACHE INTERNAL "")
4848

4949
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

0 commit comments

Comments
 (0)