Unverified Commit 522c59ce authored by Henry Schreiner's avatar Henry Schreiner Committed by GitHub
Browse files

chore: drop Python 3.5 (#3719)



* chore: drop Python 3.5 support

* chore: more fstrings with flynt's help

* ci: drop Python 3.5

* chore: bump dependency versions

* docs: touch up py::args

* tests: remove deprecation warning

* Ban smartquotes

* Very minor tweaks (by-product of reviewing PR #3719).
Co-authored-by: default avatarAaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: default avatarRalf W. Grosse-Kunstleve <rwgk@google.com>
parent 1a432b42
...@@ -15,7 +15,7 @@ def test_smart_ptr(capture): ...@@ -15,7 +15,7 @@ def test_smart_ptr(capture):
m.print_object_2(o) m.print_object_2(o)
m.print_object_3(o) m.print_object_3(o)
m.print_object_4(o) m.print_object_4(o)
assert capture == "MyObject1[{i}]\n".format(i=i) * 4 assert capture == f"MyObject1[{i}]\n" * 4
for i, o in enumerate( for i, o in enumerate(
[m.make_myobject1_1(), m.make_myobject1_2(), m.MyObject1(6), 7], start=4 [m.make_myobject1_1(), m.make_myobject1_2(), m.MyObject1(6), 7], start=4
...@@ -33,13 +33,11 @@ def test_smart_ptr(capture): ...@@ -33,13 +33,11 @@ def test_smart_ptr(capture):
m.print_myobject1_4(o) m.print_myobject1_4(o)
times = 4 if isinstance(o, int) else 8 times = 4 if isinstance(o, int) else 8
assert capture == "MyObject1[{i}]\n".format(i=i) * times assert capture == f"MyObject1[{i}]\n" * times
cstats = ConstructorStats.get(m.MyObject1) cstats = ConstructorStats.get(m.MyObject1)
assert cstats.alive() == 0 assert cstats.alive() == 0
expected_values = ["MyObject1[{}]".format(i) for i in range(1, 7)] + [ expected_values = [f"MyObject1[{i}]" for i in range(1, 7)] + ["MyObject1[7]"] * 4
"MyObject1[7]"
] * 4
assert cstats.values() == expected_values assert cstats.values() == expected_values
assert cstats.default_constructions == 0 assert cstats.default_constructions == 0
assert cstats.copy_constructions == 0 assert cstats.copy_constructions == 0
...@@ -57,7 +55,7 @@ def test_smart_ptr(capture): ...@@ -57,7 +55,7 @@ def test_smart_ptr(capture):
m.print_myobject2_2(o) m.print_myobject2_2(o)
m.print_myobject2_3(o) m.print_myobject2_3(o)
m.print_myobject2_4(o) m.print_myobject2_4(o)
assert capture == "MyObject2[{i}]\n".format(i=i) * 4 assert capture == f"MyObject2[{i}]\n" * 4
cstats = ConstructorStats.get(m.MyObject2) cstats = ConstructorStats.get(m.MyObject2)
assert cstats.alive() == 1 assert cstats.alive() == 1
...@@ -80,7 +78,7 @@ def test_smart_ptr(capture): ...@@ -80,7 +78,7 @@ def test_smart_ptr(capture):
m.print_myobject3_2(o) m.print_myobject3_2(o)
m.print_myobject3_3(o) m.print_myobject3_3(o)
m.print_myobject3_4(o) m.print_myobject3_4(o)
assert capture == "MyObject3[{i}]\n".format(i=i) * 4 assert capture == f"MyObject3[{i}]\n" * 4
cstats = ConstructorStats.get(m.MyObject3) cstats = ConstructorStats.get(m.MyObject3)
assert cstats.alive() == 1 assert cstats.alive() == 1
......
...@@ -13,7 +13,7 @@ def test_override(capture, msg): ...@@ -13,7 +13,7 @@ def test_override(capture, msg):
self.data = "Hello world" self.data = "Hello world"
def run(self, value): def run(self, value):
print("ExtendedExampleVirt::run(%i), calling parent.." % value) print(f"ExtendedExampleVirt::run({value}), calling parent..")
return super().run(value + 1) return super().run(value + 1)
def run_bool(self): def run_bool(self):
...@@ -24,7 +24,7 @@ def test_override(capture, msg): ...@@ -24,7 +24,7 @@ def test_override(capture, msg):
return "override1" return "override1"
def pure_virtual(self): def pure_virtual(self):
print("ExtendedExampleVirt::pure_virtual(): %s" % self.data) print(f"ExtendedExampleVirt::pure_virtual(): {self.data}")
class ExtendedExampleVirt2(ExtendedExampleVirt): class ExtendedExampleVirt2(ExtendedExampleVirt):
def __init__(self, state): def __init__(self, state):
......
...@@ -92,7 +92,7 @@ endif() ...@@ -92,7 +92,7 @@ endif()
# Use the Python interpreter to find the libs. # Use the Python interpreter to find the libs.
if(NOT PythonLibsNew_FIND_VERSION) if(NOT PythonLibsNew_FIND_VERSION)
set(PythonLibsNew_FIND_VERSION "3.5") set(PythonLibsNew_FIND_VERSION "3.6")
endif() endif()
find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} ${_pythonlibs_required} find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} ${_pythonlibs_required}
......
...@@ -13,7 +13,7 @@ lib = sys.argv[1] ...@@ -13,7 +13,7 @@ lib = sys.argv[1]
save = sys.argv[2] save = sys.argv[2]
if not os.path.exists(lib): if not os.path.exists(lib):
sys.exit("Error: requested file ({}) does not exist".format(lib)) sys.exit(f"Error: requested file ({lib}) does not exist")
libsize = os.path.getsize(lib) libsize = os.path.getsize(lib)
...@@ -28,7 +28,7 @@ if os.path.exists(save): ...@@ -28,7 +28,7 @@ if os.path.exists(save):
if change == 0: if change == 0:
print(" (no change)") print(" (no change)")
else: else:
print(" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize)) print(f" (change of {change:+} bytes = {change / oldsize:+.2%})")
else: else:
print() print()
......
...@@ -193,7 +193,7 @@ Using ``find_package`` with version info is not recommended except for release v ...@@ -193,7 +193,7 @@ Using ``find_package`` with version info is not recommended except for release v
.. code-block:: cmake .. code-block:: cmake
find_package(pybind11 CONFIG) find_package(pybind11 CONFIG)
find_package(pybind11 2.0 EXACT CONFIG REQUIRED) find_package(pybind11 2.9 EXACT CONFIG REQUIRED)
#]=============================================================================] #]=============================================================================]
@PACKAGE_INIT@ @PACKAGE_INIT@
......
...@@ -32,7 +32,7 @@ if(NOT Python_FOUND AND NOT Python3_FOUND) ...@@ -32,7 +32,7 @@ if(NOT Python_FOUND AND NOT Python3_FOUND)
set(Python_ROOT_DIR "$ENV{pythonLocation}") set(Python_ROOT_DIR "$ENV{pythonLocation}")
endif() endif()
find_package(Python 3.5 REQUIRED COMPONENTS Interpreter Development ${_pybind11_quiet}) find_package(Python 3.6 REQUIRED COMPONENTS Interpreter Development ${_pybind11_quiet})
# If we are in submodule mode, export the Python targets to global targets. # If we are in submodule mode, export the Python targets to global targets.
# If this behavior is not desired, FindPython _before_ pybind11. # If this behavior is not desired, FindPython _before_ pybind11.
......
...@@ -43,7 +43,7 @@ endif() ...@@ -43,7 +43,7 @@ endif()
# A user can set versions manually too # A user can set versions manually too
set(Python_ADDITIONAL_VERSIONS set(Python_ADDITIONAL_VERSIONS
"3.11;3.10;3.9;3.8;3.7;3.6;3.5" "3.11;3.10;3.9;3.8;3.7;3.6"
CACHE INTERNAL "") CACHE INTERNAL "")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
......
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Setup script for pybind11-global (in the sdist or in tools/setup_global.py in the repository) # Setup script for pybind11-global (in the sdist or in tools/setup_global.py in the repository)
# This package is targeted for easy use from CMake. # This package is targeted for easy use from CMake.
......
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Setup script (in the sdist or in tools/setup_main.py in the repository) # Setup script (in the sdist or in tools/setup_main.py in the repository)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment